[FIX] account/purchase: onchange on purchase create bill does not work

closes odoo/odoo#64777

X-original-commit: 0f36bbd257ba5e8e03462f675d81fdbdece1893a
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
This commit is contained in:
Wolfgang Taferner
2021-01-20 08:42:21 +00:00
committed by Laurent Smet
parent 34c3498981
commit 03f14189cb
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -943,7 +943,8 @@ class AccountMove(models.Model):
# Recompute amls: update existing line or create new one for each payment term.
new_terms_lines = self.env['account.move.line']
for date_maturity, balance, amount_currency in to_compute:
if self.journal_id.company_id.currency_id.is_zero(balance) and len(to_compute) > 1:
currency = self.journal_id.company_id.currency_id
if currency and currency.is_zero(balance) and len(to_compute) > 1:
continue
if existing_terms_lines_index < len(existing_terms_lines):
+1 -1
View File
@@ -15,7 +15,7 @@ class AccountMove(models.Model):
states={'draft': [('readonly', False)]},
string='Purchase Order',
help="Auto-complete from a past purchase order.")
def _get_invoice_reference(self):
self.ensure_one()
vendor_refs = [ref for ref in set(self.line_ids.mapped('purchase_line_id.order_id.partner_ref')) if ref]