From adf6d0e557dd952c6366b9010638e4fe52563803 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 26 Nov 2015 11:06:58 +0100 Subject: [PATCH] [FIX] sale_layout: remove `categ_sequence` default value. `categ_sequence` are stored related fields, to `sale_layout_cat_id.sequence`. Setting a default value for them has as side effect to rewrite the value on the related field. To reproduce the issue: - Create a sale layout category, with 10 as sequence - Create an invoice with one line, with this sale layout category - Come back to the sale layout category, notice that the sequence has been changed to 0. Besides, as the sequence was rewritten on the sale layout category, the sequence was rewritten on all sale order lines and invoice lines having this sale layout category. If you have a bunch of them, this could take a while. The `categ_sequence` default value is supposed to come from the sale layout category. opw-651937 --- addons/sale_layout/models/sale_layout.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/addons/sale_layout/models/sale_layout.py b/addons/sale_layout/models/sale_layout.py index ed42fabb991..d2b5777c059 100644 --- a/addons/sale_layout/models/sale_layout.py +++ b/addons/sale_layout/models/sale_layout.py @@ -84,10 +84,6 @@ class AccountInvoiceLine(osv.Model): sale_layout_cat_id = openerp.fields.Many2one('sale_layout.category', string='Section') categ_sequence = openerp.fields.Integer(related='sale_layout_cat_id.sequence', string='Layout Sequence', store=True) - _defaults = { - 'categ_sequence': 0 - } - class SaleOrder(osv.Model): _inherit = 'sale.order' @@ -117,10 +113,6 @@ class SaleOrderLine(osv.Model): # Store is intentionally set in order to keep the "historic" order. } - _defaults = { - 'categ_sequence': 0 - } - _order = 'order_id, categ_sequence, sale_layout_cat_id, sequence, id' def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):