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
=== modified file 'account/account.py'
--- account/account.py 2013-03-01 09:01:02 +0000
+++ account/account.py 2013-03-12 20:12:26 +0000
@@ -1262,6 +1262,13 @@
1262 if ids:1262 if ids:
1263 return [('id', 'in', tuple(ids))]1263 return [('id', 'in', tuple(ids))]
1264 return [('id', '=', '0')]1264 return [('id', '=', '0')]
1265
1266 def _get_line_move(self, cr, uid, ids, context=None):
1267 move_ids = set()
1268 line_obj = self.pool.get('account.move.line')
1269 for line in line_obj.browse(cr, uid, ids, context):
1270 move_ids.add(line.move_id.id)
1271 return list(move_ids)
12651272
1266 _columns = {1273 _columns = {
1267 'name': fields.char('Number', size=64, required=True),1274 'name': fields.char('Number', size=64, required=True),
@@ -1272,7 +1279,8 @@
1272 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.'),1279 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.'),
1273 'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),1280 'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
1274 '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.'),1281 '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.'),
1275 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True),1282 'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner",
1283 store={ 'account.move.line': (_get_line_move, ['partner_id'], 10) }),
1276 'amount': fields.function(_amount_compute, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),1284 'amount': fields.function(_amount_compute, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),
1277 'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}, select=True),1285 'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}, select=True),
1278 'narration':fields.text('Internal Note'),1286 'narration':fields.text('Internal Note'),