From 3cd80916f156cf2e92b1c8cf78d886b146b92f7c Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Wed, 12 Oct 2016 08:27:44 +0200 Subject: [PATCH 01/11] [FIX] purchase_requisition: typo in groups name The field in stock configuration group_stock_adv_location is toggling the group "stock.group_adv_location". There was a typo which was using on the form view of purchase.requisition the group "stock.group_stock_adv_location" instead. opw-690804 --- addons/purchase_requisition/purchase_requisition_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml index ccc20e6aeb8..4455e378b8b 100644 --- a/addons/purchase_requisition/purchase_requisition_view.xml +++ b/addons/purchase_requisition/purchase_requisition_view.xml @@ -63,7 +63,7 @@ - + From 69dfa67ac7347d9c67214868cc4e4046af9e7e49 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 12 Oct 2016 09:44:56 +0200 Subject: [PATCH 02/11] [FIX] pos: do not mix create and validation date The validation_date was using the creation_date value in the follwing scenario: 1. create a new order with a few lines (creation_date=t1) 2. reload the page, `init_from_JSON` uses validation_date=t1 3. validate the order at t2, ignored due to already stored value creation_date must be kept for tracablity reasons (e.g. pos_blackbox_be) Fixes https://www.odoo.com/groups/59/20542134 --- addons/point_of_sale/static/src/js/models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index e53fd2e7d4a..219f6c75cfa 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1782,7 +1782,7 @@ exports.Order = Backbone.Model.extend({ }, initialize_validation_date: function () { - this.validation_date = this.validation_date || new Date(); + this.validation_date = new Date(); }, set_tip: function(tip) { From 007607030a2c810dc7b134e926a8203b94babf84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E9=98=96=E8=BD=AF=E4=BB=B6=20Jeff=20Wang?= Date: Wed, 12 Oct 2016 09:51:45 +0800 Subject: [PATCH 03/11] [FIX] tools: keep keyword arguments in wrapper The patched add_sheet method lacks from the keyword argument cell_overwrite_ok that is present in original code. Closes #13755 --- openerp/tools/misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/tools/misc.py b/openerp/tools/misc.py index eb670adb5c4..1b818645670 100644 --- a/openerp/tools/misc.py +++ b/openerp/tools/misc.py @@ -330,13 +330,13 @@ try: # add some sanitizations to respect the excel sheet name restrictions # as the sheet name is often translatable, can not control the input class PatchedWorkbook(xlwt.Workbook): - def add_sheet(self, name): + def add_sheet(self, name, cell_overwrite_ok=False): # invalid Excel character: []:*?/\ name = re.sub(r'[\[\]:*?/\\]', '', name) # maximum size is 31 characters name = name[:31] - return super(PatchedWorkbook, self).add_sheet(name) + return super(PatchedWorkbook, self).add_sheet(name, cell_overwrite_ok=cell_overwrite_ok) xlwt.Workbook = PatchedWorkbook From 9adcf51600af2c04ede366c50c5ae630028f829b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 4 Oct 2016 16:43:51 -0500 Subject: [PATCH 04/11] [CLA] signature for tiangolo From #13676 --- doc/cla/individual/tiangolo.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/cla/individual/tiangolo.md diff --git a/doc/cla/individual/tiangolo.md b/doc/cla/individual/tiangolo.md new file mode 100644 index 00000000000..dfb1c19c218 --- /dev/null +++ b/doc/cla/individual/tiangolo.md @@ -0,0 +1,11 @@ +Colombia, 2016-10-04 + +I hereby agree to the terms of the Odoo Individual Contributor License +Agreement v1.0. + +I declare that I am authorized and able to make this agreement and sign this +declaration. + +Signed, + +Sebastián Ramírez tiangolo@gmail.com https://github.com/tiangolo From d30f512128e47c3f667a89a1d4abe132e51a810a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Tue, 4 Oct 2016 16:19:41 -0500 Subject: [PATCH 05/11] [FIX] doc: use the correct dir structure To respect the folders created by scaffold and the coding guidelines Closes #13676 --- doc/howtos/backend.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/howtos/backend.rst b/doc/howtos/backend.rst index 17f3a4a986c..a72d78788d6 100644 --- a/doc/howtos/backend.rst +++ b/doc/howtos/backend.rst @@ -211,7 +211,7 @@ overridden by setting :attr:`~openerp.models.Model._rec_name`. .. only:: solutions - Edit the file ``openacademy/models.py`` to include a *Course* class. + Edit the file ``openacademy/models/models.py`` to include a *Course* class. .. patch:: @@ -255,7 +255,7 @@ be declared in the ``'data'`` list (always loaded) or in the ``'demo'`` list .. only:: solutions - Edit the file ``openacademy/demo.xml`` to include some data. + Edit the file ``openacademy/demo/demo.xml`` to include some data. .. patch:: @@ -484,7 +484,7 @@ client data; it is also related to its sale order line records. .. only:: solutions - #. Create the class *Session* in ``openacademy/models.py``. + #. Create the class *Session* in ``openacademy/models/models.py``. #. Add access to the session object in ``openacademy/view/openacademy.xml``. .. patch:: @@ -683,7 +683,7 @@ instead of a single view its ``arch`` field is composed of any number of inspect the view, find its external ID and the place to put the new field. - #. Create a file ``openacademy/partner.py`` and import it in + #. Create a file ``openacademy/models/partner.py`` and import it in ``__init__.py`` #. Create a file ``openacademy/views/partner.xml`` and add it to ``__openerp__.py`` From 32b0e9520ddc641c5bbbec835731822fb86eafb2 Mon Sep 17 00:00:00 2001 From: Richard deMeester Date: Wed, 5 Oct 2016 10:30:38 +1100 Subject: [PATCH 06/11] [FIX[ account: correct 'read' call Using the read method should generally pass a single id as a list due to the new API inheritance of the read method. If an attempt is made to use the new API, the result is inconsistent. Following 4f0ca6d9 Closes #13678 --- addons/account/models/account_journal_dashboard.py | 4 ++-- addons/account_bank_statement_import/account_journal.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index b1bf44aa4ae..8fc73d1a3ca 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -313,7 +313,7 @@ class account_journal(models.Model): }) ir_model_obj = self.pool['ir.model.data'] model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name) - action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context) + action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0] action['context'] = ctx action['domain'] = self._context.get('use_domain', []) return action @@ -356,7 +356,7 @@ class account_journal(models.Model): ctx.pop('group_by', None) ir_model_obj = self.pool['ir.model.data'] model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account', action_name) - action = self.pool[model].read(self._cr, self._uid, action_id, context=self._context) + action = self.pool[model].read(self._cr, self._uid, [action_id], context=self._context)[0] action['context'] = ctx if ctx.get('use_domain', False): action['domain'] = ['|', ('journal_id', '=', self.id), ('journal_id', '=', False)] diff --git a/addons/account_bank_statement_import/account_journal.py b/addons/account_bank_statement_import/account_journal.py index 7964ecc9aec..eac0cdb71f2 100644 --- a/addons/account_bank_statement_import/account_journal.py +++ b/addons/account_bank_statement_import/account_journal.py @@ -14,7 +14,7 @@ class AccountJournal(models.Model): action_name = 'action_account_bank_statement_import' ir_model_obj = self.pool['ir.model.data'] model, action_id = ir_model_obj.get_object_reference(self._cr, self._uid, 'account_bank_statement_import', action_name) - action = self.pool[model].read(self._cr, self._uid, action_id, context=self.env.context) + action = self.pool[model].read(self._cr, self._uid, [action_id], context=self.env.context)[0] # Note: this drops action['context'], which is a dict stored as a string, which is not easy to update action.update({'context': (u"{'journal_id': " + str(self.id) + u"}")}) return action From 77c64e3f05bf5389eb918838370c5988e32281be Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Tue, 11 Oct 2016 10:56:18 +0200 Subject: [PATCH 07/11] [FIX] account: add a constraint to prevent the change of the reconciliation flag on account when there are already account_move_line existing --- addons/account/models/account.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 68b245da113..7583f738316 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -160,6 +160,13 @@ class AccountAccount(models.Model): for account in self: if (account.company_id.id <> vals['company_id']) and move_lines: raise UserError(_('You cannot change the owner company of an account that already contains journal items.')) + # If user change the reconcile flag, all aml should be recomputed for that account and this is very costly. + # So to prevent some bugs we add a constraint saying that you cannot change the reconcile field if there is any aml existing + # for that account. + if vals.get('reconcile'): + move_lines = self.env['account.move.line'].search([('account_id', 'in', self.ids)], limit=1) + if len(move_lines): + raise UserError(_('You cannot change the value of the reconciliation on this account as it already has some moves')) return super(AccountAccount, self).write(vals) @api.multi From 8f6b5fcf9e3f10054253f3e074fa2d40baca67fc Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Wed, 12 Oct 2016 11:24:11 +0200 Subject: [PATCH 08/11] [FIX] ir_model: in _module_data_uninstall(), unlink the right recordset The bug was introduced by eb04aa1e (migration to new API). --- openerp/addons/base/ir/ir_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index eb19a443ac8..aa67546e346 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -1187,7 +1187,7 @@ class IrModelData(models.Model): self._cr.commit() - self.unlink() + datas.unlink() @api.model def _process_end(self, modules): From 65c685ad2418f4a65914eda0d1ed5ba31bab0ba2 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Wed, 12 Oct 2016 12:30:42 +0200 Subject: [PATCH 09/11] [FIX] context mutations (#10368) when extending these methods with the new api, the context is a frozendict so we need to copy before mutating. this patch was made by searching for key addition to context and calls to the update() method on the 8.0 addons, and checking if a copy was made before in the method. --- addons/account/account.py | 3 +-- addons/account/account_move_line.py | 6 ++---- addons/account/wizard/account_report_general_ledger.py | 3 +-- addons/document/document.py | 3 +-- addons/l10n_be/wizard/l10n_be_partner_vat_listing.py | 1 + addons/point_of_sale/point_of_sale.py | 6 ++---- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 0c32aea78f5..2bae5c5c7e4 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2303,8 +2303,7 @@ class account_model(osv.osv): pt_obj = self.pool.get('account.payment.term') period_obj = self.pool.get('account.period') - if context is None: - context = {} + context = dict(context or {}) if data.get('date', False): context = dict(context) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 84778dc0928..143c8ff5468 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -674,8 +674,7 @@ class account_move_line(osv.osv): #TODO: ONCHANGE_ACCOUNT_ID: set account_tax_id def onchange_currency(self, cr, uid, ids, account_id, amount, currency_id, date=False, journal=False, context=None): - if context is None: - context = {} + context = dict(context or {}) account_obj = self.pool.get('account.account') journal_obj = self.pool.get('account.journal') currency_obj = self.pool.get('res.currency') @@ -1090,8 +1089,7 @@ class account_move_line(osv.osv): return r_id def view_header_get(self, cr, user, view_id, view_type, context=None): - if context is None: - context = {} + context = dict(context or {}) context = self.convert_to_period(cr, user, context=context) if context.get('account_id', False): cr.execute('SELECT code FROM account_account WHERE id = %s', (context['account_id'], )) diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py index cd242e79657..f15f65a6de4 100644 --- a/addons/account/wizard/account_report_general_ledger.py +++ b/addons/account/wizard/account_report_general_ledger.py @@ -49,8 +49,7 @@ class account_report_general_ledger(osv.osv_memory): return res def _print_report(self, cr, uid, ids, data, context=None): - if context is None: - context = {} + context = dict(context or {}) data = self.pre_print_report(cr, uid, ids, data, context=context) data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby'])[0]) if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record diff --git a/addons/document/document.py b/addons/document/document.py index a30099df905..244cde2d7b2 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -620,9 +620,8 @@ class node_context(object): def __init__(self, cr, uid, context=None): self.dbname = cr.dbname self.uid = uid + context = dict(context or {}) self.context = context - if context is None: - context = {} context['uid'] = uid self._dirobj = openerp.registry(cr.dbname).get('document.directory') self.node_file_class = node_file diff --git a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py index 8fa11545dee..b692966bb4f 100644 --- a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py @@ -45,6 +45,7 @@ class partner_vat(osv.osv_memory): _name = "partner.vat" def get_partner(self, cr, uid, ids, context=None): + context = dict(context or {}) obj_period = self.pool.get('account.period') obj_partner = self.pool.get('res.partner') obj_vat_lclient = self.pool.get('vat.listing.clients') diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index b4476a9505e..47e1c7895d0 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -443,8 +443,7 @@ class pos_session(osv.osv): """ call the Point Of Sale interface and set the pos.session to 'opened' (in progress) """ - if context is None: - context = dict() + context = dict(context or {}) if isinstance(ids, (int, long)): ids = [ids] @@ -537,8 +536,7 @@ class pos_session(osv.osv): return True def open_frontend_cb(self, cr, uid, ids, context=None): - if not context: - context = {} + context = dict(context or {}) if not ids: return {} for session in self.browse(cr, uid, ids, context=context): From 16430be5663954ebade9b5ac3f62d0ed504b9358 Mon Sep 17 00:00:00 2001 From: vnsoft Date: Fri, 20 Nov 2015 22:59:17 +0800 Subject: [PATCH 10/11] [FIX] models: in method read_group(), allow orderby='id desc' When orderby argument is 'id desc', an error occurs: "read_group order by 'id' ignored, cannot sort on empty..." --- openerp/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/models.py b/openerp/models.py index c03b97d2ba1..8dcfcf8b565 100644 --- a/openerp/models.py +++ b/openerp/models.py @@ -1920,7 +1920,7 @@ class BaseModel(object): for order_part in orderby.split(','): order_split = order_part.split() order_field = order_split[0] - if order_field in groupby_fields: + if order_field == 'id' or order_field in groupby_fields: if self._fields[order_field.split(':')[0]].type == 'many2one': order_clause = self._generate_order_by(order_part, query).replace('ORDER BY ', '') From a8e1595a12dec27405fbc9da5bbba709c9d261a6 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 11 Oct 2016 16:29:38 +0200 Subject: [PATCH 11/11] [FIX] sale: visible cost price in sale order line The Cost of the product(purchase_price) must be shown in the wizard opened when changing a SO line. opw:690180 --- addons/sale_margin/views/sale_margin_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_margin/views/sale_margin_view.xml b/addons/sale_margin/views/sale_margin_view.xml index fa9c56fe28a..b0da87326fa 100644 --- a/addons/sale_margin/views/sale_margin_view.xml +++ b/addons/sale_margin/views/sale_margin_view.xml @@ -20,7 +20,7 @@ - +