[FIX] account: account domain in reconciliation

In the reconciliation widget, create a counterpart line. No domain is
applied on the "Account" field regarding the company, meaning that we
can select an account from any company.

opw-694149
This commit is contained in:
Nicolas Martinelli
2017-08-24 14:43:04 +02:00
parent 11c523f693
commit dedff1842b
2 changed files with 7 additions and 3 deletions
@@ -264,11 +264,11 @@ class account_journal(models.Model):
return {
'type': 'ir.actions.client',
'tag': 'bank_statement_reconciliation_view',
'context': {'statement_ids': bank_stmt.ids},
'context': {'statement_ids': bank_stmt.ids, 'company_ids': self.mapped('company_id').ids},
}
else:
# Open reconciliation view for customers/suppliers
action_context = {'show_mode_selector': False}
action_context = {'show_mode_selector': False, 'company_ids': self.mapped('company_id').ids}
if self.type == 'sale':
action_context.update({'mode': 'customers'})
elif self.type == 'purchase':
@@ -91,6 +91,10 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, {
// NB : for presets to work correctly, a field id must be the same string as a preset field
this.presets = {};
// Description of the fields to initialize in the "create new line" form
var domain_account_id = [['deprecated', '=', false]];
if (context && context.context && context.context.company_ids) {
domain_account_id.push(['company_id', 'in', context.context.company_ids]);
}
this.create_form_fields = {
account_id: {
id: "account_id",
@@ -103,7 +107,7 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, {
relation: "account.account",
string: _t("Account"),
type: "many2one",
domain: [['deprecated', '=', false]],
domain: domain_account_id,
},
},
label: {