This commit is contained in:
2026-01-26 22:05:58 +01:00
parent f94f8d3abe
commit db207f4995
2 changed files with 11 additions and 5 deletions

View File

@@ -270,7 +270,7 @@ class AutomationDocument(ModelSQL, ModelView, Workflow):
else: else:
sale = Sale() sale = Sale()
sale_line = SaleLine() sale_line = SaleLine()
sale.party = Party.getPartyByName(customer) 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
sale.company = 6 sale.company = 6

View File

@@ -1,12 +1,9 @@
from trytond.model import ModelSQL, ModelView, fields from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import PoolMeta from trytond.pool import PoolMeta, Pool
from trytond.exceptions import UserError from trytond.exceptions import UserError
from trytond.modules.purchase_trade.purchase import (TRIGGERS) from trytond.modules.purchase_trade.purchase import (TRIGGERS)
from trytond.transaction import Transaction from trytond.transaction import Transaction
__all__ = ['Party']
__metaclass__ = PoolMeta
class PartyExecution(ModelSQL,ModelView): class PartyExecution(ModelSQL,ModelView):
"Party Execution" "Party Execution"
__name__ = 'party.execution' __name__ = 'party.execution'
@@ -34,5 +31,14 @@ class Party(metaclass=PoolMeta):
p = cls() p = cls()
p.name = party p.name = party
cls.save([p]) cls.save([p])
if category:
Category = Pool().get('party.category')
cat = Category.search(['name','=',category])
if cat:
PartyCategory = Pool().get('party.party-party.category')
pc = PartyCategory()
pc.party = p.id
pc.category = cat[0].id
PartyCategory.save([pc])
return p return p