Skip to content

Commit

Permalink
[FIX] public_budget: crear comprobante desde transacción
Browse files Browse the repository at this point in the history
closes #497

Ticket: 64385
Signed-off-by: Katherine Zaoral <kz@adhoc.com.ar>
  • Loading branch information
pablohmontenegro committed Aug 10, 2023
1 parent 51c840f commit a50933e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 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',
Expand Down
13 changes: 5 additions & 8 deletions public_budget/wizards/transaction_definitive_make_invoice.py
Expand Up @@ -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(
Expand Down Expand Up @@ -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):
Expand All @@ -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[
Expand All @@ -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 = []
Expand Down

0 comments on commit a50933e

Please sign in to comment.