|
@@ -138,9 +138,6 @@ function report_product_list(reporting){
|
|
var sale = _.filter(ProductPriceList,function (item) {
|
|
var sale = _.filter(ProductPriceList,function (item) {
|
|
return item.type == 'sale';
|
|
return item.type == 'sale';
|
|
});
|
|
});
|
|
- var purchase = _.filter(ProductPriceList,function (item) {
|
|
|
|
- return item.type == 'purchase';
|
|
|
|
- });
|
|
|
|
self.$el.find('#current-sale-price').append('<option value="9999999">Precio Base</option>');
|
|
self.$el.find('#current-sale-price').append('<option value="9999999">Precio Base</option>');
|
|
_.each(sale,function(item){
|
|
_.each(sale,function(item){
|
|
self.$el.find('#current-sale-price').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
self.$el.find('#current-sale-price').append('<option value="' + item.id + '">' + item.name + '</option>');
|
|
@@ -242,7 +239,20 @@ function report_product_list(reporting){
|
|
fetchPricelistVersionItem: function() {
|
|
fetchPricelistVersionItem: function() {
|
|
var self = this;
|
|
var self = this;
|
|
var defer = $.Deferred();
|
|
var defer = $.Deferred();
|
|
- var fields = ['name','product_id','categ_id','min_quantity','product_tmpl_id','sequence','base','price_discount','price_surcharge','price_round','price_min_margin','price_max_margin'];
|
|
|
|
|
|
+ var fields = [
|
|
|
|
+ 'name',
|
|
|
|
+ 'product_id',
|
|
|
|
+ 'categ_id',
|
|
|
|
+ 'min_quantity',
|
|
|
|
+ 'product_tmpl_id',
|
|
|
|
+ 'sequence',
|
|
|
|
+ 'base',
|
|
|
|
+ 'price_discount',
|
|
|
|
+ 'price_surcharge',
|
|
|
|
+ 'price_round',
|
|
|
|
+ 'price_min_margin',
|
|
|
|
+ 'price_max_margin'
|
|
|
|
+ ];
|
|
var ResUser = new model.web.Model('product.pricelist.item');
|
|
var ResUser = new model.web.Model('product.pricelist.item');
|
|
ResUser.query(fields).filter().all().then(function (results) {
|
|
ResUser.query(fields).filter().all().then(function (results) {
|
|
defer.resolve(results);
|
|
defer.resolve(results);
|
|
@@ -464,11 +474,21 @@ function report_product_list(reporting){
|
|
if(CurrencyBase.id == priceList[0].currency_id.id){
|
|
if(CurrencyBase.id == priceList[0].currency_id.id){
|
|
return product.list_price*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
return product.list_price*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
}else{
|
|
}else{
|
|
|
|
+ var price = 0;
|
|
if(CurrencyBase.rate_silent > priceList[0].currency_id.rate_silent){
|
|
if(CurrencyBase.rate_silent > priceList[0].currency_id.rate_silent){
|
|
- return (product.list_price / (CurrencyBase.rate_silent / priceList[0].currency_id.rate_silent))*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
|
|
|
|
+ if(x[0].base == 1){
|
|
|
|
+ price = (product.list_price / (CurrencyBase.rate_silent / priceList[0].currency_id.rate_silent))*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
|
|
+ }else{
|
|
|
|
+ price = (product.standard_price / (CurrencyBase.rate_silent / priceList[0].currency_id.rate_silent))*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
|
|
+ }
|
|
}else{
|
|
}else{
|
|
- return (product.list_price * (CurrencyBase.rate_silent / priceList[0].currency_id.rate_silent))*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
|
|
|
|
+ if(x[0].base == 1){
|
|
|
|
+ price = (product.list_price * (priceList[0].currency_id.rate_silent / CurrencyBase.rate_silent))*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
|
|
+ }else{
|
|
|
|
+ price = (product.standard_price * (priceList[0].currency_id.rate_silent / CurrencyBase.rate_silent))*(1+x[0].price_discount)+x[0].price_surcharge;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ return price;
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
return product.list_price;
|
|
return product.list_price;
|