Merge lp:~openerp-dev/openobject-addons/7.0-opw-592116-dhr into lp:openobject-addons/7.0

Proposed by Dharti Ratani(OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-592116-dhr
Merge into: lp:openobject-addons/7.0
Diff against target: 66 lines (+10/-7)
4 files modified
sale/sale.py (+6/-3)
sale/sale_view.xml (+1/-1)
sale_analytic_plans/sale_analytic_plans.py (+2/-2)
sale_stock/sale_stock_view.xml (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-592116-dhr
Reviewer Review Type Date Requested Status
Dharti Ratani(OpenERP) (community) Needs Resubmitting
Thibault Delavallée (OpenERP) (community) Needs Information
Naresh(OpenERP) Pending
Review via email: mp+162297@code.launchpad.net

Description of the change

Hello sir,

Set the pricelist in quotations as customer's pricelist , while creating quotations from customer form.

Thanks
dhr

To post a comment you must log in.
Revision history for this message
Thibault Delavallée (OpenERP) (tde-openerp) wrote :

What if you use the updated code without updating the views (aka, run the server with the updated code but without -u argument) ? Won't that code crash because no default value is defined on partner_id ?

review: Needs Information
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

needs improvement as per above comment.

Revision history for this message
Dharti Ratani(OpenERP) (dhr-openerp) wrote :

Hello Sir,

Added the default value for partner_id as per your suggestion.

Thanks
dhr

review: Needs Resubmitting

Unmerged revisions

9094. By Dharti Ratani(OpenERP)

[IMP]Added default value for partner id in onchange_shop_id

9093. By Dharti Ratani(OpenERP)

[IMP]Improved code

9092. By Dharti Ratani(OpenERP)

[IMP]Changed the signature for onchange_shop in sale analytic plans

9091. By Dharti Ratani(OpenERP)

[FIX]Incorrect sales pricelist while opening quotations/sale order from a button in a customer form

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'sale/sale.py'
--- sale/sale.py 2013-06-26 05:36:42 +0000
+++ sale/sale.py 2013-10-21 09:09:21 +0000
@@ -56,14 +56,17 @@
56 },56 },
57 }57 }
5858
59 def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):59 def onchange_shop_id(self, cr, uid, ids, shop_id, partner_id=False, context=None):
60 v = {}60 v = {}
61 customer_pricelist = False
62 if partner_id:
63 customer = self.pool.get('res.partner').browse(cr, uid, partner_id, context)
64 customer_pricelist = customer and customer.property_product_pricelist and customer.property_product_pricelist.id or False
61 if shop_id:65 if shop_id:
62 shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)66 shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
63 if shop.project_id.id:67 if shop.project_id.id:
64 v['project_id'] = shop.project_id.id68 v['project_id'] = shop.project_id.id
65 if shop.pricelist_id.id:69 v['pricelist_id'] = customer_pricelist or shop.pricelist_id and shop.pricelist_id.id or False
66 v['pricelist_id'] = shop.pricelist_id.id
67 return {'value': v}70 return {'value': v}
6871
69 def copy(self, cr, uid, id, default=None, context=None):72 def copy(self, cr, uid, id, default=None, context=None):
7073
=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml 2013-09-13 12:57:48 +0000
+++ sale/sale_view.xml 2013-10-21 09:09:21 +0000
@@ -160,7 +160,7 @@
160 </group>160 </group>
161 <group>161 <group>
162 <field name="date_order"/>162 <field name="date_order"/>
163 <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, context)" widget="selection"/>163 <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, partner_id, context)" widget="selection"/>
164 <field name="client_order_ref"/>164 <field name="client_order_ref"/>
165 <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>165 <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
166 <field name="currency_id" invisible="1"/>166 <field name="currency_id" invisible="1"/>
167167
=== modified file 'sale_analytic_plans/sale_analytic_plans.py'
--- sale_analytic_plans/sale_analytic_plans.py 2012-12-06 14:56:32 +0000
+++ sale_analytic_plans/sale_analytic_plans.py 2013-10-21 09:09:21 +0000
@@ -42,9 +42,9 @@
42class sale_order(osv.osv):42class sale_order(osv.osv):
43 _inherit = "sale.order"43 _inherit = "sale.order"
4444
45 def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):45 def onchange_shop_id(self, cr, uid, ids, shop_id, partner_id=False, context=None):
46 # Remove the project_id from the result of super() call, if any, as this field is not in the view anymore46 # Remove the project_id from the result of super() call, if any, as this field is not in the view anymore
47 res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, context=context)47 res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, partner_id, context=context)
48 if res.get('value',{}).get('project_id'):48 if res.get('value',{}).get('project_id'):
49 del(res['value']['project_id'])49 del(res['value']['project_id'])
50 return res50 return res
5151
=== modified file 'sale_stock/sale_stock_view.xml'
--- sale_stock/sale_stock_view.xml 2013-03-04 18:44:31 +0000
+++ sale_stock/sale_stock_view.xml 2013-10-21 09:09:21 +0000
@@ -49,7 +49,7 @@
49 <field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,invoiced,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>49 <field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,invoiced,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
50 </field>50 </field>
51 <field name="shop_id" position="replace">51 <field name="shop_id" position="replace">
52 <field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="stock.group_locations"/>52 <field name="shop_id" on_change="onchange_shop_id(shop_id, partner_id)" widget="selection" groups="stock.group_locations"/>
53 </field>53 </field>
54 <field name="product_id" position="replace">54 <field name="product_id" position="replace">
55 <field name="product_id"55 <field name="product_id"