| 1 | from odoo import models |
| 2 | |
| 3 | |
| 4 | class AccountMoveLine(models.Model): |
| 5 | _inherit = 'account.move.line' |
| 6 | |
| 7 | def _compute_account_id(self): |
| 8 | # EXTENDS 'account' |
| 9 | super()._compute_account_id() |
| 10 | for line in self: |
| 11 | if ( |
| 12 | line.move_id.country_code == 'MX' |
| 13 | and line.move_id.move_type == 'out_refund' |
| 14 | and line.display_type == 'product' |
| 15 | and line.company_id.l10n_mx_income_return_discount_account_id |
| 16 | ): |
| 17 | line.account_id = line.company_id.l10n_mx_income_return_discount_account_id |