Odoo18-Base/addons/l10n_in/models/account_move_line.py
2025-01-06 10:57:38 +07:00

14 lines
533 B
Python

from odoo import api, fields, models
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
l10n_in_hsn_code = fields.Char(string="HSN/SAC Code", compute="_compute_l10n_in_hsn_code", store=True, readonly=False, copy=False)
@api.depends('product_id', 'product_id.l10n_in_hsn_code')
def _compute_l10n_in_hsn_code(self):
for line in self:
if line.move_id.country_code == 'IN' and line.parent_state == 'draft':
line.l10n_in_hsn_code = line.product_id.l10n_in_hsn_code