From 5deb416c89659baf6cf3ce10e8af47ac9e287ef9 Mon Sep 17 00:00:00 2001 From: rde <> Date: Mon, 8 Jan 2007 11:30:46 +0000 Subject: [PATCH] Analytic accounts with budgets bzr revid: rde-047ada3e1c01d8d3900c0916c99d3de72a8ef8c2 --- addons/account/__terp__.py | 3 ++- addons/account/account.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/account/__terp__.py b/addons/account/__terp__.py index b8e2841c473..b8245c12fcf 100644 --- a/addons/account/__terp__.py +++ b/addons/account/__terp__.py @@ -32,6 +32,7 @@ "data/account_minimal.xml", "data/account_data2.xml", "account_invoice_workflow.xml", + "project/project_wizard.xml", "project/project_view.xml", "project/project_report.xml", "product_data.xml", @@ -40,6 +41,6 @@ # "translations" : { # "fr": "i18n/french_fr.csv" # }, - "active": False, + "active": True, "installable": True } diff --git a/addons/account/account.py b/addons/account/account.py index efab9a26045..85817d358db 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -829,7 +829,7 @@ class account_tax(osv.osv): 'include_base_amount': fields.boolean('Include in base amount', help="Indicate if the amount of tax must be included in the base amount for the computation of the next taxes"), } _defaults = { - 'python_compute': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or False\n\nresult = price_unit * 0.10''', + 'python_compute': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n\nresult = price_unit * 0.10''', 'applicable_type': lambda *a: 'true', 'type': lambda *a: 'percent', 'amount': lambda *a: 0.196, @@ -844,11 +844,11 @@ class account_tax(osv.osv): } _order = 'sequence' - def _applicable(self, cr, uid, taxes, price_unit, address_id=None, product=None): + def _applicable(self, cr, uid, taxes, price_unit, address_id=None): res = [] for tax in taxes: if tax.applicable_type=='code': - localdict = {'price_unit':price_unit, 'address':self.pool.get('res.partner.address').browse(cr, uid, address_id), 'product':product,} + localdict = {'price_unit':price_unit, 'address':self.pool.get('res.partner.address').browse(cr, uid, address_id)} exec tax.python_applicable in localdict if localdict.get('result', False): res.append(tax) @@ -856,8 +856,8 @@ class account_tax(osv.osv): res.append(tax) return res - def _unit_compute(self, cr, uid, taxes, price_unit, address_id=None, product=None): - taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product) + def _unit_compute(self, cr, uid, taxes, price_unit, address_id=None): + taxes = self._applicable(cr, uid, taxes, price_unit, address_id) res = [] cur_price_unit=price_unit @@ -870,7 +870,7 @@ class account_tax(osv.osv): res.append({'id':tax.id, 'name':tax.name, 'amount':tax.amount, 'account_collected_id':tax.account_collected_id.id, 'account_paid_id':tax.account_paid_id.id, 'base_code_id': tax.base_code_id.id, 'ref_base_code_id': tax.ref_base_code_id.id, 'sequence': tax.sequence, 'base_sign': tax.base_sign, 'ref_base_sign': tax.ref_base_sign, 'price_unit': 1, 'tax_code_id': tax.tax_code_id.id,}) elif tax.type=='code': address = address_id and self.pool.get('res.partner.address').browse(cr, uid, address_id) or None - localdict = {'price_unit':cur_price_unit, 'address':address, 'product':product,} + localdict = {'price_unit':cur_price_unit, 'address':address} exec tax.python_compute in localdict amount = localdict['result'] res.append({ @@ -901,7 +901,7 @@ class account_tax(osv.osv): cur_price_unit+=amount2 return res - def compute(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None): + def compute(self, cr, uid, taxes, price_unit, quantity, address_id=None): """ Compute tax values for given PRICE_UNIT, QUANTITY and a buyer/seller ADDRESS_ID. @@ -910,7 +910,7 @@ class account_tax(osv.osv): tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2} one tax for each tax id in IDS and their childs """ - res = self._unit_compute(cr, uid, taxes, price_unit, address_id, product) + res = self._unit_compute(cr, uid, taxes, price_unit, address_id) for r in res: r['amount'] *= quantity return res