From 54a90179bb477a0ce3814395a38e5e98c8e9e477 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 20 May 2015 15:33:10 +0200 Subject: [PATCH 1/6] [FIX] expression: ensure tuple to compare leaf with TRUE/FALSE leaf When setting a custom filter with as domain [(0, '=', 1)] the domain was rejected, because (0, '=', 1) wasn't considered as a valid leaf, while it is. This is because the Javascript converts this domain using list instead of tuple [(0, '=', 1)] -> [[0, '=', 1]] And therefore, comparing the "list" leaf to the TRUE/FALSE leaf tuple failed. Ensuring "element" as a tuple solves the issue. opw-640306 --- openerp/osv/expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 18c82306bc5..4715d9268c4 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -401,7 +401,7 @@ def is_leaf(element, internal=False): and len(element) == 3 \ and element[1] in INTERNAL_OPS \ and ((isinstance(element[0], basestring) and element[0]) - or element in (TRUE_LEAF, FALSE_LEAF)) + or tuple(element) in (TRUE_LEAF, FALSE_LEAF)) # -------------------------------------------------- From 9c6ae3cf6c3772fcfd2127022cacc8f3233fea0a Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 19 May 2015 13:41:32 +0200 Subject: [PATCH 2/6] [FIX] mrp_operations: adapt the date_planned of the WO when date_planned of MO is changed Changing the scheduled date (date_planned) of the MO triggers a computation of the scheduled date of the associated WO in order to keep the data consistent. Fixes #6694 opw-639771 --- addons/mrp_operations/mrp_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index d841e344a9e..f77d5cf839f 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -354,7 +354,7 @@ class mrp_production(osv.osv): for po in self.browse(cr, uid, ids, context=context): direction[po.id] = cmp(po.date_start, vals.get('date_start', False)) result = super(mrp_production, self).write(cr, uid, ids, vals, context=context) - if (vals.get('workcenter_lines', False) or vals.get('date_start', False)) and update: + if (vals.get('workcenter_lines', False) or vals.get('date_start', False) or vals.get('date_planned', False)) and update: self._compute_planned_workcenter(cr, uid, ids, context=context, mini=mini) for d in direction: if direction[d] == 1: From ba896aabe7dad10f3108a4b83c4d8e304ae0935f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 19 May 2015 16:27:50 +0200 Subject: [PATCH 3/6] [FIX] stock: if cost_method of a product is 'average' do not round the currency conversion This prevents rounding errors if product decimal precision is different from currency precision. Fixes #6547 opw-634390 Do not fowardport since already done in v8.0: https://github.com/odoo/odoo/blob/8.0/addons/stock_account/stock_account.py#L310 --- addons/stock/stock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index f01e0995acc..16deddcca5b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2354,7 +2354,11 @@ class stock_move(osv.osv): new_std_price = new_price else: # Get the standard price - amount_unit = product.price_get('standard_price', context=context)[product.id] + pricetype_obj = self.pool.get('product.price.type') + price_type_id = pricetype_obj.search(cr, uid, [('field','=','standard_price')])[0] + price_type_currency_id = pricetype_obj.browse(cr, uid, price_type_id).currency_id.id + amount_unit = self.pool.get('res.currency').compute(cr, uid, price_type_currency_id, + context['currency_id'], product.standard_price, round=False, context=context) new_std_price = ((amount_unit * product_avail[product.id])\ + (new_price * qty))/(product_avail[product.id] + qty) From 2e123fbb854dce26d1ddc34c63dbfd959b709989 Mon Sep 17 00:00:00 2001 From: Joao Alfredo Gama Batista Date: Wed, 20 May 2015 11:22:25 -0400 Subject: [PATCH 4/6] [FIX] Fix exception translation --- addons/account/account_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 9f85f58fb00..cfc883d2a5e 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1119,7 +1119,7 @@ class account_move_line(osv.osv): period = period_obj.browse(cr, uid, period_id, context=context) for (state,) in result: if state == 'done': - raise osv.except_osv(_('Error!'), _('You can not add/modify entries in a closed period %s of journal %s.' % (period.name,journal.name))) + raise osv.except_osv(_('Error!'), _('You can not add/modify entries in a closed period %s of journal %s.') % (period.name, journal.name)) if not result: jour_period_obj.create(cr, uid, { 'name': (journal.code or journal.name)+':'+(period.name or ''), From 2c0529858fb2119252a4c04a0018ee6adaa2d520 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 21 May 2015 10:23:56 +0200 Subject: [PATCH 5/6] [FIX] point_of_sale: float format The POS must adapt the float format according to the language of the user. Inspired from 1da5d89ba32526f241b3a0ce82b25a2fa9ee858f opw:639567 --- addons/point_of_sale/static/src/js/screens.js | 10 +++++++++- addons/point_of_sale/static/src/js/widget_base.js | 1 + addons/point_of_sale/static/src/xml/pos.xml | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index cbd6779f33c..11641c36614 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -885,6 +885,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa },this); this.bind_events(); + this.decimal_point = instance.web._t.database.parameters.decimal_point; this.line_delete_handler = function(event){ var node = this; @@ -903,7 +904,14 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa node = node.parentNode; } if(node){ - node.line.set_amount(this.value); + var amount; + try{ + amount = instance.web.parse_value(this.value, {type: "float"}); + } + catch(e){ + amount = 0; + } + node.line.set_amount(amount); } }; 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 443d66647a1..5d676e53d37 100644 --- a/addons/point_of_sale/static/src/js/widget_base.js +++ b/addons/point_of_sale/static/src/js/widget_base.js @@ -31,6 +31,7 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of if(typeof amount === 'number'){ amount = Math.round(amount*100)/100; amount = amount.toFixed(decimals); + amount = openerp.instances[this.session.name].web.format_value(parseFloat(amount), { type : 'float' }); } if(this.currency.position === 'after'){ return amount + ' ' + (this.currency.symbol || ''); diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 1afd0fe4359..68c07c25a01 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -588,7 +588,10 @@
- + From eaaca6559429a8d36c7f6dc1f8232cf222ad2a32 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 21 May 2015 11:35:13 +0200 Subject: [PATCH 6/6] [FIX] mail: does not write "False" if mail body is empty opw-640309 --- addons/mail/wizard/mail_compose_message.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mail/wizard/mail_compose_message.py b/addons/mail/wizard/mail_compose_message.py index 7e269ab7379..733057de1cf 100644 --- a/addons/mail/wizard/mail_compose_message.py +++ b/addons/mail/wizard/mail_compose_message.py @@ -234,7 +234,7 @@ class mail_compose_message(osv.TransientModel): # mail.message values, according to the wizard options post_values = { 'subject': wizard.subject, - 'body': wizard.body, + 'body': wizard.body or '', 'parent_id': wizard.parent_id and wizard.parent_id.id, 'partner_ids': [partner.id for partner in wizard.partner_ids], 'attachment_ids': [attach.id for attach in wizard.attachment_ids],