From a50933e7dc08113ba510756ca0661c68d3315db5 Mon Sep 17 00:00:00 2001 From: Pablo Montenegro Date: Wed, 9 Aug 2023 11:27:45 +0000 Subject: [PATCH] =?UTF-8?q?[FIX]=20public=5Fbudget:=20crear=20comprobante?= =?UTF-8?q?=20desde=20transacci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes ingadhoc/odoo-public-administration#497 Ticket: 64385 Signed-off-by: Katherine Zaoral --- public_budget/__manifest__.py | 2 +- .../wizards/transaction_definitive_make_invoice.py | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/public_budget/__manifest__.py b/public_budget/__manifest__.py index fbb9288b..8f9c09f9 100644 --- a/public_budget/__manifest__.py +++ b/public_budget/__manifest__.py @@ -1,7 +1,7 @@ { 'name': 'Public Budget', 'license': 'AGPL-3', - 'version': "15.0.1.10.0", + 'version': "15.0.1.11.0", 'author': 'ADHOC SA,Odoo Community Association (OCA)', 'website': 'www.adhoc.com.ar', 'category': 'Accounting & Finance', diff --git a/public_budget/wizards/transaction_definitive_make_invoice.py b/public_budget/wizards/transaction_definitive_make_invoice.py index 80f4532f..cfbc5765 100644 --- a/public_budget/wizards/transaction_definitive_make_invoice.py +++ b/public_budget/wizards/transaction_definitive_make_invoice.py @@ -23,16 +23,15 @@ class PublicBudgetDefinitiveMakeInvoice(models.TransientModel): supplier_id = fields.Many2one( 'res.partner', string='Supplier', - compute="_compute_supplier_id", readonly=False, required=True, + default=lambda self: self.env['res.partner'], domain=[('supplier_rank', '>', 0)], ) line_ids = fields.One2many( 'public_budget.definitive.make.invoice.detail', 'definitive_make_invoice_id', string='Lines', - compute="_compute_lines", readonly=False, ) journal_id = fields.Many2one( @@ -129,13 +128,11 @@ def _compute_available_journal_document_types(self): rec.available_journal_document_type_ids = move.l10n_latam_available_document_type_ids rec.journal_document_type_id = move.l10n_latam_document_type_id - @api.depends('supplier_ids') - def _compute_supplier_id(self): + @api.onchange('supplier_ids') + def _onchange_supplier_id(self): for rec in self: if not rec.supplier_id and len(rec.supplier_ids) == 1: rec.supplier_id = rec.supplier_ids.id - else: - rec.supplier_id=False @api.depends('transaction_id') def _compute_supplier_ids(self): @@ -150,7 +147,7 @@ def _compute_supplier_ids(self): rec.supplier_ids = suppliers # definitive_lines.env.all.mode = env_all_mode - @api.depends('supplier_id') + @api.onchange('supplier_id') def _compute_lines(self): for rec in self: rec.line_ids = self.env[ @@ -160,7 +157,7 @@ def _compute_lines(self): definitive_lines = rec.env[ 'public_budget.definitive_line'].search([ ('transaction_id', '=', transaction_id), - ('supplier_id', '=', rec.supplier_id._origin.id), + ('supplier_id', '=', rec.supplier_id.id), ('residual_amount', '!=', 0.0), ]) lines = []