[FIX] purchase: do not reset price_unit on qty or uom change
authorDenis Ledoux <dle@odoo.com>
Tue, 30 Sep 2014 08:40:42 +0000 (10:40 +0200)
committerDenis Ledoux <dle@odoo.com>
Tue, 30 Sep 2014 08:41:19 +0000 (10:41 +0200)
only when the product is actually changed

addons/purchase/purchase.py
addons/purchase/purchase_view.xml

index 97f0861..97f7e52 100644 (file)
@@ -1129,7 +1129,7 @@ class purchase_order_line(osv.osv):
             res['value'].update({'product_qty': qty})
 
         price = price_unit
-        if state not in ('sent','bid'):
+        if price_unit is False or price_unit is None:
             # - determine price_unit and taxes_id
             if pricelist_id:
                 date_order_str = datetime.strptime(date_order, DEFAULT_SERVER_DATETIME_FORMAT).strftime(DEFAULT_SERVER_DATE_FORMAT)
index 5212888..1746fcc 100644 (file)
                         <page string="Products">
                             <field name="order_line">
                                 <tree string="Purchase Order Lines" editable="bottom">
-                                    <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,0,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,parent.state,context)"/>
+                                    <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,0,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,False,parent.state,context)"/>
                                     <field name="name"/>
                                     <field name="date_planned"/>
                                     <field name="company_id" groups="base.group_multi_company" widget="selection"/>