From 4f71da443a5aecc29e7b2c4a9c24a976d0479b06 Mon Sep 17 00:00:00 2001 From: PabloCM Date: Fri, 24 Jul 2015 10:33:52 +0200 Subject: [PATCH] [FIX] Renamed method and var for clarity --- pos_pricelist/static/src/js/db.js | 14 +++++++------- pos_pricelist/static/src/js/models.js | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pos_pricelist/static/src/js/db.js b/pos_pricelist/static/src/js/db.js index 2a27cb91..d2f2be5d 100644 --- a/pos_pricelist/static/src/js/db.js +++ b/pos_pricelist/static/src/js/db.js @@ -140,16 +140,16 @@ function pos_pricelist_db(instance, module) { }); return list; }, - find_taxes_by_fiscal_position_id: function (fiscal_position_id, taxes_ids) { + map_tax: function (fiscal_position_id, taxes_ids) { var taxes = []; var found_taxes = {}; for (var id in this.fiscal_position_tax_by_id) { - var tax = this.fiscal_position_tax_by_id[id]; - if (tax && tax.position_id && - tax.position_id[0] == fiscal_position_id && - taxes_ids.indexOf(tax.tax_src_id[0]) > -1) { - taxes.push(tax.tax_dest_id[0]); - found_taxes[tax.tax_src_id[0]] = true; + var fp_line = this.fiscal_position_tax_by_id[id]; + if (fp_line && fp_line.position_id && + fp_line.position_id[0] == fiscal_position_id && + taxes_ids.indexOf(fp_line.tax_src_id[0]) > -1) { + taxes.push(fp_line.tax_dest_id[0]); + found_taxes[fp_line.tax_src_id[0]] = true; } } for (var i = 0, len = taxes_ids.length; i < len; i++) { diff --git a/pos_pricelist/static/src/js/models.js b/pos_pricelist/static/src/js/models.js index e82b5496..c61fe32e 100644 --- a/pos_pricelist/static/src/js/models.js +++ b/pos_pricelist/static/src/js/models.js @@ -270,7 +270,7 @@ function pos_pricelist_models(instance, module) { var partner = this.order ? this.order.get_client() : null; if (partner && partner.property_account_position) { product_tax_ids = - this.pos.db.find_taxes_by_fiscal_position_id( + this.pos.db.map_tax( partner.property_account_position[0], product_tax_ids ); } @@ -302,7 +302,7 @@ function pos_pricelist_models(instance, module) { var partner = this.order ? this.order.get_client() : null; if (partner && partner.property_account_position) { product_tax_ids = - this.pos.db.find_taxes_by_fiscal_position_id( + this.pos.db.map_tax( partner.property_account_position[0], product_tax_ids ); }