Merge lp:~florian-dacosta/ocb-addons/6.1_purchase_line_partner_fix into lp:ocb-addons/6.1

Proposed by Florian da Costa on 2013-09-12
Status: Work in progress
Proposed branch: lp:~florian-dacosta/ocb-addons/6.1_purchase_line_partner_fix
Merge into: lp:ocb-addons/6.1
Diff against target: 28 lines (+10/-1)
1 file modified
purchase/ (+10/-1)
To merge this branch: bzr merge lp:~florian-dacosta/ocb-addons/6.1_purchase_line_partner_fix
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp Needs Fixing on 2013-11-11
Holger Brunn (Therp) code review 2013-09-12 Needs Fixing on 2013-10-14
Review via email:
To post a comment you must log in.
Holger Brunn (Therp) (hbrunn) wrote :

Please make _update_partner_from_purchase being able to cope with multiple ids (it only returns the last PO's order lines), something like

res += purchase['order_line']

in #12

review: Needs Fixing (code review)

Same comments than: :

l.11 The context must be propagated in the read.
l.24 No mutable in keyword argument: replace "c={}" by "c=None".

l.23-24 Indentation is dubious, see

review: Needs Fixing

Setting to WIP after 3 months of inactivity.

Unmerged revisions

6788. By Florian da Costa on 2013-09-12

[FIX] Add function to recalculate the related field partner_id of purchase_order_line because it would not update when the purchase order's partner_id is updated

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'purchase/'
2--- purchase/ 2012-10-26 15:32:12 +0000
3+++ purchase/ 2013-09-12 17:51:15 +0000
4@@ -655,6 +655,13 @@
5 except Exception, ex:
6 return False
8+ def _update_partner_from_purchase(self, cr, uid, ids, context=None):
9+ res = []
10+ obj_purchase = self.pool.get('purchase.order')
11+ for purchase in, uid, ids, ['order_line']):
12+ res = purchase['order_line']
13+ return res
15 _columns = {
16 'name': fields.char('Description', size=256, required=True),
17 'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True),
18@@ -677,7 +684,9 @@
19 \n* The \'Cancelled\' state is set automatically when user cancel purchase order.'),
20 'invoice_lines': fields.many2many('account.invoice.line', 'purchase_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
21 'invoiced': fields.boolean('Invoiced', readonly=True),
22- 'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner", store=True),
23+ 'partner_id': fields.related('order_id','partner_id',string='Partner',readonly=True,type="many2one", relation="res.partner",
24+ store = {'purchase.order.line': (lambda self, cr, uid, ids, c={}: ids, [], 10),
25+ 'purchase.order': (_update_partner_from_purchase, ['partner_id'], 10)}),
26 'date_order': fields.related('order_id','date_order',string='Order Date',readonly=True,type="date")
28 }


People subscribed via source and target branches