From befb3a1cd62c4071d5fc19aca368b524ff139df0 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Fri, 7 Dec 2018 09:07:59 +0000 Subject: [PATCH 01/54] [FIX] models: make valid aggregation functions explicit In `read_group`, allow an explicit set of aggregation functions. closes odoo/odoo#29348 --- odoo/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/odoo/models.py b/odoo/models.py index 2843ba54ecd..c62e28f1868 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -191,6 +191,12 @@ PREFETCH_MAX = 1000 LOG_ACCESS_COLUMNS = ['create_uid', 'create_date', 'write_uid', 'write_date'] MAGIC_COLUMNS = ['id'] + LOG_ACCESS_COLUMNS +# valid SQL aggregation functions +VALID_AGGREGATE_FUNCTIONS = { + 'array_agg', 'count', 'count_distinct', + 'bool_and', 'bool_or', 'max', 'min', 'avg', 'sum', +} + @pycompat.implements_to_string class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): @@ -1966,7 +1972,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})): field = self._fields[fname] if not (field.base_field.store and field.base_field.column_type): raise UserError(_("Cannot aggregate field %r.") % fname) - if not func.isidentifier(): + if func not in VALID_AGGREGATE_FUNCTIONS: raise UserError(_("Invalid aggregation function %r.") % func) else: # we have 'name', retrieve the aggregator on the field From 93807af6e041f35a3b64dc4ad1e28a21bec13065 Mon Sep 17 00:00:00 2001 From: len-odoo Date: Mon, 10 Dec 2018 13:29:48 +0000 Subject: [PATCH 02/54] [FIX] website_sale: fix overlapping text with product categories If the price section goes on two lines because of crossed prices or many icons, then it would overlap with the product title. See before/after on the PR. opw 1913521 closes odoo/odoo#29388 --- addons/website_sale/static/src/css/website_sale.css | 4 +--- addons/website_sale/static/src/css/website_sale.sass | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/website_sale/static/src/css/website_sale.css b/addons/website_sale/static/src/css/website_sale.css index cb626dbe794..eeeb02cf130 100644 --- a/addons/website_sale/static/src/css/website_sale.css +++ b/addons/website_sale/static/src/css/website_sale.css @@ -108,15 +108,13 @@ right: 0; bottom: 0; overflow: hidden; - padding: 0 15px 24px 10px; + padding: 0 15px 0 10px; min-height: 56px; border-top: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.75); z-index: 5; } .oe_product .product_price { - padding: 5px 0; - position: absolute; bottom: 0; } .oe_product .oe_product_cart { diff --git a/addons/website_sale/static/src/css/website_sale.sass b/addons/website_sale/static/src/css/website_sale.sass index 0b80557ded3..f7f69ed990b 100644 --- a/addons/website_sale/static/src/css/website_sale.sass +++ b/addons/website_sale/static/src/css/website_sale.sass @@ -96,14 +96,12 @@ right: 0 bottom: 0 overflow: hidden - padding: 0 15px 24px 10px + padding: 0 15px 0 10px min-height: 56px border-top: 1px solid rgba(255,255,255,0.2) background: rgba(255, 255, 255, 0.75) z-index: 5 .product_price - padding: 5px 0 - position: absolute bottom: 0 .oe_product_cart position: relative From a6d13535916bb2f02daad64b87ed96a665d78c1f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 12 Dec 2018 11:44:48 +0000 Subject: [PATCH 03/54] [FIX] l10n_be_intrastat, report_intrastat: date The reference date for Intrastat should be the accounting date, not the invoice date. opw-1890240 closes odoo/odoo#29466 --- addons/l10n_be_intrastat/wizard/xml_decl.py | 4 ++-- addons/report_intrastat/report/report_intrastat_report.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/l10n_be_intrastat/wizard/xml_decl.py b/addons/l10n_be_intrastat/wizard/xml_decl.py index f5b9bdcf6b6..b7c6e04f713 100644 --- a/addons/l10n_be_intrastat/wizard/xml_decl.py +++ b/addons/l10n_be_intrastat/wizard/xml_decl.py @@ -155,8 +155,8 @@ class XmlDeclaration(models.TransientModel): OR (res_country.code is NULL AND countrypartner.code IS NOT NULL AND not countrypartner.code=%s)) AND inv.type IN (%s, %s) - AND to_char(inv.date_invoice, 'YYYY')=%s - AND to_char(inv.date_invoice, 'MM')=%s + AND to_char(COALESCE(inv.date, inv.date_invoice), 'YYYY')=%s + AND to_char(COALESCE(inv.date, inv.date_invoice), 'MM')=%s """ self.env.cr.execute(query, (company.id, company.partner_id.country_id.code, diff --git a/addons/report_intrastat/report/report_intrastat_report.py b/addons/report_intrastat/report/report_intrastat_report.py index 1ca5dfb4bec..518534d0a92 100644 --- a/addons/report_intrastat/report/report_intrastat_report.py +++ b/addons/report_intrastat/report/report_intrastat_report.py @@ -30,8 +30,8 @@ class ReportIntrastat(models.Model): self.env.cr.execute(""" create or replace view report_intrastat as ( select - to_char(inv.date_invoice, 'YYYY') as name, - to_char(inv.date_invoice, 'MM') as month, + to_char(coalesce(inv.date, inv.date_invoice), 'YYYY') as name, + to_char(coalesce(inv.date, inv.date_invoice), 'MM') as month, min(inv_line.id) as id, intrastat.id as intrastat_id, upper(inv_country.code) as code, @@ -71,5 +71,5 @@ class ReportIntrastat(models.Model): inv.state in ('open','paid') and inv_line.product_id is not null and inv_country.intrastat=true - group by to_char(inv.date_invoice, 'YYYY'), to_char(inv.date_invoice, 'MM'),intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id, inv.company_id + group by to_char(coalesce(inv.date, inv.date_invoice), 'YYYY'), to_char(coalesce(inv.date, inv.date_invoice), 'MM'),intrastat.id,inv.type,pt.intrastat_id, inv_country.code,inv.number, inv.currency_id, inv.company_id )""") From 6cd12694d86e52601d80cecfd605f9dc282a2c18 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Wed, 12 Dec 2018 14:01:49 +0000 Subject: [PATCH 04/54] [FIX] sale: prevent div by zero in sale.report Backporting the behavior of v12 from e8f01b94ce8f4aeed7e573821bcfd73d6c20024c OPW 1916964 closes odoo/odoo#29472 --- addons/sale/report/sale_report.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index 42c6953f4dc..c413faf86ac 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -56,10 +56,10 @@ class SaleReport(models.Model): sum(l.qty_delivered / u.factor * u2.factor) as qty_delivered, sum(l.qty_invoiced / u.factor * u2.factor) as qty_invoiced, sum(l.qty_to_invoice / u.factor * u2.factor) as qty_to_invoice, - sum(l.price_total / COALESCE(cr.rate, 1.0)) as price_total, - sum(l.price_subtotal / COALESCE(cr.rate, 1.0)) as price_subtotal, - sum(l.amt_to_invoice / COALESCE(cr.rate, 1.0)) as amt_to_invoice, - sum(l.amt_invoiced / COALESCE(cr.rate, 1.0)) as amt_invoiced, + sum(l.price_total / COALESCE(NULLIF(cr.rate, 0), 1.0)) as price_total, + sum(l.price_subtotal / COALESCE(NULLIF(cr.rate, 0), 1.0)) as price_subtotal, + sum(l.amt_to_invoice / COALESCE(NULLIF(cr.rate, 0), 1.0)) as amt_to_invoice, + sum(l.amt_invoiced / COALESCE(NULLIF(cr.rate, 0), 1.0)) as amt_invoiced, count(*) as nbr, s.name as name, s.date_order as date, From 6cb683ea94e71646a8ce8e1d1fe0034d576b1eff Mon Sep 17 00:00:00 2001 From: Cristina Martin Date: Wed, 12 Dec 2018 09:19:09 +0000 Subject: [PATCH 05/54] [FIX] website_sale: Remove pricelist on Sitemap.XML --- addons/website_sale/controllers/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 2525602d74e..37ddd182ca5 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -330,7 +330,7 @@ class WebsiteSale(http.Controller): } return request.render("website_sale.product", values) - @http.route(['/shop/change_pricelist/'], type='http', auth="public", website=True) + @http.route(['/shop/change_pricelist/'], type='http', auth="public", website=True, sitemap=False) def pricelist_change(self, pl_id, **post): if (pl_id.selectable or pl_id == request.env.user.partner_id.property_product_pricelist) \ and request.website.is_pricelist_available(pl_id.id): @@ -338,7 +338,7 @@ class WebsiteSale(http.Controller): request.website.sale_get_order(force_pricelist=pl_id.id) return request.redirect(request.httprequest.referrer or '/shop') - @http.route(['/shop/pricelist'], type='http', auth="public", website=True) + @http.route(['/shop/pricelist'], type='http', auth="public", website=True, sitemap=False) def pricelist(self, promo, **post): redirect = post.get('r', '/shop/cart') pricelist = request.env['product.pricelist'].sudo().search([('code', '=', promo)], limit=1) From e78af353fc71e3e4866e8798c549038631edc2e4 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Wed, 12 Dec 2018 16:02:25 +0000 Subject: [PATCH 06/54] [CLA] Include cristinamartinrod in CLA of Tecnativa closes odoo/odoo#29454 --- doc/cla/corporate/tecnativa.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/cla/corporate/tecnativa.md b/doc/cla/corporate/tecnativa.md index 72a73cbbe28..9f3601d16a0 100644 --- a/doc/cla/corporate/tecnativa.md +++ b/doc/cla/corporate/tecnativa.md @@ -20,3 +20,4 @@ Jairo Llopis jairo.llopis@tecnativa.com https://github.com/yajo Vicent Cubells vicent.cubells@tecnativa.com https://github.com/cubells Luis Montalba luis.montalba@tecnativa.com https://github.com/luismontalba David Vidal david.vidal@tecnativa.com https://github.com/chienandalu +Cristina Martín cristina.martin@tecnativa.com https://github.com/cristinamartinrod From 375c98ef1676303d59a1643baa33c8193dc6ad11 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 12 Dec 2018 17:04:27 +0000 Subject: [PATCH 07/54] [FIX] website_blog: fix select to comment before this commit, the selected text was no more quoted in the comment. This commit closes #29148 closes odoo/odoo#29486 --- addons/website_blog/static/src/js/contentshare.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_blog/static/src/js/contentshare.js b/addons/website_blog/static/src/js/contentshare.js index cfc02470f7f..944ff5c9afe 100644 --- a/addons/website_blog/static/src/js/contentshare.js +++ b/addons/website_blog/static/src/js/contentshare.js @@ -34,7 +34,7 @@ }, commentEdition : function(){ var positionComment = ($('#comments').position()).top-50; - $(".o_website_chatter_form textarea").val('"' + selected_text + '" ').focus(); + $(".o_portal_chatter_composer_form textarea").val('"' + selected_text + '" ').focus(); $('html, body').stop().animate({ 'scrollTop': positionComment }, 500, 'swing', function () { From 03771053047980500387a71a862af59faa4bbc39 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Wed, 12 Dec 2018 12:02:52 +0000 Subject: [PATCH 08/54] [FIX] base_address_extended: Street in readonly opw-1916148 The city, state and zip code are shown behind the street name and street number, and not in a new line. This only occurs in the read-only view. This was changed to use the field 'street', which is a text of the street name, number and door number in the street formatted in the format of the partner's country. This only for the read-only view, leaving the 3 fields separated for the edit. closes odoo/odoo#29467 --- .../views/base_address_extended.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/base_address_extended/views/base_address_extended.xml b/addons/base_address_extended/views/base_address_extended.xml index 6fc3d098868..7d2a7770ea9 100644 --- a/addons/base_address_extended/views/base_address_extended.xml +++ b/addons/base_address_extended/views/base_address_extended.xml @@ -19,13 +19,15 @@ - - -
-