diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py index 5f8f83826ef..eedcbe2b7a7 100644 --- a/addons/account/models/res_config.py +++ b/addons/account/models/res_config.py @@ -129,7 +129,12 @@ class AccountConfigSettings(models.TransientModel): # related values, including the currency_id field on res_company. This in turn will trigger the recomputation # of account_move_line related field company_currency_id which can be slow depending on the number of entries # in the database. Thus, if we do not explicitely change the currency_id, we should not write it on the company + # Same for the field `code_digits` which will trigger a write on all the account.account to complete the + # code the missing characters to complete the desired number of digit, leading to a sql_constraint. if ('company_id' in values and 'currency_id' in values): - if self.env['res.company'].browse(values.get('company_id')).currency_id.id == values.get('currency_id'): + company = self.env['res.company'].browse(values.get('company_id')) + if company.currency_id.id == values.get('currency_id'): values.pop('currency_id') + if company.accounts_code_digits == vals.get('code_digits'): + vals.pop('code_digits') return super(AccountConfigSettings, self).create(values) diff --git a/addons/google_drive/models/google_drive.py b/addons/google_drive/models/google_drive.py index b1eda64b842..f0e494c8405 100644 --- a/addons/google_drive/models/google_drive.py +++ b/addons/google_drive/models/google_drive.py @@ -160,7 +160,7 @@ class GoogleDrive(models.Model): # check if a model is configured with a template configs = self.search([('model_id', '=', res_model)]) config_values = [] - for config in configs: + for config in configs.sudo(): if config.filter_id: if config.filter_id.user_id and config.filter_id.user_id.id != self.env.user.id: #Private diff --git a/addons/hr_timesheet/project_timesheet.py b/addons/hr_timesheet/project_timesheet.py index 400d5aedc6f..8a50f3c1ef4 100644 --- a/addons/hr_timesheet/project_timesheet.py +++ b/addons/hr_timesheet/project_timesheet.py @@ -67,3 +67,12 @@ class Task(models.Model): for task in self: if task.parent_id and task.parent_id.project_id and task.project_id and task.project_id != task.parent_id.project_id.subtask_project_id: raise UserError(_("You can't define a parent task if its project is not correctly configured. The sub-task's project of the parent task's project should be this task's project")) + + @api.model + def create(self, vals): + context = dict(self.env.context) + # Remove default_parent_id to avoid a confusion in get_record_data + if context.get('default_parent_id', False): + vals['parent_id'] = context.pop('default_parent_id', None) + task = super(Task, self.with_context(context)).create(vals) + return task diff --git a/addons/mrp/wizard/change_production_qty.py b/addons/mrp/wizard/change_production_qty.py index eebf8d29962..463c30c0a7c 100644 --- a/addons/mrp/wizard/change_production_qty.py +++ b/addons/mrp/wizard/change_production_qty.py @@ -22,7 +22,7 @@ class ChangeProductionQty(models.TransientModel): if 'mo_id' in fields and not res.get('mo_id') and self._context.get('active_model') == 'mrp.production' and self._context.get('active_id'): res['mo_id'] = self._context['active_id'] if 'product_qty' in fields and not res.get('product_qty') and res.get('mo_id'): - res['product_qty'] = self.env['mrp.production'].browse(res.get['mo_id']).product_qty + res['product_qty'] = self.env['mrp.production'].browse(res['mo_id']).product_qty return res @api.model diff --git a/addons/mrp/wizard/change_production_qty_views.xml b/addons/mrp/wizard/change_production_qty_views.xml index 0ba2fc8488e..f731d2cecc1 100644 --- a/addons/mrp/wizard/change_production_qty_views.xml +++ b/addons/mrp/wizard/change_production_qty_views.xml @@ -10,6 +10,7 @@
+