From 64237aa3abc7b85fa6c513a4cd31aae1fc004e39 Mon Sep 17 00:00:00 2001 From: amoyaux Date: Mon, 9 Oct 2017 18:08:40 +0200 Subject: [PATCH 01/22] [FIX] stock: package transfer shows related pickings Use case to reproduce: - Create a picking with a package - Go to the source or destination package - Click on package transfers -> It displays all the pickings This happens because the package transfer button calls the all picking tree view that display them. This commit use an action instead that will add a domain on it in order to only display the pickings that used the selected package. opw-774013 --- addons/stock/models/stock_quant.py | 11 +++++++++++ addons/stock/views/stock_quant_views.xml | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 1c11ad0c99f..a67706f712b 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -694,6 +694,17 @@ class QuantPackage(models.Model): raise UserError(_('Everything inside a package should be in the same location')) return True + @api.multi + def action_view_related_picking(self): + """ Returns an action that display the picking related to this + package (source or destination). + """ + self.ensure_one() + pickings = self.env['stock.picking'].search(['|', ('pack_operation_ids.package_id', '=', self.id), ('pack_operation_ids.result_package_id', '=', self.id)]) + action = self.env.ref('stock.action_picking_tree_all').read()[0] + action['domain'] = [('id', 'in', pickings.ids)] + return action + @api.multi def unpack(self): for package in self: diff --git a/addons/stock/views/stock_quant_views.xml b/addons/stock/views/stock_quant_views.xml index c25f6a853d5..0af74419b40 100644 --- a/addons/stock/views/stock_quant_views.xml +++ b/addons/stock/views/stock_quant_views.xml @@ -176,8 +176,8 @@
-
From cae506f0ed26625f99ab1614f90e45e7ac72c205 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 10 Oct 2017 12:01:37 +0200 Subject: [PATCH 02/22] [FIX] website_quote: quotation template with visible discount on pricelist Steps to reproduce the bug: Let's consider a product A with a price of 100 Let's consider a pricelist P with a visible discount of 50% on product A. Let's consider a quotation template Q with one line with the product A with 50% of discount. Let's create a SO with pricelist P and set the quotation template Q on it. Bug: The unit price of A on SO is 50 instead of 100 and the visible discount is 50% instead of 75%. With the fix: The unit price is 100 and the discount is 75% opw:771996 --- addons/website_quote/models/sale_order.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/website_quote/models/sale_order.py b/addons/website_quote/models/sale_order.py index 18e41216ddb..8098061b510 100644 --- a/addons/website_quote/models/sale_order.py +++ b/addons/website_quote/models/sale_order.py @@ -100,15 +100,20 @@ class SaleOrder(models.Model): order_lines = [(5, 0, 0)] for line in template.quote_line: + discount = 0 if self.pricelist_id: price = self.pricelist_id.with_context(uom=line.product_uom_id.id).get_product_price(line.product_id, 1, False) + if self.pricelist_id.discount_policy == 'without_discount' and line.price_unit: + discount = (line.price_unit - price) / line.price_unit * 100 + price = line.price_unit + else: price = line.price_unit data = { 'name': line.name, 'price_unit': price, - 'discount': line.discount, + 'discount': 100 - ((100 - discount) * (100 - line.discount)/100), 'product_uom_qty': line.product_uom_qty, 'product_id': line.product_id.id, 'layout_category_id': line.layout_category_id, From 4206d1c2a292a0934b548d83fc0e33ddbdec6c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Pigeon=20=28ACSONE=29?= Date: Tue, 10 Oct 2017 15:53:09 +0200 Subject: [PATCH 03/22] [FIX] models: in `create`, add translations after setting x2many fields. (#19348) Otherwise if a record rule is defined on a x2many field on the model, the creation will fail because ir.translation creation check access rules on the model and in this case, the x2many relation are not set yet. --- odoo/models.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/odoo/models.py b/odoo/models.py index 24375db9ea4..9be314685cf 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -3924,14 +3924,6 @@ class BaseModel(object): id_new, = cr.fetchone() self = self.browse(id_new) - if self.env.lang and self.env.lang != 'en_US': - # add translations for self.env.lang - for name, val in vals.iteritems(): - field = self._fields[name] - if field.store and field.column_type and field.translate is True: - tname = "%s,%s" % (self._name, name) - self.env['ir.translation']._set_ids(tname, 'model', self.env.lang, self.ids, val, val) - if self._parent_store and not self._context.get('defer_parent_store_computation'): if self.pool._init: self.pool._init_parent[self._name] = True @@ -3993,6 +3985,15 @@ class BaseModel(object): self.recompute() self.check_access_rule('create') + + if self.env.lang and self.env.lang != 'en_US': + # add translations for self.env.lang + for name, val in vals.iteritems(): + field = self._fields[name] + if field.store and field.column_type and field.translate is True: + tname = "%s,%s" % (self._name, name) + self.env['ir.translation']._set_ids(tname, 'model', self.env.lang, self.ids, val, val) + self.create_workflow() return id_new From 2d8e6ff05e93fc095960341515e01102a1aa2982 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 9 Oct 2017 11:36:59 +0200 Subject: [PATCH 04/22] [FIX] mail: handle empty recordset when computing unread message count --- addons/mail/models/mail_thread.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index bb1b91c5ed0..63cf9641597 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -181,10 +181,10 @@ class MailThread(models.AbstractModel): RIGHT JOIN mail_channel_partner cp ON (cp.channel_id = rel.mail_channel_id AND cp.partner_id = %s AND (cp.seen_message_id IS NULL OR cp.seen_message_id < msg.id)) - WHERE msg.model = %s AND msg.res_id in %s AND + WHERE msg.model = %s AND msg.res_id = ANY(%s) AND (msg.author_id IS NULL OR msg.author_id != %s) AND (msg.message_type != 'notification' OR msg.model != 'mail.channel')""", - (partner_id, self._name, tuple(self.ids), partner_id,)) + (partner_id, self._name, list(self.ids), partner_id,)) for result in self._cr.fetchall(): res[result[0]] += 1 From 39f83aa89049b06c23e3699041a74234b9734405 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Tue, 10 Oct 2017 16:17:06 +0200 Subject: [PATCH 05/22] [FIX] res_lang: Use a non-breaking space as thousand separator in fr_FR --- odoo/addons/base/res/res.lang.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/res/res.lang.csv b/odoo/addons/base/res/res.lang.csv index 44b1406b753..e04af8271b7 100644 --- a/odoo/addons/base/res/res.lang.csv +++ b/odoo/addons/base/res/res.lang.csv @@ -21,7 +21,7 @@ "base.lang_fr_BE","French (BE) / Français (BE)","fr_BE","fr_BE","Left-to-Right","[3,0]",",",".","%d/%m/%Y","%H:%M:%S","True" "base.lang_fr_CA","French (CA) / Français (CA)","fr_CA","fr_CA","Left-to-Right","[3,0]",","," ","%Y-%m-%d","%H:%M:%S","True" "base.lang_fr_CH","French (CH) / Français (CH)","fr_CH","fr_CH","Left-to-Right","[3,0]",".","'","%d. %m. %Y","%H:%M:%S","True" -"base.lang_fr","French / Français","fr_FR","fr","Left-to-Right","[3,0]",","," ","%d/%m/%Y","%H:%M:%S","True" +"base.lang_fr","French / Français","fr_FR","fr","Left-to-Right","[3,0]",","," ","%d/%m/%Y","%H:%M:%S","True" "base.lang_gl_ES","Galician / Galego","gl_ES","gl_ES","Left-to-Right","[]",",",,"%d/%m/%Y","%H:%M:%S","True" "base.lang_ka_GE","Georgian / ქართული ენა","ka_GE","ka_GE","Left-to-Right","[3,0]",",",".","%m/%d/%Y","%H:%M:%S","True" "base.lang_de","German / Deutsch","de_DE","de","Left-to-Right","[3,0]",",",".","%d.%m.%Y","%H:%M:%S","True" From 99703583d4818dd5ec91386d3ed561ca9c1ebd52 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 10 Oct 2017 10:24:31 +0200 Subject: [PATCH 06/22] [FIX] account: invoiced amount - Create 2 companies: A is parent of B. - Demo is in Company A - Create 2 invoices for a partner: one in A, one in B (100 each) - Validate the invoices Connected as Demo, the 'Invoiced' amount on the partner form view (stat button) is 100, while clicking on it shows both invoices (total of 200). There is no need to manually add the company in the `where` clause since the `_apply_ir_rules` will take care of adding the appropriate multi-company rules. opw-772479 --- addons/account/models/partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 8e18962ab00..eb423456436 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -306,7 +306,7 @@ class ResPartner(models.Model): # generate where clause to include multicompany rules where_query = account_invoice_report._where_calc([ - ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']), ('company_id', '=', self.env.user.company_id.id), + ('partner_id', 'in', all_partner_ids), ('state', 'not in', ['draft', 'cancel']), ('type', 'in', ('out_invoice', 'out_refund')) ]) account_invoice_report._apply_ir_rules(where_query, 'read') From c7e9a8f74f2a825eb4107b31fe283687331d17a6 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Tue, 10 Oct 2017 17:54:39 +0200 Subject: [PATCH 07/22] [FIX] website_sale: improve microdata opw-774350 --- addons/website_sale/views/templates.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index 89b2393e6b7..060206aaab5 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -82,7 +82,7 @@ @@ -97,7 +97,7 @@
- +
@@ -398,7 +398,7 @@
- + @@ -442,7 +442,7 @@

Product Name

-