From 13a3e76a48be833a681863e3982c11a47fd40863 Mon Sep 17 00:00:00 2001 From: "Yenthe V.G" Date: Wed, 31 May 2017 09:40:32 +0200 Subject: [PATCH 1/5] [FIX] web_planner: remove second URL reference Introduced at 77e18a48 Closes #17327 --- addons/account/views/web_planner_data.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/views/web_planner_data.xml b/addons/account/views/web_planner_data.xml index 99f3cb86e52..5c05c2c2f43 100644 --- a/addons/account/views/web_planner_data.xml +++ b/addons/account/views/web_planner_data.xml @@ -199,7 +199,7 @@

From 6331cd1ff5cdabc92a7ae1e11f2096a8889bae34 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 14 Jul 2017 15:27:48 +0200 Subject: [PATCH 2/5] [FIX] base: QWeb monetary format - Set the currency precision to 0.05 - Print any QWeb report displaying amounts, e.g. the GL The amounts are displayed with 1 digit precision instead of 2. The formula used to compute the decimal places is actually wrong. The correct one can be found in method `_decimal_places`. Anyway, we can use directly the field. opw-752283 --- openerp/addons/base/ir/ir_qweb.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_qweb.py b/openerp/addons/base/ir/ir_qweb.py index ea996769f88..5af09a6b9e1 100644 --- a/openerp/addons/base/ir/ir_qweb.py +++ b/openerp/addons/base/ir/ir_qweb.py @@ -1051,8 +1051,7 @@ class QwebWidgetMonetary(osv.AbstractModel): def _format(self, inner, options, qwebcontext): inner = self.pool['ir.qweb'].eval(inner, qwebcontext) display = self.pool['ir.qweb'].eval_object(options['display_currency'], qwebcontext) - precision = int(round(math.log10(display.rounding))) - fmt = "%.{0}f".format(-precision if precision < 0 else 0) + fmt = "%.{0}f".format(display.decimal_places) lang_code = qwebcontext.context.get('lang') or 'en_US' formatted_amount = self.pool['res.lang'].format( qwebcontext.cr, qwebcontext.uid, [lang_code], fmt, inner, grouping=True, monetary=True From fea5057425ede4d92d0c74717cb9d9d6cc708fae Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 13 Jul 2017 13:50:38 +0200 Subject: [PATCH 3/5] [FIX] account: Unlinking payment term When unlinking payment terms, the ir.property records linked to the fields "property_payment_term_id" and "property_supplier_payment_term_id" were not deleted. opw:749459 --- addons/account/models/account_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index 0e1c1b30dab..122d04a45ec 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -1397,6 +1397,12 @@ class AccountPaymentTerm(models.Model): result.append((last_date, dist)) return result + @api.multi + def unlink(self): + property_recs = self.env['ir.property'].search([('value_reference', 'in', ['account.payment.term,%s'%payment_term.id for payment_term in self])]) + property_recs.unlink() + return super(AccountPaymentTerm, self).unlink() + class AccountPaymentTermLine(models.Model): _name = "account.payment.term.line" From 274432ecac40d9b5efc2d6f9ad5745c0e0a6dc78 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Tue, 30 May 2017 16:15:10 +0200 Subject: [PATCH 4/5] [FIX] stock: force orderpoint deactivation Deactivating product should not be working when you still have active orderpoints. Closes #16954 --- addons/stock/i18n/stock.pot | 6 ++++++ addons/stock/product.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/addons/stock/i18n/stock.pot b/addons/stock/i18n/stock.pot index e223e20044d..650da0cf166 100644 --- a/addons/stock/i18n/stock.pot +++ b/addons/stock/i18n/stock.pot @@ -6427,6 +6427,12 @@ msgstr "" msgid "You should provide a different serial number for each piece" msgstr "" +#. module: stock +#: code:addons/stock/product.py:349 +#, python-format +msgid "You still have some active reordering rules on this product. Please archive or delete them first." +msgstr "" + #. module: stock #: constraint:stock.move:0 msgid "You try to move a product using a UoM that is not compatible with the UoM of the product moved. Please use an UoM in the same UoM category." diff --git a/addons/stock/product.py b/addons/stock/product.py index 1f8d034f6c6..726a5ebdd15 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -342,6 +342,13 @@ class product_product(osv.osv): }} return {} + def write(self, cr, uid, ids, vals, context=None): + res = super(product_product, self).write(cr, uid, ids, vals, context=context) + products = self.pool['product.product'].browse(cr, uid, ids, context=context) + if 'active' in vals and not vals['active'] and products.mapped('orderpoint_ids').filtered(lambda r: r.active): + raise UserError(_('You still have some active reordering rules on this product. Please archive or delete them first.')) + return res + class product_template(osv.osv): _name = 'product.template' From 3228694bddff75a9c04504f09b6da56c5f5a5647 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 18 Jul 2017 18:36:21 +0200 Subject: [PATCH 5/5] [FIX] mass_mailing: only track shorten links It may happen that some mails attached to a mailing contains non shorten links. --- addons/mass_mailing/models/mass_mailing.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index 5c8d84f76a4..10fd678db20 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -4,6 +4,7 @@ from datetime import datetime from dateutil import relativedelta import random import re +from urlparse import urlparse from openerp import tools from openerp import models, api, _ @@ -871,16 +872,13 @@ class MailMail(models.Model): @api.model def send_get_mail_body(self, mail, partner=None): """Override to add Statistic_id in shorted urls """ - - links_blacklist = ['/unsubscribe_from_list'] - if mail.mailing_id and mail.body_html and mail.statistics_ids: for match in re.findall(URL_REGEX, mail.body_html): - href = match[0] url = match[1] - - if not [s for s in links_blacklist if s in href]: + parsed = urlparse(url, scheme='http') + + if parsed.scheme.startswith('http') and parsed.path.startswith('/r/'): new_href = href.replace(url, url + '/m/' + str(mail.statistics_ids[0].id)) mail.body_html = mail.body_html.replace(href, new_href)