[FIX] l10n_fr_pos_cert: fpos settings
The computation of hash integrity depends on the field `tax_ids_after_fiscal_position`. However, this field is computed, but not stored. It means that if one modifies a fiscal position used in the POS, the computation of `tax_ids_after_fiscal_position` will change. Consequently, the hash computation of the order will be modified, and the hash integrity of the journal will be corrupted. We prevent the modification of the taxes implied in a fiscal position if any POS order use it. Closes #32665 opw-1969009 closes odoo/odoo#32701 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -66,6 +66,11 @@ msgstr ""
|
||||
msgid "Corrupted data on point of sale order with id %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_fr_pos_cert
|
||||
#: model:ir.model,name:l10n_fr_pos_cert.model_account_fiscal_position
|
||||
msgid "Fiscal Position"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_fr_pos_cert
|
||||
#: model:ir.ui.menu,name:l10n_fr_pos_cert.pos_fr_statements_menu
|
||||
msgid "French Statements"
|
||||
@@ -137,7 +142,13 @@ msgid "This session has been opened another day. To comply with the French law,
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_fr_pos_cert
|
||||
#: code:addons/l10n_fr_pos_cert/models/account_bank_statement.py:11
|
||||
#: code:addons/l10n_fr_pos_cert/models/account_fiscal_position.py:14
|
||||
#, python-format
|
||||
msgid "You cannot modify a fiscal position used in a POS order. You should archive it and create a new one."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_fr_pos_cert
|
||||
#: code:addons/l10n_fr_pos_cert/models/account_bank_statement.py:12
|
||||
#, python-format
|
||||
msgid "You cannot modify anything on a bank statement (name: %s) that was created by point of sale operations."
|
||||
msgstr ""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import account_bank_statement
|
||||
from . import account_fiscal_position
|
||||
import res_company
|
||||
import pos
|
||||
import pos
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountFiscalPosition(models.Model):
|
||||
_inherit = "account.fiscal.position"
|
||||
|
||||
def write(self, vals):
|
||||
if "tax_ids" in vals:
|
||||
if self.env["pos.order"].sudo().search_count([("fiscal_position_id", "in", self.ids)]):
|
||||
raise UserError(
|
||||
_(
|
||||
"You cannot modify a fiscal position used in a POS order. "
|
||||
+ "You should archive it and create a new one."
|
||||
)
|
||||
)
|
||||
return super(AccountFiscalPosition, self).write(vals)
|
||||
Reference in New Issue
Block a user