From 57d0ebb5e6dfcb7b9bb141c74621dc470d2bee5b Mon Sep 17 00:00:00 2001 From: jvo <> Date: Tue, 15 Jul 2008 15:34:58 +0530 Subject: [PATCH] -Added Use model wizard. -Added 'legend' field on account.model -Added 'description' field and name_get method on account.tax." bzr revid: jvo-20080715100458-0io7neh1n1grgrt3 --- addons/account/account.py | 17 ++++ addons/account/account_view.xml | 6 +- addons/account/account_wizard.xml | 48 +++++----- addons/account/wizard/__init__.py | 1 + addons/account/wizard/wizard_use_model.py | 108 ++++++++++++++++++++++ 5 files changed, 155 insertions(+), 25 deletions(-) create mode 100644 addons/account/wizard/wizard_use_model.py diff --git a/addons/account/account.py b/addons/account/account.py index 6eade89acfa..86ee89bca7a 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1086,8 +1086,19 @@ class account_tax(osv.osv): 'ref_tax_sign': fields.float('Tax Code Sign', help="Usualy 1 or -1."), '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"), 'company_id': fields.many2one('res.company', 'Company', required=True), + 'description': fields.char('Description', size=128, required=True), } + def name_get(self, cr, uid, ids, context={}): + if not len(ids): + return [] + reads = self.read(cr, uid, ids, ['description'], context) + res = [] + for record in reads: + name = record['description'] + res.append((record['id'],name )) + return res + def _default_company(self, cr, uid, context={}): user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if user.company_id: @@ -1367,7 +1378,13 @@ class account_model(osv.osv): 'ref': fields.char('Ref', size=64), 'journal_id': fields.many2one('account.journal', 'Journal', required=True), 'lines_id': fields.one2many('account.model.line', 'model_id', 'Model Entries'), + 'legend' :fields.text('Legend',readonly=True,size=100), } + + _defaults = { + 'legend':lambda *a:'''You can specify year,month and date in the name of the model using the following labels:\n\n%(year)s : To Specify Year \n%(month)s : To Specify Month \n%(date) : Current Date\n\ne.g. My model on %(date)s''', + } + def generate(self, cr, uid, ids, datas={}, context={}): move_ids = [] for model in self.browse(cr, uid, ids, context): diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 59ec5f8133c..dc7b567795c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -559,7 +559,8 @@ child_ids - + + @@ -573,6 +574,7 @@ + @@ -1125,6 +1127,8 @@ + +