19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:31:28 +01:00
parent ff721d030e
commit 7721452493
1826 changed files with 124775 additions and 274114 deletions

View file

@ -10,10 +10,30 @@ import stdnum.exceptions
class ResCompany(models.Model):
_inherit = 'res.company'
l10n_de_stnr = fields.Char(string="St.-Nr.", help="Steuernummer. Scheme: ??FF0BBBUUUUP, e.g.: 2893081508152 https://de.wikipedia.org/wiki/Steuernummer")
l10n_de_widnr = fields.Char(string="W-IdNr.", help="Wirtschafts-Identifikationsnummer.")
l10n_de_stnr = fields.Char(
string="St.-Nr.",
help="Tax number. Scheme: ??FF0BBBUUUUP, e.g.: 2893081508152 https://de.wikipedia.org/wiki/Steuernummer",
tracking=True,
)
l10n_de_widnr = fields.Char(string="W-IdNr.", help="Business identification number.", tracking=True)
def write(self, vals):
if (
'account_fiscal_country_id' in vals
and (german_companies := self.filtered(lambda c: c.account_fiscal_country_id.code == 'DE'))
and self.env['res.country'].browse(vals['account_fiscal_country_id']).code != 'DE'
and self.env['account.move'].search_count([('company_id', 'in', german_companies.ids)], limit=1)
):
raise ValidationError(_("You cannot change the fiscal country."))
return super().write(vals)
@api.depends('country_code')
def _compute_force_restrictive_audit_trail(self):
super()._compute_force_restrictive_audit_trail()
for company in self:
company.force_restrictive_audit_trail |= company.country_code == 'DE'
@api.constrains('state_id', 'l10n_de_stnr')
def _validate_l10n_de_stnr(self):
for record in self: