[MERGE] forward port branch saas-14 up to 1813f42dbc

This commit is contained in:
Christophe Simonis
2018-05-08 17:18:48 +02:00
5 changed files with 29 additions and 21 deletions
+2 -3
View File
@@ -445,7 +445,8 @@ class AccountInvoice(models.Model):
for invoice in self: for invoice in self:
# Delete non-manual tax lines # Delete non-manual tax lines
self._cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s AND manual is False", (invoice.id,)) 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 # Generate one tax line per tax, however many invoice lines it's applied to
tax_grouped = invoice.get_taxes_values() tax_grouped = invoice.get_taxes_values()
@@ -755,8 +756,6 @@ class AccountInvoice(models.Model):
'invoice_id': self.id, 'invoice_id': self.id,
'analytic_tag_ids': analytic_tag_ids '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) res.append(move_line_dict)
return res return res
@@ -32,14 +32,14 @@ class AccountChartTemplate(models.Model):
for element in in_ids.with_context(lang=None): for element in in_ids.with_context(lang=None):
if value[element.id]: if value[element.id]:
#copy Translation from Source to Destination object #copy Translation from Source to Destination object
xlat_obj.create({ xlat_obj._set_ids(
'name': out_ids._name + ',' + in_field, out_ids._name + ',' + in_field,
'type': 'model', 'model',
'res_id': out_ids[counter].id, lang,
'lang': lang, out_ids[counter].ids,
'src': element[in_field], value[element.id],
'value': value[element.id], element[in_field]
}) )
else: else:
_logger.info('Language: %s. Translation from template: there is no translation available for %s!' % (lang, element[in_field])) _logger.info('Language: %s. Translation from template: there is no translation available for %s!' % (lang, element[in_field]))
counter += 1 counter += 1
+14 -6
View File
@@ -336,6 +336,9 @@ class SaleOrder(models.Model):
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure') precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
invoices = {} invoices = {}
references = {} references = {}
invoices_origin = {}
invoices_name = {}
for order in self: for order in self:
group_key = order.id if grouped else (order.partner_invoice_id.id, order.currency_id.id) 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): 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) invoice = inv_obj.create(inv_data)
references[invoice] = order references[invoice] = order
invoices[group_key] = invoice invoices[group_key] = invoice
invoices_origin[group_key] = [invoice.origin]
invoices_name[group_key] = [invoice.name]
elif group_key in invoices: elif group_key in invoices:
vals = {} if order.name not in invoices_origin[group_key]:
if order.name not in invoices[group_key].origin.split(', '): invoices_origin[group_key].append(order.name)
vals['origin'] = invoices[group_key].origin + ', ' + order.name if order.client_order_ref and order.client_order_ref not in invoices_name[group_key]:
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: invoices_name[group_key].append(order.client_order_ref)
vals['name'] = invoices[group_key].name + ', ' + order.client_order_ref
invoices[group_key].write(vals)
if line.qty_to_invoice > 0: if line.qty_to_invoice > 0:
line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice) line.invoice_line_create(invoices[group_key].id, line.qty_to_invoice)
elif line.qty_to_invoice < 0 and final: elif line.qty_to_invoice < 0 and final:
@@ -362,6 +366,10 @@ class SaleOrder(models.Model):
if order not in references[invoices[group_key]]: if order not in references[invoices[group_key]]:
references[invoice] = references[invoice] | order 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: if not invoices:
raise UserError(_('There is no invoicable line.')) raise UserError(_('There is no invoicable line.'))
+1 -1
View File
@@ -285,7 +285,7 @@ class Warehouse(models.Model):
reception_route.pull_ids.write({'active': False}) reception_route.pull_ids.write({'active': False})
reception_route.push_ids.write({'active': False}) reception_route.push_ids.write({'active': False})
else: 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 # push / procurement (pull) rules for reception
routings = routes_data[warehouse.id][warehouse.reception_steps] routings = routes_data[warehouse.id][warehouse.reception_steps]
push_rules_list, pull_rules_list = warehouse._get_push_pull_rules_values( push_rules_list, pull_rules_list = warehouse._get_push_pull_rules_values(
+4 -3
View File
@@ -44,11 +44,12 @@ class _Cleaner(clean.Cleaner):
_style_whitelist = [ _style_whitelist = [
'font-size', 'font-family', 'font-weight', 'background-color', 'color', 'text-align', 'font-size', 'font-family', 'font-weight', 'background-color', 'color', 'text-align',
'line-height', 'letter-spacing', 'text-transform', 'text-decoration', 'line-height', 'letter-spacing', 'text-transform', 'text-decoration',
'float', 'vertical-align',
'padding', 'padding-top', 'padding-left', 'padding-bottom', 'padding-right', '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 # box model
'border', 'border-color', 'border-radius', 'border-style', 'height', 'border', 'border-color', 'border-radius', 'border-style', 'border-width',
'margin', 'padding', 'width', 'max-width', 'min-width', 'height', 'margin', 'padding', 'width', 'max-width', 'min-width',
# tables # tables
'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout'] 'border-collapse', 'border-spacing', 'caption-side', 'empty-cells', 'table-layout']