Browse Source

[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
pull/202/head
Gustavo Orozco H 7 years ago
committed by Pedro M. Baeza
parent
commit
fc66a6379a
  1. 7
      contract/models/account_analytic_contract.py
  2. 1
      contract/views/account_analytic_contract_view.xml

7
contract/models/account_analytic_contract.py

@ -59,6 +59,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):
@ -68,3 +74,4 @@ class AccountAnalyticContract(models.Model):
('type', '=', 'sale'),
('company_id', '=', company_id)]
return self.env['account.journal'].search(domain, limit=1)

1
contract/views/account_analytic_contract_view.xml

@ -7,6 +7,7 @@
<field name="arch" type="xml">
<form string="Contract Template">
<group name="group_main">
<field name="company_id" invisible="1" />
<field name="name" />
<group name="group_main_left">
<field name="journal_id" />

Loading…
Cancel
Save