Xavier ALT (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-579210-xal into
lp:openobject-addons/6.1.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579210-xal/+merge/126273
Hi,
This fix incompatibilities between sale_margin and sale_layout when both are
installed, listed below:
- "cost price" (sale_margin's purchase_price) field not visible anymore on
sale.order lines
- sale.order's "margin" field are not update anymore
This merge fixes this by:
- increasing sale_margin views priority so inheritancy are always applied after
sale_layout and use condition xpath expression to update order_line (sale) or
abstract_line_ids (sale_layout) so "cost price" are correctly inserted. (we
could not afford adding a glue module for that on stable)
- forcing update of sale.order's "margin" field whenever a sale.order.line is
changed - line's "margin" are updated anyway on every write because of
store=True, so this doesn't change the standard behaviour.
Cheers,
Xavier
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-579210-xal/+merge/126273
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-579210-xal.
=== modified file 'sale_margin/sale_margin.py'
--- sale_margin/sale_margin.py 2012-09-14 16:14:29 +0000
+++ sale_margin/sale_margin.py 2012-09-25 15:37:39 +0000
@@ -75,7 +75,7 @@
_columns = {
'margin': fields.function(_product_margin, string='Margin', help="It gives profitability by calculating the difference between the Unit Price and Cost Price.", store={
- 'sale.order.line': (_get_order, ['margin'], 20),
+ 'sale.order.line': (_get_order, [], 20),
'sale.order': (lambda self, cr, uid, ids, c={}: ids, ['order_line'], 20),
}),
}
=== modified file 'sale_margin/sale_margin_view.xml'
--- sale_margin/sale_margin_view.xml 2011-11-11 08:28:08 +0000
+++ sale_margin/sale_margin_view.xml 2012-09-25 15:37:39 +0000
@@ -19,8 +19,9 @@
<field name="type">form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
+ <field name="priority">1100</field>
<field name="arch" type="xml">
- <xpath expr="//field[@name='order_line']/form//field[@name='price_unit']" position="after">
+ <xpath expr="//field[@name='order_line' or @name='abstract_line_ids']/form//field[@name='price_unit']" position="after">
<field name="purchase_price"/>
</xpath>
</field>
@@ -31,8 +32,9 @@
<field name="type">form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
+ <field name="priority">1100</field>
<field name="arch" type="xml">
- <xpath expr="//field[@name='order_line']/tree//field[@name='price_unit']" position="after">
+ <xpath expr="//field[@name='order_line' or @name='abstract_line_ids']/tree//field[@name='price_unit']" position="after">
<field name="purchase_price"/>
</xpath>
</field>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp