| 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 |
|
| 9 |
super()._compute_account_id() |
| 10 |
|
| 11 |
for line in self.filtered(lambda l: l.company_id.country_code == 'TR' |
| 12 |
and l.move_id.move_type == 'out_refund' |
| 13 |
and l.display_type == 'product' |
| 14 |
): |
| 15 |
if (product := line.product_id) and product.with_company(line.company_id).l10n_tr_default_sales_return_account_id: |
| 16 |
line.account_id = product.with_company(line.company_id).l10n_tr_default_sales_return_account_id |
| 17 |
elif (journal := line.move_id.journal_id) and journal.l10n_tr_default_sales_return_account_id: |
| 18 |
line.account_id = journal.l10n_tr_default_sales_return_account_id |