diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index dfd83aad1e9..a942f550c07 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -445,7 +445,8 @@ class AccountInvoice(models.Model): for invoice in self: # Delete non-manual tax lines self._cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s AND manual is False", (invoice.id,)) - self.invalidate_cache() + if self._cr.rowcount: + self.invalidate_cache() # Generate one tax line per tax, however many invoice lines it's applied to tax_grouped = invoice.get_taxes_values() @@ -755,8 +756,6 @@ class AccountInvoice(models.Model): 'invoice_id': self.id, 'analytic_tag_ids': analytic_tag_ids } - if line['account_analytic_id']: - move_line_dict['analytic_line_ids'] = [(0, 0, line._get_analytic_line())] res.append(move_line_dict) return res diff --git a/addons/l10n_multilang/models/l10n_multilang.py b/addons/l10n_multilang/models/l10n_multilang.py index 0c096c4cdf3..4bde8505d5c 100644 --- a/addons/l10n_multilang/models/l10n_multilang.py +++ b/addons/l10n_multilang/models/l10n_multilang.py @@ -32,14 +32,14 @@ class AccountChartTemplate(models.Model): for element in in_ids.with_context(lang=None): if value[element.id]: #copy Translation from Source to Destination object - xlat_obj.create({ - 'name': out_ids._name + ',' + in_field, - 'type': 'model', - 'res_id': out_ids[counter].id, - 'lang': lang, - 'src': element[in_field], - 'value': value[element.id], - }) + xlat_obj._set_ids( + out_ids._name + ',' + in_field, + 'model', + lang, + out_ids[counter].ids, + value[element.id], + element[in_field] + ) else: _logger.info('Language: %s. Translation from template: there is no translation available for %s!' % (lang, element[in_field])) counter += 1 diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index a6fc4ae4d07..203c0fe851e 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -336,6 +336,9 @@ class SaleOrder(models.Model): precision = self.env['decimal.precision'].precision_get('Product Unit of Measure') invoices = {} references = {} + invoices_origin = {} + invoices_name = {} + for order in self: group_key = order.id if grouped else (order.partner_invoice_id.id, order.currency_id.id) for line in order.order_line.sorted(key=lambda l: l.qty_to_invoice < 0): @@ -346,13 +349,14 @@ class SaleOrder(models.Model): invoice = inv_obj.create(inv_data) references[invoice] = order invoices[group_key] = invoice + invoices_origin[group_key] = [invoice.origin] + invoices_name[group_key] = [invoice.name] elif group_key in invoices: - vals = {} - if order.name not in invoices[group_key].origin.split(', '): - vals['origin'] = invoices[group_key].origin + ', ' + order.name - if order.client_order_ref and order.client_order_ref not in invoices[group_key].name.split(', ') and order.client_order_ref != invoices[group_key].name: - vals['name'] = invoices[group_key].name + ', ' + order.client_order_ref - invoices[group_key].write(vals) + if order.name not in invoices_origin[group_key]: + invoices_origin[group_key].append(order.name) + if order.client_order_ref and order.client_order_ref not in invoices_name[group_key]: + invoices_name[group_key].append(order.client_order_ref) + if line.qty_to_invoice > 0: line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice) elif line.qty_to_invoice < 0 and final: @@ -362,6 +366,10 @@ class SaleOrder(models.Model): if order not in references[invoices[group_key]]: references[invoice] = references[invoice] | order + for group_key in invoices: + invoices[group_key].write({'name': ', '.join(invoices_name[group_key]), + 'origin': ', '.join(invoices_origin[group_key])}) + if not invoices: raise UserError(_('There is no invoicable line.')) diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index f718e7a767f..dc8607620db 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -285,7 +285,7 @@ class Warehouse(models.Model): reception_route.pull_ids.write({'active': False}) reception_route.push_ids.write({'active': False}) else: - reception_route = self.env['stock.location.route'].create(warehouse._get_reception_delivery_route_values(warehouse.reception_steps)) + warehouse.reception_route_id = reception_route = self.env['stock.location.route'].create(warehouse._get_reception_delivery_route_values(warehouse.reception_steps)) # push / procurement (pull) rules for reception routings = routes_data[warehouse.id][warehouse.reception_steps] push_rules_list, pull_rules_list = warehouse._get_push_pull_rules_values( diff --git a/odoo/tools/mail.py b/odoo/tools/mail.py index e1a4eeb9c54..d994494e727 100644 --- a/odoo/tools/mail.py +++ b/odoo/tools/mail.py @@ -44,11 +44,12 @@ class _Cleaner(clean.Cleaner): _style_whitelist = [ 'font-size', 'font-family', 'font-weight', 'background-color', 'color', 'text-align', 'line-height', 'letter-spacing', 'text-transform', 'text-decoration', + 'float', 'vertical-align', 'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right', - 'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right' + 'margin', 'margin-top', 'margin-left', 'margin-bottom', 'margin-right', # box model - 'border', 'border-color', 'border-radius', 'border-style', 'height', - 'margin', 'padding', 'width', 'max-width', 'min-width', + 'border', 'border-color', 'border-radius', 'border-style', 'border-width', + 'height', 'margin', 'padding', 'width', 'max-width', 'min-width', # tables 'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout']