From 0d742878134cb12584b7bd5eb319e2ba8cfd8ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 18 Apr 2008 11:12:30 +0200 Subject: [PATCH] Change account on tax into properties and make it required for each company --- move.py | 2 -- tax.py | 12 ++++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/move.py b/move.py index ae9f5f0b7c..c41586405e 100644 --- a/move.py +++ b/move.py @@ -488,8 +488,6 @@ class Line(OSV): base_id = tax.refund_base_code.id code_id = tax.refund_tax_code.id account_id = tax.refund_account.id - if not account_id: - account_id = line.account.id if base_id in line_code_taxes or not base_id: taxes.setdefault((account_id, code_id), False) for tax_line in line.tax_lines: diff --git a/tax.py b/tax.py index 68767ee67f..4fd817efa3 100644 --- a/tax.py +++ b/tax.py @@ -222,17 +222,21 @@ class Tax(OSV): childs = fields.One2Many('account.tax', 'parent', 'Childs') company = fields.Many2One('company.company', 'Company', required=True) - invoice_account = fields.Many2One('account.account', 'Invoice Account', + invoice_account = fields.Property(type='many2one', + relation='account.account', string='Invoice Account', domain="[('company', '=', company)]", help='Keep empty to use the default invoice account', states={ - 'readonly': "type == 'none'", + 'readonly': "type == 'none' or not company", + 'required': "company", }) - refund_account = fields.Many2One('account.account', 'Refund Account', + refund_account = fields.Property(type='many2one', + relation='account.account', string='Refund Account', domain="[('company', '=', company)]", help='Keep empty to use the default refund account', states={ - 'readonly': "type == 'none'", + 'readonly': "type == 'none' or not company", + 'required': "company", }) invoice_base_code = fields.Many2One('account.tax.code',