diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 9abec94a31e..6bb07fe0a2f 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -675,7 +675,6 @@ class SaleOrderLine(models.Model): 'product_id': self.product_id.id or False, 'invoice_line_tax_ids': [(6, 0, self.tax_id.ids)], 'account_analytic_id': self.order_id.project_id.id, - 'sale_layout_cat_id': self.sale_layout_cat_id.id, } return res diff --git a/addons/sale_layout/models/sale_layout.py b/addons/sale_layout/models/sale_layout.py index eecda5d7a1e..7d282c15ce2 100644 --- a/addons/sale_layout/models/sale_layout.py +++ b/addons/sale_layout/models/sale_layout.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from openerp import api from openerp.osv import osv, fields from itertools import groupby @@ -113,3 +114,15 @@ class SaleOrderLine(osv.Model): if line.categ_sequence: invoice_vals['categ_sequence'] = line.categ_sequence return invoice_vals + + @api.multi + def _prepare_invoice_line(self, qty): + """ + Prepare the dict of values to create the new invoice line for a sales order line. + + :param qty: float quantity to invoice + """ + res = super(SaleOrderLine, self)._prepare_invoice_line(qty) + if self.sale_layout_cat_id: + res['sale_layout_cat_id'] = self.sale_layout_cat_id.id + return res