summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2016-04-11 13:39:22 +0200
committerGoffin Simon <sig@odoo.com>2016-04-12 10:54:37 +0200
commitafba8cec23bd5f803d26c196beeb73467c7743aa (patch)
treef73305141ee2820fb462d9b95941dffbedc61ed4
parent0dbdbf136e1a1fb4e626a82a15363f3487bedd97 (diff)
[FIX] account: partner_id field in account.move
From 94ed4ce8c8354b432d9d5c90c2f4631347fb4398 The original issue is the following: - Go to the journal item creation - Choose a partner - Add a line => the partner on the journal item is removed This is because `partner_id` on the account move is a related to `partner_id` on the account move lines. This is likely to cause errors during the manual encoding of a journal item, since the relation will link the partner of the account move to the partner of the first account move line only. opw:672354
-rw-r--r--addons/account/models/account_move.py2
-rw-r--r--addons/account/views/account_view.xml1
2 files changed, 2 insertions, 1 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index fcc0460691a..042264b5959 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -85,7 +85,7 @@ class AccountMove(models.Model):
'in \'Posted\' status.')
line_ids = fields.One2many('account.move.line', 'move_id', string='Journal Items',
states={'posted': [('readonly', True)]}, copy=True)
- partner_id = fields.Many2one('res.partner', related='line_ids.partner_id', string="Partner", store=True, states={'posted': [('readonly', True)]})
+ partner_id = fields.Many2one('res.partner', related='line_ids.partner_id', string="Partner", store=True, readonly=True)
amount = fields.Monetary(compute='_amount_compute', store=True)
narration = fields.Text(string='Internal Note')
company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', store=True, readonly=True,
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index 1f681256ef2..4c3ef0eb1c5 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -1262,6 +1262,7 @@
<field name="line_ids" widget="one2many_list"
context="{'line_ids': line_ids, 'journal_id': journal_id }">
<tree editable="bottom" string="Journal Items">
+ <field name="partner_id" domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]"/>
<field name="account_id" domain="[('company_id', '=', parent.company_id), ('deprecated', '=', False)]"/>
<field name="name"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('account_type', '=', 'normal')]"/>