[FIX] account_financial_report: multicompany+layout behaviour (#498)
* Fix wizards for proper multicompany behaviour. * Fix layout issue
This commit is contained in:
committed by
chaule97
parent
5b14306779
commit
2abb852345
@@ -17,7 +17,7 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company',
|
||||
default=lambda self: self.env.user.company_id,
|
||||
required=True,
|
||||
required=False,
|
||||
string='Company'
|
||||
)
|
||||
date_at = fields.Date(required=True,
|
||||
@@ -60,8 +60,22 @@ class OpenItemsReportWizard(models.TransientModel):
|
||||
lambda p: p.company_id == self.company_id or
|
||||
not p.company_id)
|
||||
if self.company_id and self.account_ids:
|
||||
self.account_ids = self.account_ids.filtered(
|
||||
lambda a: a.company_id == self.company_id)
|
||||
if self.receivable_accounts_only or self.payable_accounts_only:
|
||||
self.onchange_type_accounts_only()
|
||||
else:
|
||||
self.account_ids = self.account_ids.filtered(
|
||||
lambda a: a.company_id == self.company_id)
|
||||
res = {'domain': {'account_ids': [],
|
||||
'partner_ids': []}}
|
||||
if not self.company_id:
|
||||
return res
|
||||
else:
|
||||
res['domain']['account_ids'] += [
|
||||
('company_id', '=', self.company_id.id)]
|
||||
res['domain']['partner_ids'] += [
|
||||
'|', ('company_id', '=', self.company_id.id),
|
||||
('company_id', '=', False)]
|
||||
return res
|
||||
|
||||
@api.onchange('receivable_accounts_only', 'payable_accounts_only')
|
||||
def onchange_type_accounts_only(self):
|
||||
|
||||
Reference in New Issue
Block a user