From ed75c2d666930b1809e57fd55bca6be9538fac89 Mon Sep 17 00:00:00 2001 From: Gustavo Orozco H Date: Sun, 19 Nov 2017 18:58:20 -0500 Subject: [PATCH] [10.0][FIX] Correct domain attribute in field journal_id (#120) * Correct domain attribute in field journal_id Original domain includes unknown value company_id. Throws error when selecting the journal. * Corregidos errores detectados por Lint * Refactoring, DRY * [FIX] Add missing field company_id to account_analytic_contract * Small refactoring for company_id field --- contract/models/account_analytic_contract.py | 7 +++++++ contract/views/account_analytic_contract_view.xml | 1 + 2 files changed, 8 insertions(+) diff --git a/contract/models/account_analytic_contract.py b/contract/models/account_analytic_contract.py index 5749f650..295fe406 100644 --- a/contract/models/account_analytic_contract.py +++ b/contract/models/account_analytic_contract.py @@ -60,6 +60,12 @@ class AccountAnalyticContract(models.Model): default=lambda s: s._default_journal(), domain="[('type', '=', 'sale'),('company_id', '=', company_id)]", ) + company_id = fields.Many2one( + 'res.company', + string='Company', + required=True, + default=lambda self: self.env.user.company_id, + ) @api.model def _default_journal(self): @@ -69,3 +75,4 @@ class AccountAnalyticContract(models.Model): ('type', '=', 'sale'), ('company_id', '=', company_id)] return self.env['account.journal'].search(domain, limit=1) + diff --git a/contract/views/account_analytic_contract_view.xml b/contract/views/account_analytic_contract_view.xml index 23edd517..00da85fe 100644 --- a/contract/views/account_analytic_contract_view.xml +++ b/contract/views/account_analytic_contract_view.xml @@ -7,6 +7,7 @@
+