From b32355e9b7bbd6f3b967cab3d797d6860b4b24f8 Mon Sep 17 00:00:00 2001 From: Joren Van Onder Date: Wed, 25 Nov 2015 14:43:32 +0100 Subject: [PATCH 1/4] [FIX] point_of_sale: fix forward port of currency displaying This fixes the forward port of 5c9b4556e35c420985696b0c958ca492030efa4a from saas-6, which was forward ported to 9.0 in 56a442e205f7837282f3f74afd0694bfe3a64ca1. --- addons/point_of_sale/static/src/js/widget_base.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/addons/point_of_sale/static/src/js/widget_base.js b/addons/point_of_sale/static/src/js/widget_base.js index d2e855cad8c..4a529dd1bf5 100644 --- a/addons/point_of_sale/static/src/js/widget_base.js +++ b/addons/point_of_sale/static/src/js/widget_base.js @@ -6,7 +6,6 @@ var utils = require('web.utils'); var Widget = require('web.Widget'); var round_di = utils.round_decimals; -var round_pr = utils.round_precision; // This is a base class for all Widgets in the POS. It exposes relevant data to the // templates : @@ -43,11 +42,6 @@ var PosBaseWidget = Widget.extend({ decimals = this.pos.dp[precision]; } - this.format_currency_no_symbol = function(amount){ - amount = round_pr(amount,currency.rounding); - amount = amount.toFixed(decimals); - return amount; - }; if (typeof amount === 'number') { amount = round_di(amount,decimals).toFixed(decimals); amount = formats.format_value(round_di(amount, decimals), { type: 'float', digits: [69, decimals]}); From 1b714bdc6ce75f856509548f2190d4e643186d58 Mon Sep 17 00:00:00 2001 From: Darshan Kalola Date: Fri, 18 Sep 2015 12:14:30 +0530 Subject: [PATCH 2/4] [FIX] point_of_sale: fix 'Group of Taxes' calculation There were still references in the POS to a child_ids field on account.tax. This field was renamed in accounting v9 to children_tax_ids. Because child_ids wasn't loaded anymore this meant that child_ids on the taxes in the POS was always undefined. On top of that the original code used Array.prototype.concat() assuming it modified the array, when in fact it returns a new array. All of this meant that group taxes in the POS were never calculated, this resolves that. --- addons/point_of_sale/static/src/js/models.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 8bac3a12519..3f892bb9b53 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -201,7 +201,7 @@ exports.PosModel = Backbone.Model.extend({ }, },{ model: 'account.tax', - fields: ['name','amount', 'price_include', 'include_base_amount', 'amount_type'], + fields: ['name','amount', 'price_include', 'include_base_amount', 'amount_type', 'children_tax_ids'], domain: null, loaded: function(self, taxes){ self.taxes = taxes; @@ -210,9 +210,8 @@ exports.PosModel = Backbone.Model.extend({ self.taxes_by_id[tax.id] = tax; }); _.each(self.taxes_by_id, function(tax) { - tax.child_taxes = {}; - _.each(tax.child_ids, function(child_tax_id) { - tax.child_taxes[child_tax_id] = self.taxes_by_id[child_tax_id]; + tax.children_tax_ids = _.map(tax.children_tax_ids, function (child_tax_id) { + return self.taxes_by_id[child_tax_id]; }); }); }, @@ -1351,7 +1350,7 @@ exports.Orderline = Backbone.Model.extend({ total_excluded = ret.total_excluded; base = ret.total_excluded; total_included = ret.total_included; - list_taxes.concat(ret.taxes); + list_taxes = list_taxes.concat(ret.taxes); } else { var tax_amount = self._compute_all(tax, base, quantity); From 39f8b5aff77ad91e38101c17ff55f977ece5cb06 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 25 Nov 2015 11:31:00 +0100 Subject: [PATCH 3/4] [FIX] stock: error if not assigned When the user validates a picking without going through the manual reservation process, Odoo tries to assign the picking then performs the transfer. However, if the picking could not be assigned, no pack operation is created and the picking will simply be set to done. The fix raises an error if the picking could not be assigned completely. Another solution is to use a force_assign instead of action_assign, but that could lead to the creation of negative stock moves without warning the user. We therefore prefer to stay on the safe side and force the user to manually handle the reservation. Note: the original issue was that the Owner of the picking was not copied on the quant when validating right away. The reason was that no pack operation was created. opw-654423 --- addons/stock/i18n/stock.pot | 6 ++++++ addons/stock/wizard/stock_immediate_transfer.py | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index 5831d645738..dad94c6f1b4 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -1201,6 +1201,12 @@ msgstr "" msgid "Corridor (X)" msgstr "" +#. module: stock +#: code:addons/stock/wizard/stock_immediate_transfer.py:31 +#, python-format +msgid "Could not reserve all requested products. Please use the 'Mark as Todo' button to handle the reservation manually." +msgstr "" + #. module: stock #: model:ir.ui.view,arch_db:stock.view_backorder_confirmation msgid "Create Backorder" diff --git a/addons/stock/wizard/stock_immediate_transfer.py b/addons/stock/wizard/stock_immediate_transfer.py index 9b21300b666..d118b6746c5 100644 --- a/addons/stock/wizard/stock_immediate_transfer.py +++ b/addons/stock/wizard/stock_immediate_transfer.py @@ -1,8 +1,9 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -from openerp import models, fields, api +from openerp import models, fields, api, _ from openerp.tools import float_compare +from openerp.exceptions import UserError class stock_immediate_transfer(models.TransientModel): _name = 'stock.immediate.transfer' @@ -26,6 +27,8 @@ class stock_immediate_transfer(models.TransientModel): self.pick_id.action_confirm() if self.pick_id.state != 'assigned': self.pick_id.action_assign() + if self.pick_id.state != 'assigned': + raise UserError(_("Could not reserve all requested products. Please use the \'Mark as Todo\' button to handle the reservation manually.")) for pack in self.pick_id.pack_operation_ids: if pack.product_qty > 0: pack.write({'qty_done': pack.product_qty}) From 4d8ddabe63846b26985ced851ef3f5943b664cb1 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 25 Nov 2015 12:57:17 +0100 Subject: [PATCH 4/4] [FIX] purchase: keep track of all procurements Keep track of all the procurements in the field "Source Document" of the PO. opw-654424 --- addons/purchase/purchase.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 2753fa077ad..894b7a33fcc 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -822,6 +822,12 @@ class ProcurementOrder(models.Model): vals = procurement._prepare_purchase_order(partner) po = self.env['purchase.order'].create(vals) cache[domain] = po + elif not po.origin or procurement.origin not in po.origin.split(', '): + # Keep track of all procurements + if po.origin: + po.write({'origin': po.origin + ', ' + procurement.origin}) + else: + po.write({'origin': procurement.origin}) res += po.ids # Create Line