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
1=== modified file 'sale/sale.py'
2--- sale/sale.py 2013-06-26 05:36:42 +0000
3+++ sale/sale.py 2013-10-21 09:09:21 +0000
4@@ -56,14 +56,17 @@
5 },
6 }
7
8- def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
9+ def onchange_shop_id(self, cr, uid, ids, shop_id, partner_id=False, context=None):
10 v = {}
11+ customer_pricelist = False
12+ if partner_id:
13+ customer = self.pool.get('res.partner').browse(cr, uid, partner_id, context)
14+ customer_pricelist = customer and customer.property_product_pricelist and customer.property_product_pricelist.id or False
15 if shop_id:
16 shop = self.pool.get('sale.shop').browse(cr, uid, shop_id, context=context)
17 if shop.project_id.id:
18 v['project_id'] = shop.project_id.id
19- if shop.pricelist_id.id:
20- v['pricelist_id'] = shop.pricelist_id.id
21+ v['pricelist_id'] = customer_pricelist or shop.pricelist_id and shop.pricelist_id.id or False
22 return {'value': v}
23
24 def copy(self, cr, uid, id, default=None, context=None):
25
26=== modified file 'sale/sale_view.xml'
27--- sale/sale_view.xml 2013-09-13 12:57:48 +0000
28+++ sale/sale_view.xml 2013-10-21 09:09:21 +0000
29@@ -160,7 +160,7 @@
30 </group>
31 <group>
32 <field name="date_order"/>
33- <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, context)" widget="selection"/>
34+ <field name="shop_id" groups="base.group_no_one" on_change="onchange_shop_id(shop_id, partner_id, context)" widget="selection"/>
35 <field name="client_order_ref"/>
36 <field domain="[('type','=','sale')]" name="pricelist_id" groups="product.group_sale_pricelist" on_change="onchange_pricelist_id(pricelist_id,order_line)"/>
37 <field name="currency_id" invisible="1"/>
38
39=== modified file 'sale_analytic_plans/sale_analytic_plans.py'
40--- sale_analytic_plans/sale_analytic_plans.py 2012-12-06 14:56:32 +0000
41+++ sale_analytic_plans/sale_analytic_plans.py 2013-10-21 09:09:21 +0000
42@@ -42,9 +42,9 @@
43 class sale_order(osv.osv):
44 _inherit = "sale.order"
45
46- def onchange_shop_id(self, cr, uid, ids, shop_id, context=None):
47+ def onchange_shop_id(self, cr, uid, ids, shop_id, partner_id=False, context=None):
48 # Remove the project_id from the result of super() call, if any, as this field is not in the view anymore
49- res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, context=context)
50+ res = super(sale_order, self).onchange_shop_id(cr, uid, ids, shop_id, partner_id, context=context)
51 if res.get('value',{}).get('project_id'):
52 del(res['value']['project_id'])
53 return res
54
55=== modified file 'sale_stock/sale_stock_view.xml'
56--- sale_stock/sale_stock_view.xml 2013-03-04 18:44:31 +0000
57+++ sale_stock/sale_stock_view.xml 2013-10-21 09:09:21 +0000
58@@ -49,7 +49,7 @@
59 <field name="state" widget="statusbar" statusbar_visible="draft,sent,progress,invoiced,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
60 </field>
61 <field name="shop_id" position="replace">
62- <field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="stock.group_locations"/>
63+ <field name="shop_id" on_change="onchange_shop_id(shop_id, partner_id)" widget="selection" groups="stock.group_locations"/>
64 </field>
65 <field name="product_id" position="replace">
66 <field name="product_id"