← Back to team overview

credativ team mailing list archive

[Merge] lp:~credativ/ocb-addons/7.0-ocb-lp1164572 into lp:ocb-addons

 

Craig Gowing (credativ) has proposed merging lp:~credativ/ocb-addons/7.0-ocb-lp1164572 into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1164572 in OpenERP Addons: "[Trunk/7.0] sale order pricelist is not filled correctly"
  https://bugs.launchpad.net/openobject-addons/+bug/1164572

For more details, see:
https://code.launchpad.net/~credativ/ocb-addons/7.0-ocb-lp1164572/+merge/217564
-- 
https://code.launchpad.net/~credativ/ocb-addons/7.0-ocb-lp1164572/+merge/217564
Your team credativ is subscribed to branch lp:~credativ/ocb-addons/7.0-ocb-lp1164572.
=== modified file 'sale/sale.py'
--- sale/sale.py	2014-03-25 10:32:26 +0000
+++ sale/sale.py	2014-04-29 09:08:24 +0000
@@ -56,7 +56,7 @@
         },
     }
 
-    def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
+    def onchange_shop_id(self, cr, uid, ids, shop_id, partner_id=None, context=None):
         v = {}
         if shop_id:
             shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
@@ -64,6 +64,9 @@
                 v['project_id'] = shop.project_id.id
             if shop.pricelist_id.id:
                 v['pricelist_id'] = shop.pricelist_id.id
+        if partner_id:
+            partner=self.pool.get('res.partner').browse(cr, uid,partner_id, context=context)
+            v['pricelist_id'] = partner.property_product_pricelist and partner.property_product_pricelist.id or False
         return {'value': v}
 
     def copy(self, cr, uid, id, default=None, context=None):

=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml	2014-04-22 15:07:10 +0000
+++ sale/sale_view.xml	2014-04-29 09:08:24 +0000
@@ -160,7 +160,7 @@
                         </group>
                         <group>
                             <field name="date_order"/>
-                            <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, context)" widget="selection"/>
+                            <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, partner_id,context)" widget="selection"/>
                             <field name="client_order_ref"/>
                             <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
                             <field name="currency_id" invisible="1"/>

=== modified file 'sale_analytic_plans/sale_analytic_plans.py'
--- sale_analytic_plans/sale_analytic_plans.py	2014-03-10 08:54:20 +0000
+++ sale_analytic_plans/sale_analytic_plans.py	2014-04-29 09:08:24 +0000
@@ -42,9 +42,9 @@
 class sale_order(osv.osv):
     _inherit = "sale.order"
 
-    def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
+    def onchange_shop_id(self, cr, uid, ids, shop_id, partner_id=None, context=None):
         # Remove the project_id from the result of super() call, if any, as this field is not in the view anymore
-        res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, context=context)
+        res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, partner_id, context=context)
         if res.get('value',{}).get('project_id'):
             del(res['value']['project_id'])
         return res

=== modified file 'sale_stock/sale_stock_view.xml'
--- sale_stock/sale_stock_view.xml	2014-03-10 08:54:20 +0000
+++ sale_stock/sale_stock_view.xml	2014-04-29 09:08:24 +0000
@@ -49,7 +49,7 @@
                         <attribute name="statusbar_colors">{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}</attribute>
                     </field>
                    <field name="shop_id" position="replace">
-                        <field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="stock.group_locations"/>
+                        <field name="shop_id" on_change="onchange_shop_id(shop_id, partner_id)" widget="selection" groups="stock.group_locations"/>
                    </field>
                    <field name="product_id" position="replace">
                        <field name="product_id"


Follow ups