[MERGE] forward port branch 10.0 up to 14f59f4b78

This commit is contained in:
Christophe Simonis
2018-05-08 16:23:54 +02:00
5 changed files with 29 additions and 21 deletions
+2 -3
View File
@@ -431,7 +431,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()
@@ -747,8 +748,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
@@ -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
+14 -6
View File
@@ -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.'))
+1 -1
View File
@@ -285,7 +285,7 @@ class Warehouse(models.Model):
reception_route.pull_ids.unlink()
reception_route.push_ids.unlink()
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(
+4 -3
View File
@@ -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']