Odoo18-Base/addons/l10n_in_pos/models/account_move.py
2025-03-10 10:52:11 +07:00

17 lines
675 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class AccountMove(models.Model):
_inherit = 'account.move'
l10n_in_pos_session_ids = fields.One2many("pos.session", "move_id", "POS Sessions")
@api.depends('l10n_in_pos_session_ids')
def _compute_l10n_in_state_id(self):
res = super()._compute_l10n_in_state_id()
to_compute = self.filtered(lambda m: m.country_code == 'IN' and not m.l10n_in_state_id and m.journal_id.type == 'general' and m.l10n_in_pos_session_ids)
for move in to_compute:
move.l10n_in_state_id = move.company_id.state_id
return res