main #7

Merged
admin merged 620 commits from main into dev 2026-03-29 13:03:25 +00:00
Showing only changes of commit 71a58814b4 - Show all commits

View File

@@ -261,6 +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:
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]
@@ -268,9 +269,12 @@ 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
@@ -302,7 +306,9 @@ 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()
@@ -336,6 +342,7 @@ 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]