mirror of
https://github.com/bringout/oca-ocb-l10n_americas.git
synced 2026-04-27 15:52:05 +02:00
19.0 vanilla
This commit is contained in:
parent
89c6e82fe7
commit
1b82c20a58
572 changed files with 43570 additions and 53303 deletions
|
|
@ -1,9 +1,9 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import fields, models, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class ResCompany(models.Model):
|
||||
|
||||
_inherit = "res.company"
|
||||
|
||||
l10n_ar_gross_income_number = fields.Char(
|
||||
|
|
@ -33,12 +33,15 @@ class ResCompany(models.Model):
|
|||
def _localization_use_documents(self):
|
||||
""" Argentinean localization use documents """
|
||||
self.ensure_one()
|
||||
return self.account_fiscal_country_id.code == "AR" or super()._localization_use_documents()
|
||||
return self.chart_template in {'ar_base', 'ar_ex', 'ar_ri'} or self.account_fiscal_country_id.code == "AR" or super()._localization_use_documents()
|
||||
|
||||
@api.constrains('l10n_ar_afip_responsibility_type_id')
|
||||
def _check_accounting_info(self):
|
||||
""" Do not let to change the AFIP Responsibility of the company if there is already installed a chart of
|
||||
account and if there has accounting entries """
|
||||
if self.env['account.chart.template'].existing_accounting(self):
|
||||
raise ValidationError(_(
|
||||
'Could not change the AFIP Responsibility of this company because there are already accounting entries.'))
|
||||
def write(self, vals):
|
||||
if 'l10n_ar_afip_responsibility_type_id' in vals:
|
||||
for company in self:
|
||||
if vals['l10n_ar_afip_responsibility_type_id'] != company.l10n_ar_afip_responsibility_type_id.id and company.sudo()._existing_accounting():
|
||||
raise UserError(_('Could not change the ARCA Responsibility of this company because there are already accounting entries.'))
|
||||
|
||||
return super().write(vals)
|
||||
|
||||
def _is_latam(self):
|
||||
return super()._is_latam() or self.country_code == 'AR'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue