[FIX] point_of_sale: currency should be fetched from the pricelist instead of the company

bzr revid: fva@openerp.com-20130920123018-b10rrmxmx85ludth
This commit is contained in:
Frédéric van der Essen 2013-09-20 14:30:18 +02:00
parent 885bd7ff7a
commit 5a4b68e422
1 changed files with 10 additions and 5 deletions

View File

@ -52,6 +52,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
'pos_config': null,
'units': null,
'units_by_id': null,
'pricelist': null,
'selectedOrder': null,
});
@ -113,10 +114,6 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
}).then(function(company_partners){
self.get('company').contact_address = company_partners[0].contact_address;
return self.fetch('res.currency',['symbol','position','rounding','accuracy'],[['id','=',self.get('company').currency_id[0]]]);
}).then(function(currencies){
self.set('currency',currencies[0]);
return self.fetch('product.uom', null, null);
}).then(function(units){
self.set('units',units);
@ -172,6 +169,14 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
}).then(function(shops){
self.set('shop',shops[0]);
return self.fetch('product.pricelist',['currency_id'],[['id','=',self.get('pos_config').pricelist_id[0]]]);
}).then(function(pricelists){
self.set('pricelist',pricelists[0]);
return self.fetch('res.currency',['symbol','position','rounding','accuracy'],[['id','=',self.get('pricelist').currency_id[0]]]);
}).then(function(currencies){
self.set('currency',currencies[0]);
return self.fetch('product.packaging',['ean','product_id']);
}).then(function(packagings){
self.db.add_packagings(packagings);
@ -185,7 +190,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
['name', 'list_price','price','pos_categ_id', 'taxes_id', 'ean13', 'default_code',
'to_weight', 'uom_id', 'uos_id', 'uos_coeff', 'mes_type', 'description_sale', 'description'],
[['sale_ok','=',true],['available_in_pos','=',true]],
{pricelist: self.get('pos_config').pricelist_id[0]} // context for price
{pricelist: self.get('pricelist').id} // context for price
);
}).then(function(products){
self.db.add_products(products);