diff --git a/pos_pricelist/models/pos_pricelist.py b/pos_pricelist/models/pos_pricelist.py
index 36e385d6..1bb25a70 100644
--- a/pos_pricelist/models/pos_pricelist.py
+++ b/pos_pricelist/models/pos_pricelist.py
@@ -18,6 +18,10 @@
##############################################################################
from openerp import models, fields
+import logging
+
+logger = logging.getLogger(__name__)
+
class PosPriceListConfig(models.Model):
_inherit = 'pos.config'
@@ -26,3 +30,12 @@ class PosPriceListConfig(models.Model):
string='Price With Taxes',
help="Display Prices with taxes on POS"
)
+
+
+class product_pricelist(models.Model):
+ _inherit = 'product.pricelist'
+
+ pos_config_ids = fields.Many2many(
+ 'pos.config', 'pricelist_posconfig_rel',
+ 'pricelist_id', 'pos_id', string='PoS',
+ help='if empty will be available for all the pos')
diff --git a/pos_pricelist/static/src/js/models.js b/pos_pricelist/static/src/js/models.js
index c82eaaaa..42524b9c 100644
--- a/pos_pricelist/static/src/js/models.js
+++ b/pos_pricelist/static/src/js/models.js
@@ -725,11 +725,17 @@ function pos_pricelist_models(instance, module) {
'name',
'version_id',
'currency_id'],
- domain: function () {
+ domain: function (self) {
return [
- ['type', '=', 'sale']
+ '|',
+ '|',
+ ['id', '=', self.config.pricelist_id[0]],
+ ['pos_config_ids', '=', false],
+ ['pos_config_ids', 'in', [self.config.id]],
+ ['type', '=', 'sale'],
]
},
+ context: function(self){ return { pos_config_id: self.config.id }; },
loaded: function (self, pricelists) {
self.db.add_pricelists(pricelists);
}
@@ -741,7 +747,12 @@ function pos_pricelist_models(instance, module) {
'date_start',
'date_end',
'items'],
- domain: null,
+ domain: function (self) {
+ var pricelist_ids = _.map(_.keys(self.db.pricelist_by_id), function(el){return parseInt(el)});
+ return [
+ ['pricelist_id', 'in', pricelist_ids]
+ ]
+ },
loaded: function (self, versions) {
self.db.add_pricelist_versions(versions);
}
@@ -763,7 +774,12 @@ function pos_pricelist_models(instance, module) {
'product_tmpl_id',
'sequence'
],
- domain: null,
+ domain: function (self) {
+ var version_ids = _.map(_.keys(self.db.pricelist_version_by_id), function (el){return parseInt(el);});
+ return [
+ ['price_version_id', 'in', version_ids]
+ ];
+ },
loaded: function (self, items) {
self.db.add_pricelist_items(items);
}
diff --git a/pos_pricelist/views/pos_pricelist_views.xml b/pos_pricelist/views/pos_pricelist_views.xml
index 084723e7..7db32a93 100644
--- a/pos_pricelist/views/pos_pricelist_views.xml
+++ b/pos_pricelist/views/pos_pricelist_views.xml
@@ -11,5 +11,30 @@
+
+ product.pricelist.form.inherit.pos
+ product.pricelist
+
+
+
+
+
+
+
+
+
+
+
+ product.pricelist.tree.inherit.pos
+ product.pricelist
+
+
+
+
+
+
+
+
+