main #7
@@ -261,7 +261,7 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
|||||||
logger.info("DECLARATION_KEY:%s",dec_key)
|
logger.info("DECLARATION_KEY:%s",dec_key)
|
||||||
declaration = SaleLine.search(['note','=',dec_key])
|
declaration = SaleLine.search(['note','=',dec_key])
|
||||||
if declaration:
|
if declaration:
|
||||||
with Transaction().new_transaction() as trans1:
|
continue
|
||||||
sale_line = declaration[0]
|
sale_line = declaration[0]
|
||||||
logger.info("WITH_DEC:%s",sale_line)
|
logger.info("WITH_DEC:%s",sale_line)
|
||||||
vlot = sale_line.lots[0]
|
vlot = sale_line.lots[0]
|
||||||
@@ -269,12 +269,9 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
|||||||
if lqt and lqt[0].lot_p:
|
if lqt and lqt[0].lot_p:
|
||||||
logger.info("VLOT_P:%s",lqt[0].lot_p)
|
logger.info("VLOT_P:%s",lqt[0].lot_p)
|
||||||
lqt[0].lot_p.updateVirtualPart(round(lot_net_weight,2),sh[0],lqt[0].lot_s)
|
lqt[0].lot_p.updateVirtualPart(round(lot_net_weight,2),sh[0],lqt[0].lot_s)
|
||||||
trans1.commit()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
sale = Sale()
|
sale = Sale()
|
||||||
sale_line = SaleLine()
|
sale_line = SaleLine()
|
||||||
with Transaction().new_transaction() as trans1:
|
|
||||||
sale.party = Party.getPartyByName(customer,'CLIENT')
|
sale.party = Party.getPartyByName(customer,'CLIENT')
|
||||||
logger.info("SALE_PARTY:%s",sale.party)
|
logger.info("SALE_PARTY:%s",sale.party)
|
||||||
sale.reference = reference
|
sale.reference = reference
|
||||||
@@ -306,9 +303,7 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
|||||||
sale_line.created_by_code = False
|
sale_line.created_by_code = False
|
||||||
sale_line.note = dec_key
|
sale_line.note = dec_key
|
||||||
SaleLine.save([sale_line])
|
SaleLine.save([sale_line])
|
||||||
trans1.commit()
|
|
||||||
|
|
||||||
with Transaction().new_transaction() as trans2:
|
|
||||||
ContractStart = Pool().get('contracts.start')
|
ContractStart = Pool().get('contracts.start')
|
||||||
ContractDetail = Pool().get('contract.detail')
|
ContractDetail = Pool().get('contract.detail')
|
||||||
ct = ContractStart()
|
ct = ContractStart()
|
||||||
@@ -342,7 +337,6 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
|
|||||||
type_=ct.type,
|
type_=ct.type,
|
||||||
ct=ct,
|
ct=ct,
|
||||||
)
|
)
|
||||||
trans2.commit()
|
|
||||||
|
|
||||||
#Lots creation
|
#Lots creation
|
||||||
# vlot = sale_line.lots[0]
|
# vlot = sale_line.lots[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user