openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #02039
[Merge] lp:~therp-nl/ocb-addons/7.0-lp1174160 into lp:ocb-addons
Holger Brunn (Therp) has proposed merging lp:~therp-nl/ocb-addons/7.0-lp1174160 into lp:ocb-addons.
Requested reviews:
OpenERP Community Backports Team (ocb)
Related bugs:
Bug #1174160 in OpenERP Community Backports (Addons): "Pricelist report doesn't apply the "Supplier price form product form" rule."
https://bugs.launchpad.net/ocb-addons/+bug/1174160
For more details, see:
https://code.launchpad.net/~therp-nl/ocb-addons/7.0-lp1174160/+merge/198440
--
https://code.launchpad.net/~therp-nl/ocb-addons/7.0-lp1174160/+merge/198440
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~therp-nl/ocb-addons/7.0-lp1174160 into lp:ocb-addons.
=== modified file 'product/report/product_pricelist.py'
--- product/report/product_pricelist.py 2012-10-23 16:05:04 +0000
+++ product/report/product_pricelist.py 2013-12-10 17:46:39 +0000
@@ -83,6 +83,7 @@
cat_ids=[]
res=[]
self.pricelist = form['price_list']
+ self.partner_id = form['partner_id']
self._set_quantity(form)
pool = pooler.get_pool(self.cr.dbname)
pro_ids=[]
@@ -108,17 +109,18 @@
if qty == 0:
val['qty'+str(i)] = 0.0
else:
- val['qty'+str(i)]=self._get_price(self.pricelist, product['id'], qty)
+ val['qty'+str(i)]=self._get_price(self.pricelist, product['id'], qty, partner_id=self.partner_id)
i += 1
products.append(val)
res.append({'name':cat[1],'products': products})
return res
- def _get_price(self, pricelist_id, product_id, qty):
+ def _get_price(self, pricelist_id, product_id, qty, partner_id=None):
sale_price_digits = self.get_digits(dp='Product Price')
pool = pooler.get_pool(self.cr.dbname)
pricelist = self.pool.get('product.pricelist').browse(self.cr, self.uid, [pricelist_id], context=self.localcontext)[0]
- price_dict = pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, context=self.localcontext)
+ price_dict = pool.get('product.pricelist').price_get(self.cr, self.uid, [pricelist_id], product_id, qty, partner=partner_id, context=self.localcontext)
+
if price_dict[pricelist_id]:
price = self.formatLang(price_dict[pricelist_id], digits=sale_price_digits, currency_obj=pricelist.currency_id)
else:
=== modified file 'product/wizard/product_price.py'
--- product/wizard/product_price.py 2012-10-23 16:05:04 +0000
+++ product/wizard/product_price.py 2013-12-10 17:46:39 +0000
@@ -28,6 +28,9 @@
_description = 'Price List'
_columns = {
+ 'partner_id': fields.many2one('res.partner', 'Supplier',
+ help='For price lists based on the supplier price, fill in the '
+ 'supplier in quesion here'),
'price_list': fields.many2one('product.pricelist', 'PriceList', required=True),
'qty1': fields.integer('Quantity-1'),
'qty2': fields.integer('Quantity-2'),
@@ -51,9 +54,10 @@
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}
- res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context=context)
+ res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5', 'partner_id'], context=context)
res = res and res[0] or {}
res['price_list'] = res['price_list'][0]
+ res['partner_id'] = res['partner_id'] and res['partner_id'][0]
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
=== modified file 'product/wizard/product_price_view.xml'
--- product/wizard/product_price_view.xml 2012-10-23 16:05:04 +0000
+++ product/wizard/product_price_view.xml 2013-12-10 17:46:39 +0000
@@ -16,6 +16,7 @@
<field name="qty3"/>
<field name="qty4"/>
<field name="qty5"/>
+ <field name="partner_id" />
</group>
<footer>
<button name="print_report" string="Print" type="object" class="oe_highlight" />
Follow ups