diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py index d38981505cb..2320643e5f8 100644 --- a/addons/account/models/account_bank_statement.py +++ b/addons/account/models/account_bank_statement.py @@ -901,6 +901,10 @@ class AccountBankStatementLine(models.Model): # Create the move self.sequence = self.statement_id.line_ids.ids.index(self.id) + 1 move_name = (self.statement_id.name or self.name) + "/" + str(self.sequence) + # Ensure no duplicate is created + if self.env['account.move'].search([('name', '=', move_name)]): + count = self.env['account.move'].search_count([('name', '=like', move_name + '/%')]) + move_name = u'{}/{}'.format(move_name, count + 1) move_vals = self._prepare_reconciliation_move(move_name) move = self.env['account.move'].create(move_vals) counterpart_moves = (counterpart_moves | move) diff --git a/addons/delivery/models/delivery_carrier.py b/addons/delivery/models/delivery_carrier.py index 9ea3f393c82..e6cbf5f705d 100644 --- a/addons/delivery/models/delivery_carrier.py +++ b/addons/delivery/models/delivery_carrier.py @@ -225,26 +225,26 @@ class DeliveryCarrier(models.Model): if record.delivery_type == 'fixed': PriceRule.search([('carrier_id', '=', record.id)]).unlink() - line_data = { - 'carrier_id': record.id, - 'variable': 'price', - 'operator': '>=', - } - # Create the delivery price rules - if record.free_if_more_than: - line_data.update({ - 'max_value': record.amount, - 'standard_price': 0.0, - 'list_base_price': 0.0, - }) - PriceRule.create(line_data) - if record.fixed_price is not False: - line_data.update({ - 'max_value': 0.0, - 'standard_price': record.fixed_price, - 'list_base_price': record.fixed_price, - }) - PriceRule.create(line_data) + line_data = { + 'carrier_id': record.id, + 'variable': 'price', + 'operator': '>=', + } + # Create the delivery price rules + if record.free_if_more_than: + line_data.update({ + 'max_value': record.amount, + 'standard_price': 0.0, + 'list_base_price': 0.0, + }) + PriceRule.create(line_data) + if record.fixed_price is not False: + line_data.update({ + 'max_value': 0.0, + 'standard_price': record.fixed_price, + 'list_base_price': record.fixed_price, + }) + PriceRule.create(line_data) return True @api.model diff --git a/addons/web/static/src/js/views/form_widgets.js b/addons/web/static/src/js/views/form_widgets.js index 41e0e6e8b02..e56880a3267 100644 --- a/addons/web/static/src/js/views/form_widgets.js +++ b/addons/web/static/src/js/views/form_widgets.js @@ -468,6 +468,8 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin, } } }).open(); + this.trigger("dialog_opened", dialog); + return dialog; }, });