summaryrefslogtreecommitdiff
path: root/addons/l10n_ar/models
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2019-11-26 07:56:07 +0000
committerXavier Morel <xmo@odoo.com>2019-11-27 10:00:31 +0000
commit1881999b893ef3003367c2db2fcffb9d6390597b (patch)
tree98f157663fc7b0731f26f32664dc0df7e46db575 /addons/l10n_ar/models
parent7ae118a20b4f36be563741599ec4aef90cfb74cb (diff)
[REM] l10n_ar: dynamic domain
closes odoo/odoo#40954 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Diffstat (limited to 'addons/l10n_ar/models')
-rw-r--r--addons/l10n_ar/models/account_journal.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/addons/l10n_ar/models/account_journal.py b/addons/l10n_ar/models/account_journal.py
index ce26069294b..fb7e5659ea9 100644
--- a/addons/l10n_ar/models/account_journal.py
+++ b/addons/l10n_ar/models/account_journal.py
@@ -12,8 +12,11 @@ class AccountJournal(models.Model):
selection='_get_l10n_ar_afip_pos_types_selection', string='AFIP POS System')
l10n_ar_afip_pos_number = fields.Integer(
'AFIP POS Number', help='This is the point of sale number assigned by AFIP in order to generate invoices')
+ company_partner = fields.Many2one('res.partner', related='company_id.partner_id')
l10n_ar_afip_pos_partner_id = fields.Many2one(
- 'res.partner', 'AFIP POS Address', help='This is the address used for invoice reports of this POS')
+ 'res.partner', 'AFIP POS Address', help='This is the address used for invoice reports of this POS',
+ domain="['|', ('id', '=', company_partner), '&', ('id', 'child_of', company_partner), ('type', '!=', 'contact')]"
+ )
l10n_ar_sequence_ids = fields.One2many('ir.sequence', 'l10n_latam_journal_id', string="Sequences")
l10n_ar_share_sequences = fields.Boolean(
'Unified Book', help='Use same sequence for documents with the same letter')
@@ -175,13 +178,6 @@ class AccountJournal(models.Model):
""" On 'Pre-printed Invoice' the usual is to share sequences. On other types, do not share """
self.l10n_ar_share_sequences = bool(self.l10n_ar_afip_pos_system == 'II_IM')
- @api.onchange('company_id')
- def _onchange_company_set_domain(self):
- """ Will define the AFIP POS Address field domain taking into account the company configured in the journal """
- company_partner = self.company_id.partner_id.id
- return {'domain': {'l10n_ar_afip_pos_partner_id': [
- '|', ('id', '=', company_partner), '&', ('id', 'child_of', company_partner), ('type', '!=', 'contact')]}}
-
@api.onchange('l10n_ar_afip_pos_number', 'type')
def _onchange_set_short_name(self):
""" Will define the AFIP POS Address field domain taking into account the company configured in the journal