Browse Source

Merge pull request #1 from pablocm-aserti/8.0-improve-pos-pricelist

[IMP] The pricelist in the current pos.config is used as default inst…
pull/39/head
Adil Houmadi 10 years ago
parent
commit
d1cc1977ad
  1. 6
      pos_pricelist/static/src/js/db.js
  2. 15
      pos_pricelist/static/src/js/models.js

6
pos_pricelist/static/src/js/db.js

@ -21,7 +21,6 @@ function pos_pricelist_db(instance, module) {
init: function (options) { init: function (options) {
options = options || {}; options = options || {};
this._super(options); this._super(options);
this.default_pricelist_id = 0;
this.pricelist_by_id = {}; this.pricelist_by_id = {};
this.pricelist_version_by_id = {}; this.pricelist_version_by_id = {};
this.pricelist_item_by_id = {}; this.pricelist_item_by_id = {};
@ -63,11 +62,6 @@ function pos_pricelist_db(instance, module) {
this.supplierinfo_by_id[supplier_info.id] = supplier_info; this.supplierinfo_by_id[supplier_info.id] = supplier_info;
} }
}, },
add_default_pricelist: function (res_id) {
if (res_id && res_id.length) {
this.default_pricelist_id = res_id[0].res_id;
}
},
add_pricelists: function (pricelists) { add_pricelists: function (pricelists) {
if (!(pricelists instanceof Array)) { if (!(pricelists instanceof Array)) {
pricelists = [pricelists]; pricelists = [pricelists];

15
pos_pricelist/static/src/js/models.js

@ -338,7 +338,7 @@ function pos_pricelist_models(instance, module) {
if (partner && partner.property_product_pricelist) { if (partner && partner.property_product_pricelist) {
price_list_id = partner.property_product_pricelist[0]; price_list_id = partner.property_product_pricelist[0];
} else { } else {
price_list_id = db.default_pricelist_id;
price_list_id = this.pos.config.pricelist_id[0];
} }
return this.compute_price( return this.compute_price(
db, product, partner, qty, parseInt(price_list_id) db, product, partner, qty, parseInt(price_list_id)
@ -698,19 +698,6 @@ function pos_pricelist_models(instance, module) {
} }
}, },
{
model: 'ir.model.data',
fields: ['res_id'],
domain: function () {
return [
['module', '=', 'product'],
['name', '=', 'property_product_pricelist']
]
},
loaded: function (self, res) {
self.db.add_default_pricelist(res);
}
},
{ {
model: 'product.pricelist', model: 'product.pricelist',
fields: ['display_name', fields: ['display_name',

Loading…
Cancel
Save