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/127/head
Gustavo Orozco H 7 years ago
committed by Dave Lasley
parent
commit
ed75c2d666
  1. 7
      contract/models/account_analytic_contract.py
  2. 1
      contract/views/account_analytic_contract_view.xml

7
contract/models/account_analytic_contract.py

@ -60,6 +60,12 @@ class AccountAnalyticContract(models.Model):
default=lambda s: s._default_journal(), default=lambda s: s._default_journal(),
domain="[('type', '=', 'sale'),('company_id', '=', company_id)]", 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 @api.model
def _default_journal(self): def _default_journal(self):
@ -69,3 +75,4 @@ class AccountAnalyticContract(models.Model):
('type', '=', 'sale'), ('type', '=', 'sale'),
('company_id', '=', company_id)] ('company_id', '=', company_id)]
return self.env['account.journal'].search(domain, limit=1) 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"> <field name="arch" type="xml">
<form string="Contract Template"> <form string="Contract Template">
<group name="group_main"> <group name="group_main">
<field name="company_id" invisible="1" />
<field name="name" /> <field name="name" />
<group name="group_main_left"> <group name="group_main_left">
<field name="journal_id" /> <field name="journal_id" />

Loading…
Cancel
Save