mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-27 11:22:01 +02:00
19.0 vanilla
This commit is contained in:
parent
ff721d030e
commit
7721452493
1826 changed files with 124775 additions and 274114 deletions
|
|
@ -0,0 +1,19 @@
|
|||
from odoo import models, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountAccount(models.Model):
|
||||
_inherit = 'account.account'
|
||||
|
||||
def write(self, vals):
|
||||
if (
|
||||
'code' in vals
|
||||
and self.env.company.account_fiscal_country_id.code == 'DE'
|
||||
and any(
|
||||
self.env.company in a.company_ids and a.code != vals['code']
|
||||
for a in self
|
||||
)
|
||||
):
|
||||
if self.env['account.move.line'].search_count([('account_id', 'in', self.ids)], limit=1):
|
||||
raise UserError(_("You can not change the code of an account."))
|
||||
return super().write(vals)
|
||||
Loading…
Add table
Add a link
Reference in a new issue