From 5df99ce62227ca41bf3ac568404a9623661e0cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Wed, 25 Jun 2014 13:23:13 +0200 Subject: [PATCH] [FIX] account: add `sequence` on account.tax.code.template Relying on the ordering by tax code is not sufficient, as some tax declarations such as the Luxemburg one, show tax case codes not ordered numerically Original fix courtesy of Stefan Rijnhart (Therp) Fixes: lp:1168948 Rebase of: PR #759 --- addons/account/account.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index eeb915bddb0..1aa3d490f15 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1753,6 +1753,7 @@ class account_tax_code(osv.osv): _name = 'account.tax.code' _description = 'Tax Code' _rec_name = 'code' + _order = 'sequence, code' _columns = { 'name': fields.char('Tax Case Name', required=True, translate=True), 'code': fields.char('Case Code', size=64), @@ -2653,7 +2654,7 @@ class account_tax_code_template(osv.osv): _name = 'account.tax.code.template' _description = 'Tax Code Template' - _order = 'code' + _order = 'sequence, code' _rec_name = 'code' _columns = { 'name': fields.char('Tax Case Name', required=True), @@ -2663,6 +2664,11 @@ class account_tax_code_template(osv.osv): 'child_ids': fields.one2many('account.tax.code.template', 'parent_id', 'Child Codes'), 'sign': fields.float('Sign For Parent', required=True), 'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want any tax related to this tax Code to appear on invoices."), + 'sequence': fields.integer( + 'Sequence', help=( + "Determine the display order in the report 'Accounting " + "\ Reporting \ Generic Reporting \ Taxes \ Taxes Report'"), + ), } _defaults = { @@ -2695,6 +2701,7 @@ class account_tax_code_template(osv.osv): 'parent_id': tax_code_template.parent_id and ((tax_code_template.parent_id.id in tax_code_template_ref) and tax_code_template_ref[tax_code_template.parent_id.id]) or False, 'company_id': company_id, 'sign': tax_code_template.sign, + 'sequence': tax_code_template.sequence, } #check if this tax code already exists rec_list = obj_tax_code.search(cr, uid, [('name', '=', vals['name']),('code', '=', vals['code']),('company_id', '=', vals['company_id'])], context=context)