[FIX] l10n_se_ocr, account : renamed old reference to invoice_payment_ref to payment_reference

closes odoo/odoo#54735

X-original-commit: a44db615d1fa6443810e88cc55471aff110c1393
Signed-off-by: bfr-o <bfr-o@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
Benjamin Frantzen (bfr)
2020-07-22 06:37:26 +00:00
parent 6827951451
commit f81c83153e
2 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -36,9 +36,9 @@
This invoice is already paid.
% else:
Please remit payment at your earliest convenience.
% if object.invoice_payment_ref:
% if object.payment_reference:
<br /><br />
Please use the following communication for your payment: <strong>${object.invoice_payment_ref}</strong>.
Please use the following communication for your payment: <strong>${object.payment_reference}</strong>.
% endif
% endif
<br /><br />
+5 -5
View File
@@ -58,16 +58,16 @@ class AccountMove(models.Model):
def _onchange_partner_id(self):
""" If Vendor Bill and Vendor OCR is set, add it. """
if self.partner_id and self.move_type == 'in_invoice' and self.partner_id.l10n_se_default_vendor_payment_ref:
self.invoice_payment_ref = self.partner_id.l10n_se_default_vendor_payment_ref
self.payment_reference = self.partner_id.l10n_se_default_vendor_payment_ref
return super(AccountMove, self)._onchange_partner_id()
@api.onchange('invoice_payment_ref')
def _onchange_invoice_payment_ref(self):
@api.onchange('payment_reference')
def _onchange_payment_reference(self):
""" If Vendor Bill and Payment Reference is changed check validation. """
if self.partner_id and self.move_type == 'in_invoice' and self.partner_id.l10n_se_check_vendor_ocr:
reference = self.invoice_payment_ref
reference = self.payment_reference
try:
luhn.validate(reference)
except:
return {'warning': {'title': _('Warning'), 'message': _('Vendor require OCR Number as payment reference. Payment reference isn\'t a valid OCR Number.')}}
return super(AccountMove, self)._onchange_invoice_payment_ref()
return super(AccountMove, self)._onchange_payment_reference()