openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #05663
[Merge] lp:~camptocamp/sale-financial/7.0-port-sale_line_watcher into lp:sale-financial
Yannick Vaucher @ Camptocamp has proposed merging lp:~camptocamp/sale-financial/7.0-port-sale_line_watcher into lp:sale-financial.
Requested reviews:
Pedro Manuel Baeza (pedro.baeza): code review
For more details, see:
https://code.launchpad.net/~camptocamp/sale-financial/7.0-port-sale_line_watcher/+merge/214058
Portage of module sale_line_watcher to v7
--
https://code.launchpad.net/~camptocamp/sale-financial/7.0-port-sale_line_watcher/+merge/214058
Your team Sale Core Editors is subscribed to branch lp:sale-financial.
=== modified file 'sale_line_watcher/__openerp__.py'
--- sale_line_watcher/__openerp__.py 2013-11-14 08:16:22 +0000
+++ sale_line_watcher/__openerp__.py 2014-04-04 14:22:40 +0000
@@ -23,19 +23,37 @@
'author' : 'Camptocamp',
'maintainer': 'Camptocamp',
'category': 'Hidden',
- 'complexity': "normal", # easy, normal, expert
- 'depends' : ['base', 'sale'],
- 'description': """Add new base onchange methods on sale_order class
-
- onchange_price_unit and onchange_discount both accept the following arguments:
- (self, cr, uid, ids, price_unit, product_id, discount, product_uom, pricelist, **kwargs)
+ 'complexity': "normal",
+ 'depends' : ['base', 'sale', 'web_context_tunnel'],
+ 'description': """
+Sale order line watcher
+=======================
+
+Add new base onchange methods on Sale Order Line form.
+
+`onchange_price_unit` and `onchange_discount`
+
+Those onchanges can be extendend with additionnal contexts using
+`web_context_tunnel` module
+
+Dependencies
+------------
+
+`web_context_tunnel` module from lp:server-env-tools branch
+
+Contributors
+------------
+
+* Nicolas Bessi <nicolas.bessi@xxxxxxxxxxxxxx>
+* Yannick Vaucher <yannick.vaucher@xxxxxxxxxxxxxx>
+
""",
'website': 'http://www.camptocamp.com',
'init_xml': [],
'update_xml': ['sale_view.xml'],
'demo_xml': [],
'tests': [],
- 'installable': False,
+ 'installable': True,
'auto_install': False,
'license': 'AGPL-3',
'application': True}
=== modified file 'sale_line_watcher/sale_view.xml'
--- sale_line_watcher/sale_view.xml 2012-05-29 07:06:32 +0000
+++ sale_line_watcher/sale_view.xml 2014-04-04 14:22:40 +0000
@@ -3,27 +3,24 @@
<data>
<record model="ir.ui.view" id="sale_watcher_sale_order_line_form2">
<field name="name">sales_line_watcher.view.form2</field>
- <field name="type">form</field>
<field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_order_line_form2" />
<field name="arch" type="xml">
- <xpath expr="//field[@name='price_unit']" position="replace">
- <field name="price_unit"
- on_change="onchange_price_unit(price_unit ,product_id, discount, product_uom_qty, parent.pricelist_id)"
- select="2"/>
+ <xpath expr="//field[@name='price_unit']" position="attributes">
+ <attribute name="context">{}</attribute>
+ <attribute name="on_change">onchange_price_unit(context)</attribute>
</xpath>
</field>
</record>
<record model="ir.ui.view" id="sale_watcher_sale_order_line_form3">
<field name="name">sales_line_watcher.view.form3</field>
- <field name="type">form</field>
<field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_order_line_form2" />
<field name="arch" type="xml">
- <xpath expr="//field[@name='discount']" position="replace">
- <field name="discount"
- on_change="onchange_discount(price_unit, product_id, discount, product_uom_qty, parent.pricelist_id)"/>
+ <xpath expr="//field[@name='discount']" position="attributes">
+ <attribute name="context">{}</attribute>
+ <attribute name="on_change">onchange_discount(context)</attribute>
</xpath>
</field>
</record>
@@ -32,25 +29,22 @@
<field name="name">sales_line_watcher.form.floorprice</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
- <field name="type">form</field>
<field name="arch" type="xml">
- <field name="discount" position="replace">
- <field name="discount"
- on_change="onchange_discount(price_unit, product_id,discount, product_uom_qty, parent.pricelist_id)"/>
+ <field name="discount" position="attributes">
+ <attribute name="context">{}</attribute>
+ <attribute name="on_change">onchange_discount(context)</attribute>
</field>
</field>
- </record>w
+ </record>
<record id="sale_watcher_order_form2" model="ir.ui.view">
<field name="name">sales_line_watcher.form.floorprice</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
- <field name="type">form</field>
<field name="arch" type="xml">
- <field name="price_unit" position="replace">
- <field name="price_unit"
- on_change="onchange_price_unit(price_unit ,product_id ,discount, product_uom_qty, parent.pricelist_id)"
- select="2"/>
+ <field name="price_unit" position="attributes">
+ <attribute name="context">{}</attribute>
+ <attribute name="on_change">onchange_price_unit(context)</attribute>
</field>
</field>
</record>
=== modified file 'sale_line_watcher/sale_watcher.py'
--- sale_line_watcher/sale_watcher.py 2012-05-29 07:06:32 +0000
+++ sale_line_watcher/sale_watcher.py 2014-04-04 14:22:40 +0000
@@ -19,26 +19,20 @@
#
##############################################################################
-from osv.orm import Model
+from openerp.osv.orm import Model
class SaleOrderLine(Model):
_inherit = 'sale.order.line'
- def onchange_price_unit(self, cr, uid, ids,
- price_unit, product_id, discount, product_uom, pricelist,
- **kwargs):
- '''
+ def onchange_price_unit(self, cr, uid, ids, context=None):
+ """
Place holder function for onchange unit price
- '''
- res = {}
- return res
+ """
+ return {}
- def onchange_discount(self, cr, uid, ids,
- price_unit, product_id, discount, product_uom, pricelist,
- **kwargs):
- '''
+ def onchange_discount(self, cr, uid, ids, context=None):
+ """
Place holder function for onchange discount
- '''
- res = {}
- return res
+ """
+ return {}
Follow ups