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

Proposed by Holger Brunn (Therp)
Status: Needs review
Proposed branch: lp:~therp-nl/openobject-addons/7.0-lp1174160
Merge into: lp:openobject-addons/7.0
Diff against target: 71 lines (+11/-4)
3 files modified
product/report/product_pricelist.py (+5/-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/7.0-lp1174160
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+213422@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

9942. 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 2012-12-18 17:55:47 +0000
3+++ product/report/product_pricelist.py 2014-03-31 09:22:04 +0000
4@@ -83,6 +83,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 pool = pooler.get_pool(self.cr.dbname)
11 pro_ids=[]
12@@ -108,17 +109,18 @@
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 pool = pooler.get_pool(self.cr.dbname)
27 pricelist = self.pool.get('product.pricelist').browse(self.cr, self.uid, [pricelist_id], context=self.localcontext)[0]
28- price_dict = pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, context=self.localcontext)
29+ price_dict = pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, partner=partner_id, context=self.localcontext)
30+
31 if price_dict[pricelist_id]:
32 price = self.formatLang(price_dict[pricelist_id], digits=sale_price_digits, currency_obj=pricelist.currency_id)
33 else:
34
35=== modified file 'product/wizard/product_price.py'
36--- product/wizard/product_price.py 2012-12-06 14:56:32 +0000
37+++ product/wizard/product_price.py 2014-03-31 09:22:04 +0000
38@@ -28,6 +28,9 @@
39 _description = 'Price List'
40
41 _columns = {
42+ 'partner_id': fields.many2one('res.partner', 'Supplier',
43+ help='For price lists based on the supplier price, fill in the '
44+ 'supplier in question here'),
45 'price_list': fields.many2one('product.pricelist', 'PriceList', required=True),
46 'qty1': fields.integer('Quantity-1'),
47 'qty2': fields.integer('Quantity-2'),
48@@ -51,9 +54,10 @@
49 if context is None:
50 context = {}
51 datas = {'ids': context.get('active_ids', [])}
52- res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context=context)
53+ res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5', 'partner_id'], context=context)
54 res = res and res[0] or {}
55 res['price_list'] = res['price_list'][0]
56+ res['partner_id'] = res['partner_id'] and res['partner_id'][0]
57 datas['form'] = res
58 return {
59 'type': 'ir.actions.report.xml',
60
61=== modified file 'product/wizard/product_price_view.xml'
62--- product/wizard/product_price_view.xml 2012-11-29 22:26:45 +0000
63+++ product/wizard/product_price_view.xml 2014-03-31 09:22:04 +0000
64@@ -16,6 +16,7 @@
65 <field name="qty3"/>
66 <field name="qty4"/>
67 <field name="qty5"/>
68+ <field name="partner_id" />
69 </group>
70 <footer>
71 <button name="print_report" string="Print" type="object" class="oe_highlight" />