From 7ae145b6c124ccb03fb069cf963c36e4a2d2db09 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Wed, 4 Mar 2026 17:56:58 +0100 Subject: [PATCH] 04.03.26 --- modules/sale/sale.py | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/modules/sale/sale.py b/modules/sale/sale.py index ef6f97f..68f7267 100755 --- a/modules/sale/sale.py +++ b/modules/sale/sale.py @@ -2300,21 +2300,24 @@ class SaleReport(CompanyReport): @classmethod def execute(cls, ids, data): - pool = Pool() - Company = pool.get('company.company') + with Transaction().set_context(address_with_party=True): + return super().execute(ids, data) + @classmethod + def _execute(cls, records, header, data, action): company_id = Transaction().context.get('company') + logger.info("_EXECUTE:%s",company_id) if company_id: + pool = Pool() + Company = pool.get('company.company') company = Company(company_id) if company.party.name == 'MELYA': - data = dict(data) - data['action_id'] = None + # Patch l'objet action en mémoire, pas en DB + action.report = 'sale/sale_melya.fodt' + action.report_content = None # force rechargement depuis fichier - with Transaction().set_context( - address_with_party=True, - report_company=company_id): - return super().execute(ids, data) - + return super()._execute(records, header, data, action) + @classmethod def get_context(cls, records, header, data): pool = Pool() @@ -2326,21 +2329,6 @@ class SaleReport(CompanyReport): context['today'] = Date.today() return context - @classmethod - def _get_action(cls, data): - action = super()._get_action(data) - - Company = Pool().get('company.company') - company_id = Transaction().context.get('company') - logger.info("GET_ACTION:%s",company_id) - if company_id: - company = Company(company_id) - logger.info("GET_ACTION_NAME:%s",company.party.name) - if company.party.name == 'MELYA': - action.report = 'sale/sale_melya.fodt' - - return action - class OpenCustomer(Wizard): 'Open Customers' __name__ = 'sale.open_customer'