summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2016-11-25 12:57:15 +0100
committerChristophe Simonis <chs@odoo.com>2016-11-25 12:57:15 +0100
commit1fbd582b54425d12e7944f427d0d2db9b31fcd06 (patch)
tree1c619deb6fd72d4e5eda60980cf6eaacc65e554f /addons
parentaa7d1ab9d1b14a68e421ee254d31d3eb6ef04207 (diff)
parentb3944ed0a08904eb4c2198c760dc7a6b7dcc59dd (diff)
[MERGE] forward port branch saas-6 up to b3944ed
Diffstat (limited to 'addons')
-rw-r--r--addons/product/pricelist.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py
index 815b64de624..7047cebb1f6 100644
--- a/addons/product/pricelist.py
+++ b/addons/product/pricelist.py
@@ -285,6 +285,13 @@ class product_pricelist_item(osv.osv):
return False
return True
+ def _get_product_pricelist(self, cr, uid, ids, context=None):
+ result = set()
+ for pricelist in self.pool['product.pricelist'].browse(cr, uid, ids, context=context):
+ for item in pricelist.item_ids:
+ result.add(item.id)
+ return list(result)
+
_columns = {
'product_tmpl_id': fields.many2one('product.template', 'Product Template', ondelete='cascade', help="Specify a template if this rule only applies to one product template. Keep empty otherwise."),
'product_id': fields.many2one('product.product', 'Product', ondelete='cascade', help="Specify a product if this rule only applies to one product. Keep empty otherwise."),
@@ -315,9 +322,13 @@ class product_pricelist_item(osv.osv):
'price_max_margin': fields.float('Max. Price Margin',
digits_compute= dp.get_precision('Product Price'), help='Specify the maximum amount of margin over the base price.'),
'company_id': fields.related('pricelist_id','company_id',type='many2one',
- readonly=True, relation='res.company', string='Company', store=True),
+ readonly=True, relation='res.company', string='Company', store={
+ 'product.pricelist': (_get_product_pricelist, ['company_id'], 30),
+ }),
'currency_id': fields.related('pricelist_id', 'currency_id', type='many2one',
- readonly=True, relation='res.currency', string='Currency', store=True),
+ readonly=True, relation='res.currency', string='Currency', store={
+ 'product.pricelist': (_get_product_pricelist, ['currency_id'], 30),
+ }),
'date_start': fields.date('Start Date', help="Starting date for the pricelist item validation"),
'date_end': fields.date('End Date', help="Ending valid for the pricelist item validation"),
'compute_price': fields.selection([('fixed', 'Fix Price'), ('percentage', 'Percentage (discount)'), ('formula', 'Formula')], select=True, default='fixed'),