| 1 |
# -*- coding: utf-8 -*- |
| 2 |
|
| 3 |
from odoo import _, models |
| 4 |
from odoo.exceptions import UserError |
| 5 |
|
| 6 |
|
| 7 |
class AccountFiscalPosition(models.Model): |
| 8 |
_inherit = "account.fiscal.position" |
| 9 |
|
| 10 |
def write(self, vals): |
| 11 |
if "tax_ids" in vals: |
| 12 |
if self.env["pos.order"].sudo().search_count([("fiscal_position_id", "in", self.ids)]): |
| 13 |
raise UserError( |
| 14 |
_( |
| 15 |
"You cannot modify a fiscal position used in a POS order. " |
| 16 |
"You should archive it and create a new one." |
| 17 |
) |
| 18 |
) |
| 19 |
return super(AccountFiscalPosition, self).write(vals) |