Merge lp:~therp-nl/openobject-addons/trunk-lp1174160 into lp:openobject-addons

Proposed by Holger Brunn (Therp)
Status: Needs review
Proposed branch: lp:~therp-nl/openobject-addons/trunk-lp1174160
Merge into: lp:openobject-addons
Diff against target: 69 lines (+10/-4)
3 files modified
product/report/product_pricelist.py (+4/-3)
product/wizard/product_price.py (+5/-1)
product/wizard/product_price_view.xml (+1/-0)
To merge this branch: bzr merge lp:~therp-nl/openobject-addons/trunk-lp1174160
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+213425@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

9269. By Holger Brunn (Therp)

[FIX] for pricelists based on a supplier, we need to fill in the supplier

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product/report/product_pricelist.py'
2--- product/report/product_pricelist.py 2013-10-27 12:31:04 +0000
3+++ product/report/product_pricelist.py 2014-03-31 10:05:44 +0000
4@@ -79,6 +79,7 @@
5 cat_ids=[]
6 res=[]
7 self.pricelist = form['price_list']
8+ self.partner_id = form['partner_id']
9 self._set_quantity(form)
10 pro_ids=[]
11 for product in products:
12@@ -103,16 +104,16 @@
13 if qty == 0:
14 val['qty'+str(i)] = 0.0
15 else:
16- val['qty'+str(i)]=self._get_price(self.pricelist, product['id'], qty)
17+ val['qty'+str(i)]=self._get_price(self.pricelist, product['id'], qty, partner_id=self.partner_id)
18 i += 1
19 products.append(val)
20 res.append({'name':cat[1],'products': products})
21 return res
22
23- def _get_price(self, pricelist_id, product_id, qty):
24+ def _get_price(self, pricelist_id, product_id, qty, partner_id=None):
25 sale_price_digits = self.get_digits(dp='Product Price')
26 pricelist = self.pool.get('product.pricelist').browse(self.cr, self.uid, [pricelist_id], context=self.localcontext)[0]
27- price_dict = self.pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, context=self.localcontext)
28+ price_dict = self.pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, partner=partner_id, context=self.localcontext)
29 if price_dict[pricelist_id]:
30 price = self.formatLang(price_dict[pricelist_id], digits=sale_price_digits, currency_obj=pricelist.currency_id)
31 else:
32
33=== modified file 'product/wizard/product_price.py'
34--- product/wizard/product_price.py 2013-10-27 12:31:04 +0000
35+++ product/wizard/product_price.py 2014-03-31 10:05:44 +0000
36@@ -28,6 +28,9 @@
37 _description = 'Price List'
38
39 _columns = {
40+ 'partner_id': fields.many2one('res.partner', 'Supplier',
41+ help='For price lists based on the supplier price, fill in the '
42+ 'supplier in question here'),
43 'price_list': fields.many2one('product.pricelist', 'PriceList', required=True),
44 'qty1': fields.integer('Quantity-1'),
45 'qty2': fields.integer('Quantity-2'),
46@@ -51,9 +54,10 @@
47 if context is None:
48 context = {}
49 datas = {'ids': context.get('active_ids', [])}
50- res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context=context)
51+ res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5', 'partner_id'], context=context)
52 res = res and res[0] or {}
53 res['price_list'] = res['price_list'][0]
54+ res['partner_id'] = res['partner_id'] and res['partner_id'][0]
55 datas['form'] = res
56 return {
57 'type': 'ir.actions.report.xml',
58
59=== modified file 'product/wizard/product_price_view.xml'
60--- product/wizard/product_price_view.xml 2012-11-29 22:26:45 +0000
61+++ product/wizard/product_price_view.xml 2014-03-31 10:05:44 +0000
62@@ -16,6 +16,7 @@
63 <field name="qty3"/>
64 <field name="qty4"/>
65 <field name="qty5"/>
66+ <field name="partner_id" />
67 </group>
68 <footer>
69 <button name="print_report" string="Print" type="object" class="oe_highlight" />

Subscribers

People subscribed via source and target branches

to all changes: