Merge lp:~openerp-dev/openobject-addons/trunk-bug-977574-ara into lp:openobject-addons

Proposed by Ashvin Rathod (OpenERP)
Status: Work in progress
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-977574-ara
Merge into: lp:openobject-addons
Diff against target: 67 lines (+18/-12)
2 files modified
point_of_sale/point_of_sale.py (+12/-6)
point_of_sale/point_of_sale_view.xml (+6/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-977574-ara
Reviewer Review Type Date Requested Status
Amit Parik (community) Approve
Selami Demir (community) Disapprove
Review via email: mp+105031@code.launchpad.net

Description of the change

Hello

point_of_sale: [FIX] Point of Sale Not Using Pricelist.

Thank you,
ara

To post a comment you must log in.
Revision history for this message
Selami Demir (sdemir) wrote :

Hi,

after change code, I see a error that "No handler found."

thank you.

review: Disapprove
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Selami,

This code this working fine for pos backend , I have applied the code and pricelist working fine with the posorder(pos backend).

You have faced this error due to your end problem, please clear your browser's history (cache memory)then try it will works.

And yes if you want this for "POS touch-screen" then you have to post another bug repost because this bug consider only pos order's issue.

And please *don't disapprove* MP by your hand If you are not 100% sure for the MP becasue it will creates a problem and some good MP will not check/merge for trunk.

@Ashvin: Nice fix and it works for me.

Thanks for the fix!

review: Approve

Unmerged revisions

6779. By Ashvin Rathod (OpenERP)

[FIX] point_of_sale: Point of Sale Not Using Pricelist

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'point_of_sale/point_of_sale.py'
2--- point_of_sale/point_of_sale.py 2012-03-30 08:27:51 +0000
3+++ point_of_sale/point_of_sale.py 2012-05-08 06:22:19 +0000
4@@ -657,11 +657,11 @@
5 price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
6 product_id, qty or 1.0, partner_id)[pricelist]
7
8- result = self.onchange_qty(cr, uid, ids, product_id, 0.0, qty, price, context=context)
9+ result = self.onchange_qty(cr, uid, ids, product_id, 0.0, qty, price, pricelist, partner_id, context=context)
10 result['value']['price_unit'] = price
11 return result
12
13- def onchange_qty(self, cr, uid, ids, product, discount, qty, price_unit, context=None):
14+ def onchange_qty(self, cr, uid, ids, product, discount, qty, price_unit, pricelist, partner_id=False, context=None):
15 result = {}
16 if not product:
17 return result
18@@ -669,11 +669,17 @@
19 cur_obj = self.pool.get('res.currency')
20
21 prod = self.pool.get('product.product').browse(cr, uid, product, context=context)
22-
23 taxes = prod.taxes_id
24- price = price_unit * (1 - (discount or 0.0) / 100.0)
25- taxes = account_tax_obj.compute_all(cr, uid, prod.taxes_id, price, qty, product=prod, partner=False)
26-
27+
28+ price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
29+ product, qty or 1.0, partner_id)[pricelist]
30+ if not price:
31+ raise osv.except_osv(_('Configuration Error !'),_("No valid pricelist line found ! :Couldn't find a pricelist line matching this product and quantity.\nYou have to change either the product, the quantity or the pricelist."))
32+
33+ price_discount = price * (1 - (discount or 0.0) / 100.0)
34+ taxes = account_tax_obj.compute_all(cr, uid, prod.taxes_id, price_discount, qty, product=prod, partner=False)
35+
36+ result['price_unit'] = price
37 result['price_subtotal'] = taxes['total']
38 result['price_subtotal_incl'] = taxes['total_included']
39 return {'value': result}
40
41=== modified file 'point_of_sale/point_of_sale_view.xml'
42--- point_of_sale/point_of_sale_view.xml 2012-04-25 14:46:11 +0000
43+++ point_of_sale/point_of_sale_view.xml 2012-05-08 06:22:19 +0000
44@@ -28,17 +28,17 @@
45 <field name="lines" colspan="4" nolabel="1">
46 <tree string="Order lines" editable="bottom">
47 <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)"/>
48- <field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"/>
49- <field name="price_unit" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"/>
50- <field name="discount" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"/>
51+ <field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, parent.pricelist_id,parent.partner_id,context)"/>
52+ <field name="price_unit" on_change="onchange_qty(product_id, discount, qty, price_unit, parent.pricelist_id,parent.partner_id,context)"/>
53+ <field name="discount" on_change="onchange_qty(product_id, discount, qty, price_unit, parent.pricelist_id,parent.partner_id,context)"/>
54 <field name="price_subtotal"/>
55 <field name="price_subtotal_incl"/>
56 </tree>
57 <form string="Order lines">
58 <field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)"/>
59- <field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"/>
60- <field name="discount" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"/>
61- <field name="price_unit" on_change="onchange_qty(product_id, discount, qty, price_unit, context)"/>
62+ <field name="qty" on_change="onchange_qty(product_id, discount, qty, price_unit, parent.pricelist_id,parent.partner_id,context)"/>
63+ <field name="discount" on_change="onchange_qty(product_id, discount, qty, price_unit, parent.pricelist_id,parent.partner_id,context)"/>
64+ <field name="price_unit" on_change="onchange_qty(product_id, discount, qty, price_unit, parent.pricelist_id,parent.partner_id,context)"/>
65 <field name="price_subtotal" invisible="1"/>
66 <field name="price_subtotal_incl" invisible="1"/>
67 <field name="notice"/>

Subscribers

People subscribed via source and target branches

to all changes: