From 60d46345444fcb268d1846d30963e63adcba98c0 Mon Sep 17 00:00:00 2001 From: jeffery chen fan Date: Tue, 18 Jul 2017 23:05:18 +0800 Subject: [PATCH 01/47] [FIX] sale: use date_order for pricelist selection The date of the sale order was ignored when selecting th eappropriate pricelist rule. Fixes #18303 Closes #18308 --- addons/sale/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 802457694f2..7b81e631213 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -792,7 +792,7 @@ class SaleOrderLine(models.Model): lang=self.order_id.partner_id.lang, partner=self.order_id.partner_id.id, quantity=self.product_uom_qty, - date_order=self.order_id.date_order, + date=self.order_id.date_order, pricelist=self.order_id.pricelist_id.id, uom=self.product_uom.id, fiscal_position=self.env.context.get('fiscal_position') From a03eb9a3e8f625fc2f68dad8e9ef653329fb568f Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 19 Jul 2017 16:16:16 +0200 Subject: [PATCH 02/47] [IMP] sale: add test on pricelist dates Commit 60d46345 fixed issue #18303 that was surprisingly unnoticed for two years Adding tests to make sure it does not happen again. --- addons/sale/tests/test_product_id_change.py | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/addons/sale/tests/test_product_id_change.py b/addons/sale/tests/test_product_id_change.py index ffac350cd5f..d7f8deacc33 100644 --- a/addons/sale/tests/test_product_id_change.py +++ b/addons/sale/tests/test_product_id_change.py @@ -64,3 +64,51 @@ class TestOnchangeProductId(TransactionCase): so_line = so.order_line[0] so_line.product_id_change() self.assertEquals(100, so_line.price_unit, "The included tax must be subtracted to the price") + + def test_pricelist_application(self): + """ Test different prices are correctly applied based on dates """ + support_product = self.env.ref('product.product_product_2') + support_product.list_price = 100 + partner = self.res_partner_model.create(dict(name="George")) + + christmas_pricelist = self.env['product.pricelist'].create({ + 'name': 'Christmas pricelist', + 'item_ids': [(0, 0, { + 'date_start': "2017-12-01", + 'date_end': "2017-12-24", + 'compute_price': 'percentage', + 'base': 'list_price', + 'percent_price': 20, + 'applied_on': '3_global', + 'name': 'Pre-Christmas discount' + }), (0, 0, { + 'date_start': "2017-12-25", + 'date_end': "2017-12-31", + 'compute_price': 'percentage', + 'base': 'list_price', + 'percent_price': 50, + 'applied_on': '3_global', + 'name': 'Post-Christmas super-discount' + })] + }) + + so = self.env['sale.order'].create({ + 'partner_id': partner.id, + 'date_order': '2017-12-20', + 'pricelist_id': christmas_pricelist.id, + }) + + order_line = self.env['sale.order.line'].new({ + 'order_id': so.id, + 'product_id': support_product.id, + }) + + # force compute uom and prices + order_line.product_id_change() + order_line.product_uom_change() + + self.assertEqual(order_line.price_unit, 80, "First date pricelist rule not applied") + + so.date_order = '2017-12-30' + order_line.product_id_change() + self.assertEqual(order_line.price_unit, 50, "Second date pricelist rule not applied") From f97861f4b14d1831fc25231fcd722ad64422a2e5 Mon Sep 17 00:00:00 2001 From: Khoi Nguyen Date: Thu, 20 Jul 2017 12:04:59 +0200 Subject: [PATCH 03/47] [FIX] web: fix colour for .o_form_uri Before this revision, multiline links in form views had a different colour depending on whether we were editing a record, or merely viewing it. As an example, the 'customer' field (containing both the name and the address) in the form view of 'invoice' is affected. When editing the invoice, all lines have @link-color as colour. However, when viewing it, only the first line does, while the address is in @odoo-main-text-color. --- addons/web/static/src/less/form_view.less | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/less/form_view.less b/addons/web/static/src/less/form_view.less index 34ce34e6ad8..c4990e6c824 100644 --- a/addons/web/static/src/less/form_view.less +++ b/addons/web/static/src/less/form_view.less @@ -86,18 +86,19 @@ display: inline-block; } - .o_form_uri { // FIXME maybe global? - display: inline-block; + } - color: @odoo-main-text-color; + .o_form_uri { + display: inline-block; + + color: @odoo-main-text-color; + &:first-line { + color: @link-color; + } + &:hover { + color: darken(@odoo-main-text-color, 1%); // hack required on chrome &:first-line { - color: @link-color; - } - &:hover { - color: darken(@odoo-main-text-color, 1%); // hack required on chrome - &:first-line { - color: darken(@link-color, 15%); - } + color: darken(@link-color, 15%); } } } From fdd90a8dd9bd69678b12be8913763c1cb93fba1f Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 20 Jul 2017 13:39:31 +0200 Subject: [PATCH 04/47] [FIX] sale_stock: _update_line_quantity rev 1168e73a72ad8824c64f308d38d263d7aba456de wrongly assumed that `message_post` is api multi --- addons/sale_stock/models/sale_order.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index 556c755cfe5..baa50a05ef0 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -253,6 +253,7 @@ class SaleOrderLine(models.Model): 'Create a return first.') for line in self: pickings = self.order_id.picking_ids.filtered(lambda p: p.state not in ('done', 'cancel')) - pickings.message_post("The quantity of %s has been updated from %d to %d in %s" % - (line.product_id.name, line.product_uom_qty, values['product_uom_qty'], self.order_id.name)) + for picking in pickings: + picking.message_post("The quantity of %s has been updated from %d to %d in %s" % + (line.product_id.name, line.product_uom_qty, values['product_uom_qty'], self.order_id.name)) super(SaleOrderLine, self)._update_line_quantity(values) From 54c73985d288c6e8fb9ce4ce491a6c5dcbe37862 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 20 Jul 2017 13:42:15 +0200 Subject: [PATCH 05/47] [FIX] sale_stock: wording on line edition --- addons/sale_stock/models/sale_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py index baa50a05ef0..fc5a51b6318 100644 --- a/addons/sale_stock/models/sale_order.py +++ b/addons/sale_stock/models/sale_order.py @@ -249,7 +249,7 @@ class SaleOrderLine(models.Model): def _update_line_quantity(self, values): if self.mapped('qty_delivered') and values['product_uom_qty'] < max(self.mapped('qty_delivered')): - raise UserError('You cannot decrease the ordered quantity below your delivered quantity.\n' + raise UserError('You cannot decrease the ordered quantity below the delivered quantity.\n' 'Create a return first.') for line in self: pickings = self.order_id.picking_ids.filtered(lambda p: p.state not in ('done', 'cancel')) From 7333f5e9b8ac8909af45def63002bd26a234e79d Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Thu, 20 Jul 2017 13:44:43 +0200 Subject: [PATCH 06/47] [FIX] purchase: Wrong scheduled date for backorder Steps to reproduce: -Create a PO with two lines L1 and L2 -L1 has product P with qty=10 for a scheduled date=23/07/2017 -L2 has product P with qty=10 for a scheduled date=30/07/2017 -Confirm the PO When delivering 5P of L1, the scheduled date of the picking is the right date which is 23/07/2017 But when delivering the other 5P of L1, the scheduled date of the second picking was 30/07/2017 instead of 23/07/2017. opw:752192 --- addons/purchase/purchase.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index aab374efd56..23f1f8bebef 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -357,6 +357,10 @@ class PurchaseOrder(models.Model): picking = self.env['stock.picking'].create(res) moves = order.order_line.filtered(lambda r: r.product_id.type in ['product', 'consu'])._create_stock_moves(picking) move_ids = moves.action_confirm() + seq = 0 + for move in moves: + seq += 5 + move.sequence = seq moves = self.env['stock.move'].browse(move_ids) moves.force_assign() return True From 7a1d2d1c4caebba5bd69d63cff3d7824dfd5a7a6 Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Wed, 14 Jun 2017 15:07:46 +0200 Subject: [PATCH 07/47] [FIX] *: reports: check required values for 'render_html' Some reports require additional information to render. When accessed in Odoo, the user has to fill a wizard to provide those information. However, when these reports were opened in Studio, it crashed as those information were missing (we don't pass through the configuration wizard in this case). This fix checks if all the required information are given before trying to render those reports, and it displays a warning in the logs in they are missing, which is better than a traceback. backported in v10 for opw-753036 --- addons/account/report/account_aged_partner_balance.py | 4 ++++ addons/account/report/account_balance.py | 4 ++++ addons/account/report/account_general_ledger.py | 4 ++++ addons/account/report/account_journal.py | 4 ++++ addons/account/report/account_partner_ledger.py | 4 ++++ addons/account/report/account_report_financial.py | 4 ++++ addons/hr_holidays/report/holidays_summary_report.py | 4 ++++ addons/hr_payroll/report/report_contribution_register.py | 4 ++++ .../report/report_hr_salary_employee_bymonth.py | 4 ++++ .../report/report_hr_yearly_salary_detail.py | 4 ++++ 10 files changed, 40 insertions(+) diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 88e4730c59c..b9bef25dfeb 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -2,6 +2,7 @@ import time from odoo import api, models, _ +from odoo.exceptions import UserError from odoo.tools import float_is_zero from datetime import datetime from dateutil.relativedelta import relativedelta @@ -196,6 +197,9 @@ class ReportAgedPartnerBalance(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + total = [] model = self.env.context.get('active_model') docs = self.env[model].browse(self.env.context.get('active_id')) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 5bdf40ae7b1..fccc60e7680 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -2,6 +2,7 @@ import time from odoo import api, models +from odoo.exceptions import UserError class ReportTrialBalance(models.AbstractModel): @@ -59,6 +60,9 @@ class ReportTrialBalance(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form') or not self.env.context.get('active_model'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + self.model = self.env.context.get('active_model') docs = self.env[self.model].browse(self.env.context.get('active_ids', [])) display_account = data['form'].get('display_account') diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index d3b871f24b8..f7ebf8ad451 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -2,6 +2,7 @@ import time from odoo import api, models +from odoo.exceptions import UserError class ReportGeneralLedger(models.AbstractModel): @@ -109,6 +110,9 @@ class ReportGeneralLedger(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form') or not self.env.context.get('active_model'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + self.model = self.env.context.get('active_model') docs = self.env[self.model].browse(self.env.context.get('active_ids', [])) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index d134891eb75..9dfa7807f48 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -2,6 +2,7 @@ import time from odoo import api, models +from odoo.exceptions import UserError class ReportJournal(models.AbstractModel): @@ -95,6 +96,9 @@ class ReportJournal(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + target_move = data['form'].get('target_move', 'all') sort_selection = data['form'].get('sort_selection', 'date') diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index ba2503d41a9..94d12a7bd3a 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -3,6 +3,7 @@ from datetime import datetime import time from odoo import api, models +from odoo.exceptions import UserError from odoo.tools import DEFAULT_SERVER_DATE_FORMAT @@ -69,6 +70,9 @@ class ReportPartnerLedger(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + data['computed'] = {} obj_partner = self.env['res.partner'] diff --git a/addons/account/report/account_report_financial.py b/addons/account/report/account_report_financial.py index abb50715ac5..4aacdf68108 100644 --- a/addons/account/report/account_report_financial.py +++ b/addons/account/report/account_report_financial.py @@ -2,6 +2,7 @@ import time from odoo import api, models +from odoo.exceptions import UserError class ReportFinancial(models.AbstractModel): @@ -144,6 +145,9 @@ class ReportFinancial(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + self.model = self.env.context.get('active_model') docs = self.env[self.model].browse(self.env.context.get('active_id')) report_lines = self.get_account_lines(data.get('form')) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index 7d58e6bfbca..1428562ed62 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -4,6 +4,7 @@ from datetime import timedelta from dateutil.relativedelta import relativedelta from odoo import api, fields, models +from odoo.exceptions import UserError class HrHolidaySummaryReport(models.AbstractModel): @@ -102,6 +103,9 @@ class HrHolidaySummaryReport(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + Report = self.env['report'] holidays_report = Report._get_report_from_name('hr_holidays.report_holidayssummary') holidays = self.env['hr.holidays'].browse(self.ids) diff --git a/addons/hr_payroll/report/report_contribution_register.py b/addons/hr_payroll/report/report_contribution_register.py index ebfc969c1fd..c56918c88be 100644 --- a/addons/hr_payroll/report/report_contribution_register.py +++ b/addons/hr_payroll/report/report_contribution_register.py @@ -6,6 +6,7 @@ from datetime import datetime from dateutil.relativedelta import relativedelta from odoo import api, fields, models +from odoo.exceptions import UserError class ContributionRegisterReport(models.AbstractModel): @@ -29,6 +30,9 @@ class ContributionRegisterReport(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + register_ids = self.env.context.get('active_ids', []) contrib_registers = self.env['hr.contribution.register'].browse(register_ids) date_from = data['form'].get('date_from', fields.Date.today()) diff --git a/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py index 3ff69127d5c..1cc67073146 100644 --- a/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py +++ b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py @@ -4,6 +4,7 @@ from datetime import date from odoo import api, models +from odoo.exceptions import UserError class ReportHrSalaryEmployeeBymonth(models.AbstractModel): @@ -93,6 +94,9 @@ class ReportHrSalaryEmployeeBymonth(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + model = self.env.context.get('active_model') docs = self.env[model].browse(self.env.context.get('active_id')) get_periods, months, total_mnths = self.get_periods(data['form']) diff --git a/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py index 57a74787f5d..bb6e2c75423 100644 --- a/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py +++ b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py @@ -4,6 +4,7 @@ from datetime import date from odoo import api, models +from odoo.exceptions import UserError class EmployeesYearlySalaryReport(models.AbstractModel): @@ -127,6 +128,9 @@ class EmployeesYearlySalaryReport(models.AbstractModel): @api.model def render_html(self, docids, data=None): + if not self.env.context.get('active_model') or not self.env.context.get('active_id'): + raise UserError(_("Some data are missing, this report cannot be printed.")) + model = self.env.context.get('active_model') docs = self.env[model].browse(self.env.context.get('active_id')) docargs = { From bbc009597401f155d475769b62dfa99d7b9c970c Mon Sep 17 00:00:00 2001 From: Elkasitu Date: Thu, 20 Jul 2017 12:25:28 +0200 Subject: [PATCH 08/47] [FIX] web: Save search bar state to local storage The state of the search bar (expanded or not) is supposed to be saved into a local storage variable which is retrieved whenever loading a view that has the search bar in it and it is expanded automatically if it was done previously in any other view, this didn't happen previous to this commit because the variable wasn't being set properly (missing key). --- addons/web/static/src/js/chrome/search_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/chrome/search_view.js b/addons/web/static/src/js/chrome/search_view.js index 26305817e55..6c3adcafcca 100644 --- a/addons/web/static/src/js/chrome/search_view.js +++ b/addons/web/static/src/js/chrome/search_view.js @@ -232,7 +232,7 @@ var SearchView = Widget.extend({ 'click .o_searchview_more': function (e) { $(e.target).toggleClass('fa-search-plus fa-search-minus'); var visibleSearchMenu = this.call('local_storage', 'getItem', 'visible_search_menu'); - this.call('local_storage', 'setItem', visibleSearchMenu !== 'true'); + this.call('local_storage', 'setItem', 'visible_search_menu', visibleSearchMenu !== 'true'); this.toggle_buttons(); }, 'keydown .o_searchview_input, .o_searchview_facet': function (e) { From 666b59484201004e2cd8890a9c09b6dcf023a725 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 20 Jul 2017 15:05:36 +0200 Subject: [PATCH 09/47] [FIX] mail: send image with base64 src as attachment Before this fix, the base64 image are remove and never send. The images were in the body increasing the size of the database unnecessarily (cfr some odoo users with the chatter) NB: According to the prophecy Khoi will come and dominate the world, ask him anything --- addons/mail/models/mail_message.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/addons/mail/models/mail_message.py b/addons/mail/models/mail_message.py index ac2183d767a..5bc4678848d 100644 --- a/addons/mail/models/mail_message.py +++ b/addons/mail/models/mail_message.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. import logging +import re from email.utils import formataddr @@ -11,6 +12,7 @@ from odoo.osv import expression _logger = logging.getLogger(__name__) +_image_dataurl = re.compile(r'(data:image/[a-z]+?);base64,([a-z0-9+/]{3,}=*)([\'"])', re.I) class Message(models.Model): @@ -721,6 +723,28 @@ class Message(models.Model): if 'record_name' not in values and 'default_record_name' not in self.env.context: values['record_name'] = self._get_record_name(values) + if 'attachment_ids' not in values: + values.setdefault('attachment_ids', []) + + # extract base64 images + if 'body' in values: + Attachments = self.env['ir.attachment'] + data_to_url = {} + def base64_to_boundary(match): + key = match.group(2) + if not data_to_url.get(key): + name = 'image%s' % len(data_to_url) + attachment = Attachments.create({ + 'name': name, + 'datas': match.group(2), + 'datas_fname': name, + 'res_model': 'mail.message', + }) + values['attachment_ids'].append((4, attachment.id)) + data_to_url[key] = '/web/image/%s' % attachment.id + return '%s%s alt="%s"' % (data_to_url[key], match.group(3), name) + values['body'] = _image_dataurl.sub(base64_to_boundary, values['body']) + message = super(Message, self).create(values) message._invalidate_documents() From df135166799ccafd49c2aa684bb0ff845af31b09 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 20 Jul 2017 16:26:12 +0200 Subject: [PATCH 10/47] [FIX] report*: fix missing import from backport #7a1d2d1c4caebba5bd69d63cff3d7824dfd5a7a6 --- addons/account/report/account_aged_partner_balance.py | 2 +- addons/account/report/account_balance.py | 4 ++-- addons/account/report/account_general_ledger.py | 4 ++-- addons/account/report/account_journal.py | 4 ++-- addons/account/report/account_partner_ledger.py | 4 ++-- addons/account/report/account_report_financial.py | 4 ++-- addons/hr_holidays/report/holidays_summary_report.py | 4 ++-- addons/hr_payroll/report/report_contribution_register.py | 4 ++-- .../report/report_hr_salary_employee_bymonth.py | 4 ++-- .../report/report_hr_yearly_salary_detail.py | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index b9bef25dfeb..0128c6c8b35 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -198,7 +198,7 @@ class ReportAgedPartnerBalance(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) total = [] model = self.env.context.get('active_model') diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index fccc60e7680..61ece9107d4 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from odoo import api, models +from odoo import api, models, _ from odoo.exceptions import UserError @@ -61,7 +61,7 @@ class ReportTrialBalance(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form') or not self.env.context.get('active_model'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) self.model = self.env.context.get('active_model') docs = self.env[self.model].browse(self.env.context.get('active_ids', [])) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index f7ebf8ad451..7f58736d889 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from odoo import api, models +from odoo import api, models, _ from odoo.exceptions import UserError @@ -111,7 +111,7 @@ class ReportGeneralLedger(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form') or not self.env.context.get('active_model'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) self.model = self.env.context.get('active_model') docs = self.env[self.model].browse(self.env.context.get('active_ids', [])) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 9dfa7807f48..83b95bccb9f 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from odoo import api, models +from odoo import api, models, _ from odoo.exceptions import UserError @@ -97,7 +97,7 @@ class ReportJournal(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) target_move = data['form'].get('target_move', 'all') sort_selection = data['form'].get('sort_selection', 'date') diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 94d12a7bd3a..9ca5875ffa4 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -2,7 +2,7 @@ from datetime import datetime import time -from odoo import api, models +from odoo import api, models, _ from odoo.exceptions import UserError from odoo.tools import DEFAULT_SERVER_DATE_FORMAT @@ -71,7 +71,7 @@ class ReportPartnerLedger(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) data['computed'] = {} diff --git a/addons/account/report/account_report_financial.py b/addons/account/report/account_report_financial.py index 4aacdf68108..56cafdeb3cb 100644 --- a/addons/account/report/account_report_financial.py +++ b/addons/account/report/account_report_financial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import time -from odoo import api, models +from odoo import api, models, _ from odoo.exceptions import UserError @@ -146,7 +146,7 @@ class ReportFinancial(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) self.model = self.env.context.get('active_model') docs = self.env[self.model].browse(self.env.context.get('active_id')) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index 1428562ed62..0118429725f 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -3,7 +3,7 @@ from datetime import timedelta from dateutil.relativedelta import relativedelta -from odoo import api, fields, models +from odoo import api, fields, models, _ from odoo.exceptions import UserError @@ -104,7 +104,7 @@ class HrHolidaySummaryReport(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) Report = self.env['report'] holidays_report = Report._get_report_from_name('hr_holidays.report_holidayssummary') diff --git a/addons/hr_payroll/report/report_contribution_register.py b/addons/hr_payroll/report/report_contribution_register.py index c56918c88be..d1cc532cf62 100644 --- a/addons/hr_payroll/report/report_contribution_register.py +++ b/addons/hr_payroll/report/report_contribution_register.py @@ -5,7 +5,7 @@ from datetime import datetime from dateutil.relativedelta import relativedelta -from odoo import api, fields, models +from odoo import api, fields, models, _ from odoo.exceptions import UserError @@ -31,7 +31,7 @@ class ContributionRegisterReport(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) register_ids = self.env.context.get('active_ids', []) contrib_registers = self.env['hr.contribution.register'].browse(register_ids) diff --git a/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py index 1cc67073146..5ece594f908 100644 --- a/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py +++ b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py @@ -3,7 +3,7 @@ from datetime import date -from odoo import api, models +from odoo import api, models, _ from odoo.exceptions import UserError @@ -95,7 +95,7 @@ class ReportHrSalaryEmployeeBymonth(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not data.get('form') or not self.env.context.get('active_model') or not self.env.context.get('active_id'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) model = self.env.context.get('active_model') docs = self.env[model].browse(self.env.context.get('active_id')) diff --git a/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py index bb6e2c75423..82f262c8d1f 100644 --- a/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py +++ b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py @@ -3,7 +3,7 @@ from datetime import date -from odoo import api, models +from odoo import api, models, _ from odoo.exceptions import UserError @@ -129,7 +129,7 @@ class EmployeesYearlySalaryReport(models.AbstractModel): @api.model def render_html(self, docids, data=None): if not self.env.context.get('active_model') or not self.env.context.get('active_id'): - raise UserError(_("Some data are missing, this report cannot be printed.")) + raise UserError(_("Form content is missing, this report cannot be printed.")) model = self.env.context.get('active_model') docs = self.env[model].browse(self.env.context.get('active_id')) From 75fe7cb1af8c3a2098084e088f9e740e41a6d53f Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Thu, 20 Jul 2017 11:53:20 +0200 Subject: [PATCH 11/47] [FIX] website_portal_sale: remove incorrect field dependency The field 'payment_acquirer_id' is added on the sale.order model in the website_sale module, which may not be installed when this code runs since it is higher up in the dependency tree. Either way, it's quite convoluted to go fetch the acquirer on the quote since it's already available on the transaction itself anyway. opw-755998 --- addons/website_portal_sale/models/payment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_portal_sale/models/payment.py b/addons/website_portal_sale/models/payment.py index ae47e6551c3..1005250807f 100644 --- a/addons/website_portal_sale/models/payment.py +++ b/addons/website_portal_sale/models/payment.py @@ -66,7 +66,7 @@ class PaymentTransaction(models.Model): amount_matches = float_compare(tx.amount, tx.sale_order_id.amount_total, 2) == 0 if amount_matches: if not acquirer_name: - acquirer_name = tx.sale_order_id.payment_acquirer_id.provider or 'unknown' + acquirer_name = tx.acquirer_id.provider or 'unknown' if tx.state == 'authorized' and tx.acquirer_id.auto_confirm == 'authorize': _logger.info('<%s> transaction authorized, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id) tx.sale_order_id.with_context(send_email=True).action_confirm() From a47d2d88d028d5a959650c9c8f62809340179fda Mon Sep 17 00:00:00 2001 From: Adrien Dieudonne Date: Wed, 19 Jul 2017 15:21:59 +0200 Subject: [PATCH 12/47] [FIX] *: wrong `color_field` attribute for m2m_tags This fix previous commit a29f7f671b. (1) Some objects have no color field. (2) There was an issue when two many2many tags were instantiated: If the first one had the 'color_field' attribute the second one had it too even if this attribute weren't specified. Now, it's fixed in data_manager --- addons/account/views/account_invoice_view.xml | 4 ++-- addons/account/views/account_view.xml | 8 +++---- addons/account/views/product_view.xml | 4 ++-- .../views/account_voucher_views.xml | 4 ++-- addons/delivery/views/delivery_view.xml | 4 ++-- addons/hr_expense/views/hr_expense_views.xml | 4 ++-- .../mass_mailing/views/mass_mailing_views.xml | 2 +- addons/membership/views/product_views.xml | 2 +- addons/mrp/views/mrp_bom_views.xml | 2 +- addons/mrp_repair/views/mrp_repair_views.xml | 8 +++---- addons/point_of_sale/views/pos_order_view.xml | 8 +++---- addons/purchase/views/purchase_views.xml | 6 ++--- addons/sale/views/sale_views.xml | 4 ++-- addons/stock/views/product_views.xml | 2 +- .../static/src/js/services/data_manager.js | 2 +- .../tests/fields/relational_fields_tests.js | 22 ++++++++++++++----- .../views/res_partner_views.xml | 2 +- 17 files changed, 50 insertions(+), 38 deletions(-) diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml index d22030ce7c4..2160872d84a 100644 --- a/addons/account/views/account_invoice_view.xml +++ b/addons/account/views/account_invoice_view.xml @@ -273,7 +273,7 @@ - @@ -409,7 +409,7 @@ - diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml index 8a23e35a578..134ce6f5e04 100644 --- a/addons/account/views/account_view.xml +++ b/addons/account/views/account_view.xml @@ -261,8 +261,8 @@
Keep empty for no control
- - + +
@@ -1892,8 +1892,8 @@ - - + + diff --git a/addons/account/views/product_view.xml b/addons/account/views/product_view.xml index 6543d318260..5dc56426ed3 100644 --- a/addons/account/views/product_view.xml +++ b/addons/account/views/product_view.xml @@ -14,13 +14,13 @@ - + - +
diff --git a/addons/account_voucher/views/account_voucher_views.xml b/addons/account_voucher/views/account_voucher_views.xml index ea279a24be2..ced7d16a4ef 100644 --- a/addons/account_voucher/views/account_voucher_views.xml +++ b/addons/account_voucher/views/account_voucher_views.xml @@ -253,7 +253,7 @@ - + @@ -369,7 +369,7 @@ - + diff --git a/addons/delivery/views/delivery_view.xml b/addons/delivery/views/delivery_view.xml index 2bc610a97e8..0148319cb26 100644 --- a/addons/delivery/views/delivery_view.xml +++ b/addons/delivery/views/delivery_view.xml @@ -107,8 +107,8 @@ - - + + diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml index 7ede7d1efb7..baa339238a2 100644 --- a/addons/hr_expense/views/hr_expense_views.xml +++ b/addons/hr_expense/views/hr_expense_views.xml @@ -299,7 +299,7 @@ - + @@ -464,7 +464,7 @@