[MERGE] forward port branch 9.0 up to 77be3d8b39

This commit is contained in:
Christophe Simonis
2017-06-09 12:51:31 +02:00
3 changed files with 26 additions and 20 deletions
@@ -901,6 +901,10 @@ class AccountBankStatementLine(models.Model):
# Create the move # Create the move
self.sequence = self.statement_id.line_ids.ids.index(self.id) + 1 self.sequence = self.statement_id.line_ids.ids.index(self.id) + 1
move_name = (self.statement_id.name or self.name) + "/" + str(self.sequence) 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_vals = self._prepare_reconciliation_move(move_name)
move = self.env['account.move'].create(move_vals) move = self.env['account.move'].create(move_vals)
counterpart_moves = (counterpart_moves | move) counterpart_moves = (counterpart_moves | move)
+20 -20
View File
@@ -225,26 +225,26 @@ class DeliveryCarrier(models.Model):
if record.delivery_type == 'fixed': if record.delivery_type == 'fixed':
PriceRule.search([('carrier_id', '=', record.id)]).unlink() PriceRule.search([('carrier_id', '=', record.id)]).unlink()
line_data = { line_data = {
'carrier_id': record.id, 'carrier_id': record.id,
'variable': 'price', 'variable': 'price',
'operator': '>=', 'operator': '>=',
} }
# Create the delivery price rules # Create the delivery price rules
if record.free_if_more_than: if record.free_if_more_than:
line_data.update({ line_data.update({
'max_value': record.amount, 'max_value': record.amount,
'standard_price': 0.0, 'standard_price': 0.0,
'list_base_price': 0.0, 'list_base_price': 0.0,
}) })
PriceRule.create(line_data) PriceRule.create(line_data)
if record.fixed_price is not False: if record.fixed_price is not False:
line_data.update({ line_data.update({
'max_value': 0.0, 'max_value': 0.0,
'standard_price': record.fixed_price, 'standard_price': record.fixed_price,
'list_base_price': record.fixed_price, 'list_base_price': record.fixed_price,
}) })
PriceRule.create(line_data) PriceRule.create(line_data)
return True return True
@api.model @api.model
@@ -468,6 +468,8 @@ var FieldCharDomain = common.AbstractField.extend(common.ReinitializeFieldMixin,
} }
} }
}).open(); }).open();
this.trigger("dialog_opened", dialog);
return dialog;
}, },
}); });