From ecaf5f66e1aefd9f80a8f335f458de7aa3321ac2 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 26 Dec 2017 13:27:24 +0100 Subject: [PATCH 01/73] [FIX] stock: wrong company when creating a route Routes created when creating companie were not set to the correct company. Steps to reproduce: - Go to Settings > General settings: Activate Manage Multiple companies. - Go in Inventory > Configuration>Settings: Click "Manage several Warehouses, each one composed by several stock location". Click "Advanced routing of products using rules". - Go in Settings > Users > Companies: Create new companie "ThisNewCompanie" - Go in Inventory > Configuration>Routes: Open Routes named ThisNewCompanie. Bug: All the routes created automatically by creating the company "ThisNewCompanie" are not set to the company "ThisNewCompanie". They are set to the company of the logged user when "ThisNewCompanie" was created opw:787229 --- addons/stock/models/stock_warehouse.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index b112d11567b..b132083138e 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -427,6 +427,7 @@ class Warehouse(models.Model): self.Routing(warehouse.lot_stock_id, warehouse.wh_pack_stock_loc_id, warehouse.pick_type_id), self.Routing(warehouse.wh_pack_stock_loc_id, warehouse.wh_output_stock_loc_id, warehouse.pack_type_id), self.Routing(warehouse.wh_output_stock_loc_id, customer_loc, warehouse.out_type_id)], + 'company_id': warehouse.company_id.id, }) for warehouse in self) @api.multi @@ -436,6 +437,7 @@ class Warehouse(models.Model): 'product_categ_selectable': True, 'product_selectable': False, 'sequence': 10, + 'company_id': self.company_id.id, } @api.model @@ -455,7 +457,8 @@ class Warehouse(models.Model): 'product_selectable': True, 'product_categ_selectable': True, 'supplied_wh_id': self.id, - 'supplier_wh_id': supplier_warehouse.id} + 'supplier_wh_id': supplier_warehouse.id, + 'company_id': self.company_id.id} def _get_inter_wh_route(self, supplier_warehouse): # FIXME - remove me in master/saas-14 @@ -469,7 +472,8 @@ class Warehouse(models.Model): 'product_selectable': True, 'product_categ_selectable': True, 'active': self.delivery_steps != 'ship_only' and self.reception_steps != 'one_step', - 'sequence': 20} + 'sequence': 20, + 'company_id': self.company_id.id} def _get_crossdock_route(self, route_name): # FIXME - remove me in master/saas-14 From 36e7847e20b35d3a9f3f965001cab5d2c2d8e896 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 2 Jan 2018 15:55:33 +0100 Subject: [PATCH 02/73] [FIX] website_quote: Adding a suggested product in a SO When adding a suggested product which already exists in the SO, it crashed due to a programming error. opw:801047 --- addons/website_quote/models/sale_order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website_quote/models/sale_order.py b/addons/website_quote/models/sale_order.py index 8098061b510..88a2015566a 100644 --- a/addons/website_quote/models/sale_order.py +++ b/addons/website_quote/models/sale_order.py @@ -252,7 +252,8 @@ class SaleOrderOption(models.Model): order_line = order.order_line.filtered(lambda line: line.product_id == self.product_id) if order_line: - order_line[0].product_uom_qty += 1 + order_line = order_line[0] + order_line.product_uom_qty += 1 else: vals = { 'price_unit': self.price_unit, From 0e943241fe2408830b9c06c1875a29f96ebe6c48 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 2 Jan 2018 14:32:06 +0100 Subject: [PATCH 03/73] [FIX] web: rotate graph label When there are too many labels to display on the x-axis, they overlap and it simply becomes unreadable. By slightly rotating them, this can be avoided in most cases. Back-port of this commit 388e258ce8c2a4fbd5e2ec5ec746bb91ca48d97f opw:802925 --- addons/web/static/src/js/views/graph_widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views/graph_widget.js b/addons/web/static/src/js/views/graph_widget.js index 0af4ea9f362..a8994880e70 100644 --- a/addons/web/static/src/js/views/graph_widget.js +++ b/addons/web/static/src/js/views/graph_widget.js @@ -168,7 +168,7 @@ return Widget.extend({ var chart = nv.models.multiBarChart(); var maxVal = _.max(values, function(v) {return v.y}) chart.options({ - margin: {left: 12 * String(maxVal && maxVal.y || 10000000).length}, + margin: {left: 12 * String(maxVal && maxVal.y || 10000000).length, bottom: 60}, delay: 250, transition: 10, showLegend: _.size(data) <= MAX_LEGEND_LENGTH, @@ -177,7 +177,7 @@ return Widget.extend({ rightAlignYAxis: false, stacked: this.stacked, reduceXTicks: false, - // rotateLabels: 40, + rotateLabels: -20, showControls: (this.groupbys.length > 1) }); chart.yAxis.tickFormat(function(d) { return formats.format_value(d, { type : 'float' });}); From 29af3c0610a90fe7172244883eba291a27d734e9 Mon Sep 17 00:00:00 2001 From: Yannick Tivisse Date: Wed, 3 Jan 2018 11:39:51 +0100 Subject: [PATCH 04/73] [FIX] l10n_be_hr_payroll: Consider widows/divorced as isolated people Purpose ======= Currently, only single people are considered as isolated people. Specification ============= Widows and divorced people should also be considered as isolated people. --- addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml b/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml index e9ebc62f5c7..d631572b965 100644 --- a/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml +++ b/addons/l10n_be_hr_payroll/data/l10n_be_hr_payroll_data.xml @@ -160,7 +160,7 @@ elif salary <= 2461.27: 165 python - result = (((employee.marital=='single') or (employee.marital=='married' and employee.spouse_fiscal_status=='without income')) and (employee.resident_bool!=True)) + result = (((employee.marital in ['divorced', 'single', 'widower']) or (employee.marital=='married' and employee.spouse_fiscal_status=='without income')) and (employee.resident_bool!=True)) code wage = categories.BASIC @@ -208,7 +208,7 @@ else: 120 python - result = (((employee.marital=='single') or (employee.marital=='married' and employee.spouse_fiscal_status=='with income')) and (employee.resident_bool!=True)) + result = (((employee.marital in ['divorced', 'single', 'widower']) or (employee.marital=='married' and employee.spouse_fiscal_status=='with income')) and (employee.resident_bool!=True)) @@ -318,7 +318,7 @@ elif salary <= 2461.27: Red.Iso 144 python - result = (employee.marital == 'single') and (categories.PP + categories.PPRed + categories.FamRed + categories.ChA < 0.0) + result = (employee.marital in ['divorced', 'single', 'widower']) and (categories.PP + categories.PPRed + categories.FamRed + categories.ChA < 0.0) code result = min(25.00, - (categories.PP + categories.PPRed + categories.FamRed + categories.ChA)) From ad2d34cf33f8c7ef0e8a04642ccc8f3dffe727b9 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Thu, 7 Sep 2017 22:30:04 -0500 Subject: [PATCH 05/73] [FIX] account: ensure chart template translation in company's lang Before this commit, in the event that the admin user has set the language to english, but the COA's target company had a different language, the admin user's language had been taken instead of the copany's one for the translation of journals and other coa intialization stuff. This is wrong as the CoA is more connected to the company, than to the user, which could be a functional support user that just happens to prefer the english version over the local one. Now, we ensure in two neuralgic places, that the company's language is passed to the context and therefore picked up by the translation's GetTextAlias. Signed-off-by: David Arnold --- addons/account/models/chart_template.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py index d205afd8e24..ffae12f070c 100644 --- a/addons/account/models/chart_template.py +++ b/addons/account/models/chart_template.py @@ -283,7 +283,8 @@ class AccountChartTemplate(models.Model): tmp1, tmp2 = self.parent_id._install_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, acc_ref=acc_ref, taxes_ref=taxes_ref) acc_ref.update(tmp1) taxes_ref.update(tmp2) - tmp1, tmp2 = self._load_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, account_ref=acc_ref, taxes_ref=taxes_ref) + # Ensure, even if individually, that everything is translated according to the company's language. + tmp1, tmp2 = self.with_context(lang=company.partner_id.lang)._load_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, account_ref=acc_ref, taxes_ref=taxes_ref) acc_ref.update(tmp1) taxes_ref.update(tmp2) return acc_ref, taxes_ref @@ -793,6 +794,8 @@ class WizardMultiChartsAccounts(models.TransientModel): all the provided information to create the accounts, the banks, the journals, the taxes, the accounting properties... accordingly for the chosen company. ''' + # Ensure everything is translated consitingly to the company's language, not the user's one. + self = self.with_context(lang=self.company_id.partner_id.lang) if len(self.env['account.account'].search([('company_id', '=', self.company_id.id)])) > 0: # We are in a case where we already have some accounts existing, meaning that user has probably # created its own accounts and does not need a coa, so skip installation of coa. From bb10cd50c28f224146634365ac341de6e09644d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Sun, 31 Dec 2017 15:43:49 +0100 Subject: [PATCH 06/73] [FIX] web: issue with id field in x2m form When the 'id' field is present in a x2m form, the x2m actions generated on create of the parent object are incorrect. --- .../static/src/js/views/basic/basic_model.js | 6 ++-- .../tests/fields/relational_fields_tests.js | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 1562bffdc42..2baafc52514 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -95,11 +95,13 @@ var x2ManyCommands = { // (0, _, {values}) CREATE: 0, create: function (values) { + delete values.id; return [x2ManyCommands.CREATE, false, values]; }, // (1, id, {values}) UPDATE: 1, update: function (id, values) { + delete values.id; return [x2ManyCommands.UPDATE, id, values]; }, // (2, id[, _]) @@ -2625,7 +2627,6 @@ var BasicModel = AbstractModel.extend({ _.each(relRecordUpdated, function (relRecord) { var changes = self._generateChanges(relRecord, options); if (!_.isEmpty(changes)) { - delete changes.id; var command = x2ManyCommands.update(relRecord.res_id, changes); commands[fieldName].push(command); } @@ -2645,7 +2646,6 @@ var BasicModel = AbstractModel.extend({ relRecord = _.findWhere(relRecordUpdated, {res_id: list.res_ids[i]}); changes = relRecord ? this._generateChanges(relRecord, options) : {}; if (!_.isEmpty(changes)) { - delete changes.id; command = x2ManyCommands.update(relRecord.res_id, changes); didChange = true; } else { @@ -2656,7 +2656,7 @@ var BasicModel = AbstractModel.extend({ // this is a new id (maybe existing in DB, but new in JS) relRecord = _.findWhere(relRecordAdded, {res_id: list.res_ids[i]}); changes = this._generateChanges(relRecord, options); - if ('id' in changes) { + if (changes.id) { // the subrecord already exists in db delete changes.id; if (this.isNew(record.id)) { diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index 757c4c20278..88db9166bdb 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -4832,6 +4832,37 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('id field in one2many in a new record', function (assert) { + assert.expect(1); + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '
' + + '' + + '' + + '' + + '' + + '' + + '' + + '
', + mockRPC: function (route, args) { + if (args.method === 'create') { + assert.deepEqual(args.args[0].turtles, + [[0, false, {turtle_foo: "cat"}]], + 'should send proper commands'); + } + return this._super.apply(this, arguments); + }, + }); + form.$('td.o_field_x2many_list_row_add a').click(); + form.$('td input[name="turtle_foo"]').val('cat').trigger('input'); + form.$buttons.find('.o_form_button_save').click(); + + form.destroy(); + }); + QUnit.test('sub form view with a required field', function (assert) { assert.expect(2); this.data.partner.fields.foo.required = true; From 9f583717e574795f8bd241fea44bad1a59253a66 Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Wed, 3 Jan 2018 13:53:44 +0000 Subject: [PATCH 07/73] [FIX] website: unlink website_id (#21972) In the module website, the relational field website_id is defined twice, once for ir_ui_view and a second time for res_config_settings, for the former we perform an ondelete='cascade', which means that when the website model is unlinked, the field is unlinked as well. This is not done for the website_id field in res_config_settings, which instead defaults to setting the field to NULL, which violates a not-null constraint and therefore causes issues when trying to modify/save settings. To solve this, a hard delete of the ir_model_field website_id is performed during the uninstall process of the website module. Fixes #21905 OPW 803018 --- addons/website/models/__init__.py | 1 + addons/website/models/ir_model.py | 15 +++++++++++++++ addons/website/models/res_config_settings.py | 1 + 3 files changed, 17 insertions(+) create mode 100644 addons/website/models/ir_model.py diff --git a/addons/website/models/__init__.py b/addons/website/models/__init__.py index 7f9660011c8..b44b20cfb9f 100644 --- a/addons/website/models/__init__.py +++ b/addons/website/models/__init__.py @@ -12,3 +12,4 @@ from . import res_partner from . import web_planner from . import res_config_settings from . import ir_model_fields +from . import ir_model diff --git a/addons/website/models/ir_model.py b/addons/website/models/ir_model.py new file mode 100644 index 00000000000..6d254374c38 --- /dev/null +++ b/addons/website/models/ir_model.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details + +from odoo import api, models + + +# This is a nasty hack, targeted for V11 only +class IrModel(models.Model): + _inherit = 'ir.model' + + @api.multi + def unlink(self): + self.env.cr.execute( + "DELETE FROM ir_model_fields WHERE name='website_id'") + return super(IrModel, self).unlink() diff --git a/addons/website/models/res_config_settings.py b/addons/website/models/res_config_settings.py index 8e5c61213dc..06b2c4118f3 100644 --- a/addons/website/models/res_config_settings.py +++ b/addons/website/models/res_config_settings.py @@ -13,6 +13,7 @@ class ResConfigSettings(models.TransientModel): def _default_website(self): return self.env['website'].search([], limit=1) + # FIXME: Set website_id to ondelete='cascade' in master website_id = fields.Many2one('website', string="website", default=_default_website, required=True) website_name = fields.Char('Website Name', related='website_id.name') language_ids = fields.Many2many(related='website_id.language_ids', relation='res.lang') From 2bedd640db14642441c568c2d0b36441f4ba554a Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Wed, 3 Jan 2018 14:35:54 +0000 Subject: [PATCH 08/73] [FIX] ir_model: ignore monetary fields during install (#21789) Previous to this commit, we try to load as many fields as possible during module installation, however sometimes some fields are not ready to be loaded, which is the case for custom monetary fields, thus when trying to find the current model's currency_id field it would not find it at all, generating an assertion error. This commit changes this by completely skipping monetary fields if they are not ready to be loaded. OPW 787223 --- odoo/addons/base/ir/ir_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/addons/base/ir/ir_model.py b/odoo/addons/base/ir/ir_model.py index 868865a26a7..f2b711514fe 100644 --- a/odoo/addons/base/ir/ir_model.py +++ b/odoo/addons/base/ir/ir_model.py @@ -854,6 +854,8 @@ class IrModelFields(models.Model): attrs['column1'] = field_data['column1'] or col1 attrs['column2'] = field_data['column2'] or col2 attrs['domain'] = safe_eval(field_data['domain'] or '[]') + elif field_data['ttype'] == 'monetary' and not self.pool.loaded: + return # add compute function if given if field_data['compute']: attrs['compute'] = make_compute(field_data['compute'], field_data['depends']) From 9e19bfad8cc4d59c89d479c5716869ef9b38405f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 29 Dec 2017 15:59:36 +0100 Subject: [PATCH 09/73] [FIX] hr_holidays: Leaves by Department The report 'Leaves by Department' only counts full days-off, instead of taking into account the actual number of days. This commit fixes the total number of days per employee. However, there is still a limitation on the display: a day is either fully colored or not at all. opw-801061 --- addons/hr_holidays/report/holidays_summary_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index 0118429725f..67f4c96a861 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -68,8 +68,8 @@ class HrHolidaySummaryReport(models.AbstractModel): for index in range(0, ((date_to - date_from).days + 1)): if date_from >= start_date and date_from <= end_date: res[(date_from-start_date).days]['color'] = holiday.holiday_status_id.color_name - count+=1 date_from += timedelta(1) + count += abs(holiday.number_of_days) self.sum = count return res From 5e9ebe86bae53f019981361bbcc2f03a5d49e0cb Mon Sep 17 00:00:00 2001 From: Yoshi Tashiro Date: Sat, 23 Dec 2017 15:15:14 +0000 Subject: [PATCH 10/73] [FIX] l10n_jp: wrong assignments of tax accounts --- addons/l10n_jp/data/account.tax.template.csv | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/l10n_jp/data/account.tax.template.csv b/addons/l10n_jp/data/account.tax.template.csv index acc4e01dfd1..1b8e083b42d 100644 --- a/addons/l10n_jp/data/account.tax.template.csv +++ b/addons/l10n_jp/data/account.tax.template.csv @@ -1,9 +1,9 @@ id,name,description,chart_template_id/id,type_tax_use,amount_type,amount,price_include,sequence,include_base_amount,account_id/id,refund_account_id/id,tag_ids/id,tax_group_id/id -tax_in_e,仮受消費税(外),仮受消費税(外),l10n_jp1,sale,percent,8,FALSE,1,FALSE,A21219,A21219,"tag_jp_03,tag_jp_12",tax_group_8 -tax_in_i,仮受消費税(内),仮受消費税(内),l10n_jp1,sale,percent,8,TRUE,1,FALSE,A21219,A21219,"tag_jp_03,tag_jp_12",tax_group_8 -tax_in_x,輸出免税,輸出免税,l10n_jp1,sale,percent,,FALSE,1,FALSE,A21219,A21219,"tag_jp_04,tag_jp_13",tax_group_0 -tax_in_o,非課税販売,非課税販売,l10n_jp1,sale,percent,,FALSE,1,FALSE,A21219,A21219,"tag_jp_09,tag_jp_14",tax_group_0 -tax_out_e,仮払消費税(外),仮払消費税(外),l10n_jp1,purchase,percent,8,FALSE,1,FALSE,A21807,A21807,"tag_jp_07,tag_jp_16",tax_group_8 -tax_out_i,仮払消費税(内),仮払消費税(内),l10n_jp1,purchase,percent,8,TRUE,1,FALSE,A21807,A21807,"tag_jp_07,tag_jp_16",tax_group_8 +tax_in_e,仮受消費税(外),仮受消費税(外),l10n_jp1,sale,percent,8,FALSE,1,FALSE,A21807,A21807,"tag_jp_03,tag_jp_12",tax_group_8 +tax_in_i,仮受消費税(内),仮受消費税(内),l10n_jp1,sale,percent,8,TRUE,1,FALSE,A21807,A21807,"tag_jp_03,tag_jp_12",tax_group_8 +tax_in_x,輸出免税,輸出免税,l10n_jp1,sale,percent,,FALSE,1,FALSE,,,"tag_jp_04,tag_jp_13",tax_group_0 +tax_in_o,非課税販売,非課税販売,l10n_jp1,sale,percent,,FALSE,1,FALSE,,,"tag_jp_09,tag_jp_14",tax_group_0 +tax_out_e,仮払消費税(外),仮払消費税(外),l10n_jp1,purchase,percent,8,FALSE,1,FALSE,A11807,A11807,"tag_jp_07,tag_jp_16",tax_group_8 +tax_out_i,仮払消費税(内),仮払消費税(内),l10n_jp1,purchase,percent,8,TRUE,1,FALSE,A11807,A11807,"tag_jp_07,tag_jp_16",tax_group_8 tax_out_im,海外仕入,海外仕入,l10n_jp1,purchase,percent,,FALSE,1,FALSE,,,"tag_jp_08,tag_jp_17",tax_group_0 tax_out_o,非課税購買,非課税購買,l10n_jp1,purchase,percent,,FALSE,1,FALSE,,,"tag_jp_18",tax_group_0 From 95376cd6a39f44da66445700b58bfa3002fb7bd3 Mon Sep 17 00:00:00 2001 From: Yoshi Tashiro Date: Sat, 23 Dec 2017 15:20:14 +0000 Subject: [PATCH 11/73] [REF] l10n_jp: author company name changed Company name of the author has been changed from Rooms For (Hong Kong) Limited to Quartile Limited. See https://github.com/odoo/odoo/pull/19516. --- addons/l10n_jp/__init__.py | 2 +- addons/l10n_jp/__manifest__.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/l10n_jp/__init__.py b/addons/l10n_jp/__init__.py index c447fd9af1b..5a8a4c59cc1 100644 --- a/addons/l10n_jp/__init__.py +++ b/addons/l10n_jp/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -# Copyright (C) Rooms For (Hong Kong) Limited T/A OSCG +# Copyright (C) Quartile Limited diff --git a/addons/l10n_jp/__manifest__.py b/addons/l10n_jp/__manifest__.py index d8c07d5e2cc..2cc28936810 100644 --- a/addons/l10n_jp/__manifest__.py +++ b/addons/l10n_jp/__manifest__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. -# Copyright (C) Rooms For (Hong Kong) Limited T/A OSCG +# Copyright (C) Quartile Limited { 'name': 'Japan - Accounting', @@ -26,8 +26,8 @@ need to use these at all under normal circumstances. [1] See https://github.com/odoo/odoo/pull/6470 for detail. """, - 'author': 'Rooms For (Hong Kong) Limited T/A OSCG', - 'website': 'http://www.openerp-asia.net/', + 'author': 'Quartile Limited', + 'website': 'https://www.odoo-asia.com/', 'depends': ['account'], 'data': [ 'data/l10n_jp_chart_data.xml', From aaa8a87f36478bca6504b2acfbe5e0a2e236fa4b Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 3 Jan 2018 12:37:28 +0100 Subject: [PATCH 12/73] [FIX] website_forum: check karma to allow to flag a post without rights to edit If you set 200 kamra to allow to flag a post and 300 to edit all post, you was not able to flag the post before this commit. This commit closes #21274 @kangol: warning, fwd port need to add tag_ids into trusted_keys --- addons/website_forum/models/forum.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index 8b03a0a809c..cc9b20da7c8 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -436,7 +436,7 @@ class Post(models.Model): elif post.parent_id and not post.can_answer: raise KarmaError('Not enough karma to answer to a question') if not post.parent_id and not post.can_post: - post.state = 'pending' + post.sudo().state = 'pending' # add karma for posting new questions if not post.parent_id and post.state == 'active': @@ -466,11 +466,18 @@ class Post(models.Model): @api.multi def write(self, vals): + trusted_keys = ['active', 'is_correct'] # fields where security is checked manually if 'content' in vals: vals['content'] = self._update_content(vals['content'], self.forum_id.id) if 'state' in vals: - if vals['state'] in ['active', 'close'] and any(not post.can_close for post in self): - raise KarmaError('Not enough karma to close or reopen a post.') + if vals['state'] in ['active', 'close']: + if any(not post.can_close for post in self): + raise KarmaError('Not enough karma to close or reopen a post.') + trusted_keys += ['state', 'closed_uid', 'closed_date', 'closed_reason_id'] + elif vals['state'] == 'flagged': + if any(not post.can_flag for post in self): + raise KarmaError('Not enough karma to flag a post.') + trusted_keys += ['state', 'flag_user_id'] if 'active' in vals: if any(not post.can_unlink for post in self): raise KarmaError('Not enough karma to delete or reactivate a post') @@ -483,7 +490,7 @@ class Post(models.Model): if vals['is_correct'] != post.is_correct and post.create_uid.id != self._uid: post.create_uid.sudo().add_karma(post.forum_id.karma_gen_answer_accepted * mult) self.env.user.sudo().add_karma(post.forum_id.karma_gen_answer_accept * mult) - if any(key not in ['state', 'active', 'is_correct', 'closed_uid', 'closed_date', 'closed_reason_id'] for key in vals.keys()) and any(not post.can_edit for post in self): + if any(key not in trusted_keys for key in vals) and any(not post.can_edit for post in self): raise KarmaError('Not enough karma to edit a post.') res = super(Post, self).write(vals) From 7a31bc60fb67a7322d6f105270cf809f5fc46e5d Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 3 Jan 2018 13:24:09 +0100 Subject: [PATCH 13/73] [FIX] website_forum: fix tooltip user info Before this commit, all tooltip users was showing website and parent_name from the Main company and not the current focsed partner. This commits closes #18430 @kangol: fwd-port company_name --- addons/website_forum/views/ir_qweb.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/website_forum/views/ir_qweb.xml b/addons/website_forum/views/ir_qweb.xml index 5b236210efa..174987a05d9 100644 --- a/addons/website_forum/views/ir_qweb.xml +++ b/addons/website_forum/views/ir_qweb.xml @@ -5,9 +5,9 @@
From 8e181c99c233f1a0e068f9218449add174a9a2b6 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Wed, 3 Jan 2018 11:49:10 +0100 Subject: [PATCH 14/73] [FIX] portal: show connected user in top menu. Before this commit, if the username was smaller than 25 chars, it was not displayed. Bug introduced by commit 483c9bb --- addons/portal/views/portal_templates.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/portal/views/portal_templates.xml b/addons/portal/views/portal_templates.xml index 60a299a6631..9095adb892d 100644 --- a/addons/portal/views/portal_templates.xml +++ b/addons/portal/views/portal_templates.xml @@ -36,7 +36,7 @@