Merge lp:~zaber/openobject-addons/account-move-partner into lp:openobject-addons/6.1

Proposed by Don Kirkby
Status: Needs review
Proposed branch: lp:~zaber/openobject-addons/account-move-partner
Merge into: lp:openobject-addons/6.1
Diff against target: 27 lines (+9/-1)
1 file modified
account/account.py (+9/-1)
To merge this branch: bzr merge lp:~zaber/openobject-addons/account-move-partner
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+153006@code.launchpad.net

Description of the change

Bug fix to make searching journal entries by partner work.

To post a comment you must log in.

Unmerged revisions

7184. By Don Kirkby

[FIX] Update account_move.partner_id field to match lines so that searching by partner will work.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account.py'
2--- account/account.py 2013-03-01 09:01:02 +0000
3+++ account/account.py 2013-03-12 20:12:26 +0000
4@@ -1262,6 +1262,13 @@
5 if ids:
6 return [('id', 'in', tuple(ids))]
7 return [('id', '=', '0')]
8+
9+ def _get_line_move(self, cr, uid, ids, context=None):
10+ move_ids = set()
11+ line_obj = self.pool.get('account.move.line')
12+ for line in line_obj.browse(cr, uid, ids, context):
13+ move_ids.add(line.move_id.id)
14+ return list(move_ids)
15
16 _columns = {
17 'name': fields.char('Number', size=64, required=True),
18@@ -1272,7 +1279,8 @@
19 help='All manually created new journal entries are usually in the state \'Unposted\', but you can set the option to skip that state on the related journal. In that case, they will be behave as journal entries automatically created by the system on document validation (invoices, bank statements...) and will be created in \'Posted\' state.'),
20 'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
21 'to_check': fields.boolean('To Review', help='Check this box if you are unsure of that journal entry and if you want to note it as \'to be reviewed\' by an accounting expert.'),
22- 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True),
23+ 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner",
24+ store={ 'account.move.line': (_get_line_move, ['partner_id'], 10) }),
25 'amount': fields.function(_amount_compute, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),
26 'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}, select=True),
27 'narration':fields.text('Internal Note'),