From 79876515235ee2736d5d1e3f3a6f80c16d5bde1b Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Wed, 5 May 2010 10:23:49 +0530 Subject: [PATCH] [IMP]:usabiliy improvemetns bzr revid: nch@tinyerp.com-20100505045349-ssq1racv9tvzc22h --- addons/account/account.py | 6 +- addons/account/account_installer.xml | 37 ++++++++-- addons/account/account_view.xml | 6 +- addons/account/installer.py | 73 +++++++++++++++++-- addons/association/profile_association.xml | 11 +++ addons/base_setup/__init__.py | 1 + addons/base_setup/__openerp__.py | 2 +- addons/base_setup/base_setup_installer.xml | 13 +++- addons/hr/hr_installer.xml | 11 +++ addons/knowledge/knowledge_installer.xml | 12 +++ addons/mrp/mrp_installer.xml | 12 +++ .../profile_accounting/profile_accounting.xml | 11 +++ .../profile_manufacturing.xml | 11 +++ addons/profile_tools/misc_tools_installer.xml | 11 +++ addons/project/project_installer.xml | 11 +++ addons/purchase/wizard/purchase_installer.xml | 11 +++ .../report_designer_installer.xml | 11 +++ addons/service/service_installer.xml | 11 +++ 18 files changed, 245 insertions(+), 16 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index c965d2cd0e55..0241cbe5ffa6 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2390,10 +2390,14 @@ class account_bank_accounts_wizard(osv.osv_memory): _name='account.bank.accounts.wizard' _columns = { - 'acc_no':fields.many2one('res.partner.bank','Account No.',required=True), + 'acc_name':fields.char('Account Name.', size=64, required=True), 'bank_account_id':fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True), 'currency_id':fields.many2one('res.currency', 'Currency'), + 'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32), } + _defaults = { + 'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id, + } account_bank_accounts_wizard() diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml index 5eec07067eff..89921af9790d 100644 --- a/addons/account/account_installer.xml +++ b/addons/account/account_installer.xml @@ -17,7 +17,7 @@ </separator> <xpath expr="//label[@string='description']" position="attributes"> - <attribute name="string">You can enhance OpenERP's basic accounting support with a few additional OpenERP applications</attribute> + <attribute name="string">You can enhance OpenERP's basic accounting support with a few additional OpenERP applications. Select one of the country specific chart of account or select 'configurable chart of account' to configure your own chart of account.</attribute> <attribute name="width">150</attribute> </xpath> <xpath expr="//button[@string='Install Modules']" position="attributes"> @@ -36,11 +36,24 @@ <field name="account_followup"/> <field name="account_asset"/> </group> - <group colspan="4" attrs="{'invisible':[('charts','=',False)]}"> + <group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}"> + <field name="sale_tax" colspan="2"/> + <field name="purchase_tax" colspan="2"/> + </group> + <group colspan="4" attrs="{'invisible':[('charts','!=','configurable')]}"> <separator col="4" colspan="4" string="Bank and Cost Account"/> - <field name="account_name" colspan="2"/> - <field name="account_type" colspan="2"/> - <field name="account_currency" colspan="2" widget="selection"/> + <field colspan="4" mode="tree" name="bank_accounts_id" nolabel="1" widget="one2many_list"> + <form string="Bank Information"> + <field name="acc_name"/> + <field name="account_type"/> + <field name="currency_id"/> + </form> + <tree editable="bottom" string="Bank Information"> + <field name="acc_name"/> + <field name="account_type"/> + <field name="currency_id"/> + </tree> + </field> </group> <group colspan="4"> <separator col="4" colspan="4" string="Configure Fiscal Year"/> @@ -66,6 +79,20 @@ <record id="account_installer_todo" model="ir.actions.todo"> <field name="action_id" ref="action_account_installer"/> <field name="sequence">3</field> + <field name="restart">onskip</field> </record> + + <record id="account_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">account_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_account_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> + </data> </openerp> diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 515049bba153..cf9069f9be43 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1719,11 +1719,13 @@ <field colspan="4" mode="tree" name="bank_accounts_id" nolabel="1" widget="one2many_list"> <form string="Bank Information"> - <field name="acc_no"/> + <field name="acc_name"/> + <field name="account_type"/> <field name="currency_id"/> </form> <tree editable="bottom" string="Bank Information"> - <field name="acc_no"/> + <field name="acc_name"/> + <field name="account_type"/> <field name="currency_id"/> </tree> </field> diff --git a/addons/account/installer.py b/addons/account/installer.py index ca62f7587886..e10bbae21b7d 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -37,9 +37,20 @@ class account_installer(osv.osv_memory): sorted(((m.name, m.shortdesc) for m in modules.browse(cr, uid, ids)), key=itemgetter(1))) - charts.insert(0,('','')) + charts.insert(0,('configurable','Configurable Chart of Account')) return charts +# def default_get(self, cr, uid, fields_list=None, context=None): +# ''' set default accounts''' +# defaults = super(account_installer, self)\ +# .default_get(cr, uid, fields_list=fields_list, context=context) +# account = self.pool.get('account.bank.accounts.wizard') +# ids = [] +# for acc in ('Current','Deposit'): +# ids.append(account.create(cr, uid, {'acc_name':acc,'account_type':'cash','bank_account_id':self})) +# defaults.update({'bank_accounts_id':[(6,0,ids)]}) +# return defaults + _columns = { # Accounting 'charts':fields.selection(_get_charts, 'Chart of Accounts', @@ -64,15 +75,16 @@ class account_installer(osv.osv_memory): 'date_stop': fields.date('End Date', required=True), 'period':fields.selection([('month','Monthly'), ('3months','3 Monthly')], 'Periods', required=True), - 'account_name':fields.char('Name', size=128), - 'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32), - 'account_currency':fields.many2one('res.currency', 'Currency') + 'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Bank Accounts',required=True), + 'sale_tax':fields.float('Sale Tax(%)'), + 'purchase_tax':fields.float('Purchase Tax(%)') } _defaults = { 'date_start': lambda *a: time.strftime('%Y-01-01'), 'date_stop': lambda *a: time.strftime('%Y-12-31'), 'period':lambda *a:'month', - 'account_currency': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id, + 'sale_tax':lambda *a:0.0, + 'purchase_tax':lambda *a:0.0, } def on_change_start_date(self, cr, uid, id, start_date): @@ -84,9 +96,43 @@ class account_installer(osv.osv_memory): def execute(self, cr, uid, ids, context=None): super(account_installer, self).execute(cr, uid, ids, context=context) + record = self.browse(cr, uid, ids, context=context)[0] for res in self.read(cr,uid,ids): + if record.charts == 'configurable': + obj_acc = self.pool.get('account.account') + obj_tax = self.pool.get('account.tax') + user_type = self.pool.get('account.account.type') + obj_product = self.pool.get('product.product') + ir_values = self.pool.get('ir.values') + u_type_id = user_type.search(cr, uid,[('name','ilike','view')])[0] + company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id + vals = {'name': company.name or '', + 'currency_id': company.currency_id.id or False, + 'code': 0 or '', + 'type': 'view', + 'user_type': u_type_id, + 'company_id': company.id } + main_account = obj_acc.create(cr, uid, vals) + for val in record.bank_accounts_id: + vals = {'name': val.acc_name or '', + 'currency_id': val.currency_id.id or False, + 'code': val.acc_name or '', + 'type': 'view', + 'user_type': u_type_id, + 'parent_id':main_account, + 'company_id': company.id } + obj_acc.create(cr, uid, vals) + + sales_tax = obj_tax.create(cr, uid,{'name':'sale Tax','amount':res.get('sale_tax',0.0)}) + purchase_tax = obj_tax.create(cr, uid,{'name':'purchase Tax','amount':res.get('purchase_tax',0.0)}) + product_ids = obj_product.search(cr,uid, []) + for product in obj_product.browse(cr, uid, product_ids): + obj_product.write(cr, uid, product.id, {'taxes_id':[(6,0,[sales_tax])],'supplier_taxes_id':[(6,0,[purchase_tax])]}) + for name, value in [('taxes_id',sales_tax),('supplier_taxes_id',purchase_tax)]: + ir_values.set(cr, uid, key='default', key2=False, name=name, models =[('product.product',False)], value=[value]) + if 'date_start' in res and 'date_stop' in res: - name = res['date_start'][:4] + name = code = res['date_start'][:4] if int(name) != int(res['date_stop'][:4]): name = res['date_start'][:4] +'-'+ res['date_stop'][:4] code = res['date_start'][2:4] +'-'+ res['date_stop'][2:4] @@ -114,3 +160,18 @@ class account_installer(osv.osv_memory): account_installer() + +class account_bank_accounts_wizard(osv.osv_memory): + _name='account.bank.accounts.wizard' + + _columns = { + 'acc_name':fields.char('Account Name.', size=64, required=True), + 'bank_account_id':fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True), + 'currency_id':fields.many2one('res.currency', 'Currency'), + 'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32), + } + _defaults = { + 'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id, + } + +account_bank_accounts_wizard() diff --git a/addons/association/profile_association.xml b/addons/association/profile_association.xml index 827cdb42d18b..0d0a65b36443 100644 --- a/addons/association/profile_association.xml +++ b/addons/association/profile_association.xml @@ -48,5 +48,16 @@ <field name="action_id" ref="action_config_install_module"/> <field name="sequence">3</field> </record> + <record id="association_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">association_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_config_install_module)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/base_setup/__init__.py b/addons/base_setup/__init__.py index ef4f321942d0..cda3e40111ba 100644 --- a/addons/base_setup/__init__.py +++ b/addons/base_setup/__init__.py @@ -21,6 +21,7 @@ import installer import todo +import gtk_contact_form import wizard from osv import fields, osv diff --git a/addons/base_setup/__openerp__.py b/addons/base_setup/__openerp__.py index c6dd64d7bcc0..ee0cc6a8f56d 100644 --- a/addons/base_setup/__openerp__.py +++ b/addons/base_setup/__openerp__.py @@ -43,7 +43,7 @@ 'init_xml': ['base_setup_data.xml'], 'update_xml': ['security/ir.model.access.csv', 'base_setup_installer.xml', - 'base_setup_todo.xml',], + 'base_setup_todo.xml','gtk_contact_form.xml'], 'demo_xml': ['base_setup_demo.xml'], 'installable': True, 'active': True, diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml index f1c3f0c0b3d3..cc5afdd6f253 100644 --- a/addons/base_setup/base_setup_installer.xml +++ b/addons/base_setup/base_setup_installer.xml @@ -13,7 +13,7 @@ <xpath expr="//label[@string='description']" position="attributes"> <attribute name="string" - >Now that OpenERP is installed, we have selected applications commonly useful to users which you can install directly, as well as sets of applications for more specific types or groups of businesses (the vertical modules). + >Now that OpenERP is installed, We have selected applications commonly useful to users which you can install directly, as well as sets of applications for more specific types or groups of businesses (the vertical modules). If you don't think you need any of these right now, you can easily install them later on.</attribute> </xpath> @@ -56,5 +56,16 @@ If you don't think you need any of these right now, you can easily install them <field name="action_id" ref="action_base_setup_installer"/> <field name="sequence">2</field> </record> + <record id="base_setup_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">base_setup_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_base_setup_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/hr/hr_installer.xml b/addons/hr/hr_installer.xml index 07600ae204ad..a19476e1f195 100644 --- a/addons/hr/hr_installer.xml +++ b/addons/hr/hr_installer.xml @@ -52,5 +52,16 @@ <field name="action_id" ref="action_hr_installer"/> <field name="sequence">3</field> </record> + <record id="hr_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">hr_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_hr_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/knowledge/knowledge_installer.xml b/addons/knowledge/knowledge_installer.xml index a3c9437dae14..30ac565addbb 100644 --- a/addons/knowledge/knowledge_installer.xml +++ b/addons/knowledge/knowledge_installer.xml @@ -53,5 +53,17 @@ <field name="sequence">3</field> <field name="groups_id" eval="[(6,0,[ref('base.group_extended')])]"/> </record> + + <record id="knowledge_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">knowledge_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_knowledge_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/mrp/mrp_installer.xml b/addons/mrp/mrp_installer.xml index d36093c8dfb1..d40eb4535707 100644 --- a/addons/mrp/mrp_installer.xml +++ b/addons/mrp/mrp_installer.xml @@ -48,5 +48,17 @@ <field name="sequence">3</field> <field name="groups_id" eval="[(6,0,[ref('base.group_extended')])]"/> </record> + + <record id="mrp_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">mrp_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_mrp_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/profile_accounting/profile_accounting.xml b/addons/profile_accounting/profile_accounting.xml index bf1ba9fdf242..d54aaaf1e5b4 100644 --- a/addons/profile_accounting/profile_accounting.xml +++ b/addons/profile_accounting/profile_accounting.xml @@ -48,5 +48,16 @@ <field name="action_id" ref="action_config_install_module"/> <field name="sequence">3</field> </record> + <record id="accounting_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">accounting_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_config_install_module)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/profile_manufacturing/profile_manufacturing.xml b/addons/profile_manufacturing/profile_manufacturing.xml index df8c56c77cb9..bbbc64af57a1 100644 --- a/addons/profile_manufacturing/profile_manufacturing.xml +++ b/addons/profile_manufacturing/profile_manufacturing.xml @@ -55,5 +55,16 @@ <field name="action_id" ref="action_config_install_module"/> <field name="sequence">3</field> </record> + <record id="manufacturing_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">manufacturing_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_config_install_module)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/profile_tools/misc_tools_installer.xml b/addons/profile_tools/misc_tools_installer.xml index 307b5b90a8c2..277ec90b81c7 100644 --- a/addons/profile_tools/misc_tools_installer.xml +++ b/addons/profile_tools/misc_tools_installer.xml @@ -47,5 +47,16 @@ <field name="action_id" ref="action_misc_tools_installer"/> <field name="sequence">3</field> </record> + <record id="misc_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">misc_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_misc_tools_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/project/project_installer.xml b/addons/project/project_installer.xml index d8a503e00fa9..cbdd18ae29f4 100644 --- a/addons/project/project_installer.xml +++ b/addons/project/project_installer.xml @@ -53,5 +53,16 @@ <field name="action_id" ref="action_project_installer"/> <field name="sequence">3</field> </record> + <record id="project_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">project_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_project_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/purchase/wizard/purchase_installer.xml b/addons/purchase/wizard/purchase_installer.xml index 5725907da28a..0916977e62a0 100644 --- a/addons/purchase/wizard/purchase_installer.xml +++ b/addons/purchase/wizard/purchase_installer.xml @@ -46,5 +46,16 @@ <field name="sequence">3</field> <field name="groups_id" eval="[(6,0,[ref('base.group_extended')])]"/> </record> + <record id="purchase_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">purchase_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_purchase_install_module)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/report_designer/report_designer_installer.xml b/addons/report_designer/report_designer_installer.xml index 76adb3eddf10..89d655de0b2a 100644 --- a/addons/report_designer/report_designer_installer.xml +++ b/addons/report_designer/report_designer_installer.xml @@ -46,5 +46,16 @@ <field name="action_id" ref="action_report_designer_installer"/> <field name="sequence">3</field> </record> + <record id="report_designer_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">report_designer_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_report_designer_installer)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> diff --git a/addons/service/service_installer.xml b/addons/service/service_installer.xml index 07d9e8393769..98b1eab4bcea 100644 --- a/addons/service/service_installer.xml +++ b/addons/service/service_installer.xml @@ -60,5 +60,16 @@ <field name="action_id" ref="action_config_install_module"/> <field name="sequence">3</field> </record> + <record id="service_ir_actions_todo_tree" model="ir.ui.view"> + <field name="model">ir.actions.todo</field> + <field name="name">service_installer_action_replace</field> + <field name="type">tree</field> + <field name="inherit_id" ref="base.ir_actions_todo_tree"/> + <field name="arch" type="xml"> + <xpath expr="//button[@string='Launch']" position="replace"> + <button name="%(action_config_install_module)d" states="open,skip" string="Launch" type="action" icon="gtk-execute" help="Launch Configuration Wizard"/> + </xpath> + </field> + </record> </data> </openerp> -- GitLab