[FIX] account : remove QR code generation for credit note
To Reproduce ============ - enable QR code on Accounting settings - with a customer who has a bank account create a credit note for him/her - in other info tab, make sure that the qr code method is empty - send or print the credit note The Problem =========== the qr code method field will be filled with SEPA, and a QR code will be added to the PDF Solution ======== Generating a QR code for a credit note doesn't make any sense, so the qr code method field must be hidden and no QR code should be generated. opw-3010649 closes odoo/odoo#105385 X-original-commit: 4b0c37833547ff45d2240e51272372a572a920d5 Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -335,7 +335,7 @@ class AccountMove(models.Model):
|
||||
)
|
||||
display_qr_code = fields.Boolean(
|
||||
string="Display QR-code",
|
||||
related='company_id.qr_code',
|
||||
compute='_compute_display_qr_code',
|
||||
)
|
||||
qr_code_method = fields.Selection(
|
||||
string="Payment QR-code", copy=False,
|
||||
@@ -1467,6 +1467,14 @@ class AccountMove(models.Model):
|
||||
for res in self.env.cr.dictfetchall()
|
||||
}
|
||||
|
||||
@api.depends('company_id')
|
||||
def _compute_display_qr_code(self):
|
||||
for record in self:
|
||||
record.display_qr_code = (
|
||||
record.move_type in ('out_invoice', 'out_receipt')
|
||||
and record.company_id.qr_code
|
||||
)
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# INVERSE METHODS
|
||||
# -------------------------------------------------------------------------
|
||||
@@ -3788,8 +3796,8 @@ class AccountMove(models.Model):
|
||||
"""
|
||||
self.ensure_one()
|
||||
|
||||
if not self.is_invoice():
|
||||
raise UserError(_("QR-codes can only be generated for invoice entries."))
|
||||
if not self.display_qr_code:
|
||||
return None
|
||||
|
||||
qr_code_method = self.qr_code_method
|
||||
if qr_code_method:
|
||||
|
||||
Reference in New Issue
Block a user