Merge lp:~serpent-consulting-services/openobject-addons/7.0-sale_margin-1090931 into lp:openobject-addons

Proposed by Serpent Consulting Services
Status: Merged
Merged at revision: 8400
Proposed branch: lp:~serpent-consulting-services/openobject-addons/7.0-sale_margin-1090931
Merge into: lp:openobject-addons
Diff against target: 22 lines (+5/-2)
1 file modified
sale_margin/sale_margin.py (+5/-2)
To merge this branch: bzr merge lp:~serpent-consulting-services/openobject-addons/7.0-sale_margin-1090931
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Approve
Review via email: mp+140106@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Indeed, functions that are passed as arguments to stored triggers are plain functions and cannot use the inheritance system. It is possibly to do it by having a simple lambda function that calls self._the_real_method, when inheriting it is really necessary. In that case only the trivial lambda needs to be repeated, and the original method can be overridden.

Let's keep it simple here, your patch does the job :-)

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'sale_margin/sale_margin.py'
2--- sale_margin/sale_margin.py 2012-11-29 22:26:45 +0000
3+++ sale_margin/sale_margin.py 2012-12-16 18:41:23 +0000
4@@ -70,7 +70,10 @@
5 return result
6
7 def _get_order(self, cr, uid, ids, context=None):
8- return super(sale_order, self)._get_order(cr, uid, ids, context=context)
9+ result = {}
10+ for line in self.pool.get('sale.order.line').browse(cr, uid, ids, context=context):
11+ result[line.order_id.id] = True
12+ return result.keys()
13
14 _columns = {
15 'margin': fields.function(_product_margin, string='Margin', help="It gives profitability by calculating the difference between the Unit Price and the cost price.", store={
16@@ -81,4 +84,4 @@
17
18 sale_order()
19
20-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
21+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
22\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: