[FIX] sale_layout: set 0 as default value for categ_sequence

Otherwise, in some cases, the categ_sequence can be set to null, which is not ordered the same way than 0, and you won't be able to sort lines with null and 0 as categ_sequence between each others
This commit is contained in:
Denis Ledoux 2014-11-26 17:02:20 +01:00
parent fde2046d5e
commit 2b0a8363d9
1 changed files with 8 additions and 0 deletions

View File

@ -84,6 +84,9 @@ 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):
@ -113,6 +116,11 @@ class SaleOrderLine(osv.Model):
string='Layout Sequence', store=True)
# Store is intentionally set in order to keep the "historic" order.
}
_defaults = {
'categ_sequence': 0
}
_order = 'order_id, categ_sequence, sequence, id'
def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):