From 1ca1918a4510aa08b402da757dad6c8475b5a7da Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 24 Oct 2018 17:39:57 +0200 Subject: [PATCH 1/5] [FIX] base: subscribe new API onchange methods for module fields Adapt the code to use the new API for onchange methods. This fixes onchanges for version 11.0, since support of old-API onchange is actually gone. --- odoo/addons/base/res/res_config.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/odoo/addons/base/res/res_config.py b/odoo/addons/base/res/res_config.py index 8b2a450e322..9fc936a2e27 100644 --- a/odoo/addons/base/res/res_config.py +++ b/odoo/addons/base/res/res_config.py @@ -398,8 +398,6 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) def copy(self, values): raise UserError(_("Cannot duplicate configuration!"), "") - # TODO: Find replacement for 'onchange' attribute in view with dynamic - # api.onchange(...) and migrate the onchange_module(...) accordingly. @api.model def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False): @@ -421,9 +419,6 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) modifiers = json.loads(node.get("modifiers")) modifiers['readonly'] = True node.set("modifiers", json.dumps(modifiers)) - if 'on_change' not in node.attrib: - node.set("on_change", - "onchange_module(%s, '%s')" % (field, field)) ret_val['arch'] = etree.tostring(doc) return ret_val @@ -447,6 +442,16 @@ class ResConfigSettings(models.TransientModel, ResConfigModuleInstallationMixin) } return {} + def _register_hook(self): + """ Add an onchange method for each module field. """ + def make_method(name): + return lambda self: self.onchange_module(self[name], name) + + for name in self._fields: + if name.startswith('module_'): + method = make_method(name) + self._onchange_methods[name].append(method) + @api.model def _get_classified_fields(self): """ return a dictionary with the fields classified by category:: From f9787225033cb8ffd93ee94f960b39a95bf0bcae Mon Sep 17 00:00:00 2001 From: Duc Dao Date: Fri, 31 Aug 2018 15:15:26 +0700 Subject: [PATCH 2/5] [IMP] l10n_vn: fix syntax and allow reconcilation for accounts 3341, 3348, 141, 1388, 3388 --- addons/l10n_vn/data/l10n_vn_chart_data.xml | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/l10n_vn/data/l10n_vn_chart_data.xml b/addons/l10n_vn/data/l10n_vn_chart_data.xml index 81ef0b27530..7088a2cd60f 100644 --- a/addons/l10n_vn/data/l10n_vn_chart_data.xml +++ b/addons/l10n_vn/data/l10n_vn_chart_data.xml @@ -99,8 +99,7 @@ - Thuế GTGT được khấu trừ của hàng hóa, dịch vụ - + Thuế GTGT được khấu trừ của hàng hóa, dịch vụ 1332 @@ -158,7 +157,7 @@ 1388 - + Phải thu khác @@ -167,7 +166,7 @@ 141 - + Tạm ứng @@ -340,8 +339,7 @@ - Cây lâu năm, súc vật làm việc và cho sản phẩm - + Cây lâu năm, súc vật làm việc và cho sản phẩm 2118 @@ -467,7 +465,7 @@ - >Đầu tư vào công ty liên doanh + Đầu tư vào công ty liên doanh @@ -477,7 +475,7 @@ - >Đầu tư góp vốn vào đơn vị khác + Đầu tư góp vốn vào đơn vị khác @@ -669,14 +667,14 @@ 3341 - + Phải trả công nhân viên 3348 - + Phải trả người lao động khác @@ -695,7 +693,7 @@ - Phải trả nội bộ về vốn kinh doanh + Phải trả nội bộ về vốn kinh doanh @@ -781,7 +779,7 @@ 3388 - + Phải trả, phải nộp khác @@ -808,7 +806,7 @@ - Trái phiếu + Trái phiếu 34311 From 214975911bd5d456a8d95f817d8ea856c7a50165 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 30 Oct 2018 18:28:00 +0100 Subject: [PATCH 3/5] [FIX] l10n_ro: fix xml syntax --- addons/l10n_ro/data/l10n_ro_chart_data.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_ro/data/l10n_ro_chart_data.xml b/addons/l10n_ro/data/l10n_ro_chart_data.xml index 15c73fbd42e..2aa88cd47ca 100644 --- a/addons/l10n_ro/data/l10n_ro_chart_data.xml +++ b/addons/l10n_ro/data/l10n_ro_chart_data.xml @@ -1818,7 +1818,7 @@ - >Datorii din operaţiuni de fiducie + Datorii din operaţiuni de fiducie 4661 From 9cc8a8d0a48317d376c1f9dd4259338ce7d4bf6b Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 30 Oct 2018 18:33:15 +0100 Subject: [PATCH 4/5] [FIX] reqs: bump up recommended `requests` version In light of CVE-2018-18074, using python-requests 2.20.0 is recommended, or any distribution-specific version that was patched. See also https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-18074 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index a7a5d23363a..eaf01b182b0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -30,7 +30,7 @@ pyusb==1.0.0 PyYAML==3.12 qrcode==5.3 reportlab==3.3.0 -requests==2.11.1 +requests==2.20.0 six==1.10.0 suds-jurko==0.6 vatnumber==1.2 From 93d69933acc9454a5741fe6eb39edd9cdae9fbf1 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 27 Feb 2018 11:09:02 +0100 Subject: [PATCH 5/5] [FIX] stock: Wrong production/scrap/adjustment location used in multicompany - When using perpetual inventory valuation, the accounts used for scrap, manufacturing, and inventory adjustment operations are set on the corresponding locations . - In a multicompany environment, you will have a separate chart of accounts for each company. - Account fields on locations are not property fields. - Therefore, in order to separate the accounting of manufacturing, scrap, and inventory adjustment operations, you must use a location for each operation for each company. - Set up one location for each company for scrap, production, and adjustment locations, setting the company field on each. Bug: - When attempting to create a MO, inventory adjustment, or scrap order while signed in to the second company, you will receive a permissions error on stock.location. Fix: - Now the right location is taken according to the company of the user. Backport of this commit: c7526407ab4cf4c3d338f50a0259ac803e89f91f opw:1817339 --- addons/stock/models/stock_scrap.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_scrap.py b/addons/stock/models/stock_scrap.py index 7707ea90523..7db6715a5fe 100644 --- a/addons/stock/models/stock_scrap.py +++ b/addons/stock/models/stock_scrap.py @@ -10,10 +10,14 @@ class StockScrap(models.Model): _order = 'id desc' def _get_default_scrap_location_id(self): - return self.env['stock.location'].search([('scrap_location', '=', True)], limit=1).id + return self.env['stock.location'].search([('scrap_location', '=', True), ('company_id', 'in', [self.env.user.company_id.id, False])], limit=1).id def _get_default_location_id(self): - return self.env.ref('stock.stock_location_stock', raise_if_not_found=False) + company_user = self.env.user.company_id + warehouse = self.env['stock.warehouse'].search([('company_id', '=', company_user.id)], limit=1) + if warehouse: + return warehouse.lot_stock_id.id + return None name = fields.Char( 'Reference', default=lambda self: _('New'),