From 3161713bea39e3dc1458ab1a869b9a956494f2af Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 15 Jul 2011 18:12:38 +0530 Subject: [PATCH 001/372] [ADD]l10n_multilang:One of the existing problem of localization modules is that it doesnot allow you to translate the objects name So Add the tags translate=True on journal name, account name, account type ,account Tax, Templates.. bzr revid: ron@tinyerp.com-20110715124238-0pm6xakc7io3p3mg --- addons/l10n_multilang/__init__.py | 24 ++++++ addons/l10n_multilang/__openerp__.py | 49 +++++++++++ addons/l10n_multilang/account.py | 117 +++++++++++++++++++++++++++ 3 files changed, 190 insertions(+) create mode 100644 addons/l10n_multilang/__init__.py create mode 100644 addons/l10n_multilang/__openerp__.py create mode 100644 addons/l10n_multilang/account.py diff --git a/addons/l10n_multilang/__init__.py b/addons/l10n_multilang/__init__.py new file mode 100644 index 00000000000..0aea333e9a9 --- /dev/null +++ b/addons/l10n_multilang/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import account + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_multilang/__openerp__.py b/addons/l10n_multilang/__openerp__.py new file mode 100644 index 00000000000..e854aab8221 --- /dev/null +++ b/addons/l10n_multilang/__openerp__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +{ + "name" : "Belgium - Multi language Chart of Accounts (en/nl/fr)", + "version" : "1.1", + "author" : "OpenERP SA", + "category": 'Localization/Account Charts', + "description": """ + Belgian localisation (on top of l10n_be): + * Multilanguage support (en/nl/fr) for Chart of Accounts, Taxes, Tax Codes and Journals + * Multilingual accounting templates + * Multilanguage support Analytic Chart of Accounts and Analytic Journals + * Update partner titles for commonly used legal entities + * Add constraint to ensure unique Tax Code per Company + * Setup wizard changes + - Copy translations for CoA, Tax, Tax Code and Fiscal Position from templates to target objects + - Add options to install the nl and fr languages during the setup + - Generate Financial Journals from the templates + """, + 'website': 'http://www.openerp.com', + 'init_xml': [], + "depends" : ['account_accountant','l10n_be'], + 'update_xml': [ + ], + 'demo_xml': [ + ], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_multilang/account.py b/addons/l10n_multilang/account.py new file mode 100644 index 00000000000..46e5a2d63e7 --- /dev/null +++ b/addons/l10n_multilang/account.py @@ -0,0 +1,117 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +from osv import fields, osv +from tools.translate import _ + + +class account_account_template(osv.osv): + _inherit = 'account.account.template' + _columns = { + 'name': fields.char('Name', size=128, required=True, select=True, translate=True), + } +account_account_template() + + +class account_account(osv.osv): + _inherit = 'account.account' + _columns = { + 'name': fields.char('Name', size=128, required=True, select=True, translate=True), + } +account_account() + + +class account_tax_code(osv.osv): + _inherit = 'account.tax.code' + _sql_constraints = [ + ('code_company_uniq', 'unique (code,company_id)', 'The code of the Tax Case must be unique per company !') + ] +account_tax_code() + + +class account_tax_template(osv.osv): + _inherit = 'account.tax.template' + _columns = { + 'name': fields.char('Tax Name', size=128, required=True, select=True, translate=True), + } +account_tax_template() + + +class account_tax_code_template(osv.osv): + _inherit = 'account.tax.code.template' + _columns = { + 'name': fields.char('Tax Case Name', size=64, required=True, translate=True), + } +account_tax_code_template() + + +class account_chart_template(osv.osv): + _inherit = 'account.chart.template' + _columns={ + 'name': fields.char('Name', size=64, required=True, translate=True), + 'bank_from_template':fields.boolean('Banks/Cash from Template', help="Generate Bank/Cash accounts and journals from the Templates."), + } + _defaults = { + 'bank_from_template': False, + } + _order = 'name' +account_chart_template() + + +class account_fiscal_position(osv.osv): + _inherit = 'account.fiscal.position' + _columns = { + 'name': fields.char('Fiscal Position', size=64, required=True, translate=True), + } +account_fiscal_position() + + +class account_fiscal_position_template(osv.osv): + _inherit = 'account.fiscal.position.template' + _columns = { + 'name': fields.char('Fiscal Position Template', size=64, required=True, translate=True), + } +account_fiscal_position_template() + + +class account_journal(osv.osv): + _inherit = 'account.journal' + _columns = { + 'name': fields.char('Journal Name', size=64, required=True, translate=True), + } +account_journal() + + +class account_analytic_account(osv.osv): + _inherit = 'account.analytic.account' + _columns = { + 'name': fields.char('Account Name', size=128, required=True, translate=True), + } +account_analytic_account() + + +class account_analytic_journal(osv.osv): + _inherit = 'account.analytic.journal' + _columns = { + 'name': fields.char('Journal Name', size=64, required=True, translate=True), + } +account_analytic_journal() From 57507520a1ad208e7fe17fdba6cc09143bbc9176 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 18 Jul 2011 10:02:59 +0530 Subject: [PATCH 002/372] [IMP]Account:remove Account code unique constraint bzr revid: ron@tinyerp.com-20110718043259-0o9qvuv9sj3hiceu --- addons/l10n_multilang/account.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/addons/l10n_multilang/account.py b/addons/l10n_multilang/account.py index 46e5a2d63e7..f0583c13b53 100644 --- a/addons/l10n_multilang/account.py +++ b/addons/l10n_multilang/account.py @@ -40,14 +40,6 @@ class account_account(osv.osv): account_account() -class account_tax_code(osv.osv): - _inherit = 'account.tax.code' - _sql_constraints = [ - ('code_company_uniq', 'unique (code,company_id)', 'The code of the Tax Case must be unique per company !') - ] -account_tax_code() - - class account_tax_template(osv.osv): _inherit = 'account.tax.template' _columns = { From 6c4c1c78fd5aaf7eea441d0054b1021e96ac02e9 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 18 Jul 2011 18:17:15 +0530 Subject: [PATCH 003/372] [IMP]Account:Fixed=>Module name and description,remove dependency of l10n_be,remove unnessasary variable,missing object bzr revid: ron@tinyerp.com-20110718124715-b4rwn30rh3mphef0 --- addons/l10n_multilang/__openerp__.py | 8 ++++---- addons/l10n_multilang/account.py | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/addons/l10n_multilang/__openerp__.py b/addons/l10n_multilang/__openerp__.py index e854aab8221..b2b4c563dde 100644 --- a/addons/l10n_multilang/__openerp__.py +++ b/addons/l10n_multilang/__openerp__.py @@ -20,25 +20,25 @@ ############################################################################## { - "name" : "Belgium - Multi language Chart of Accounts (en/nl/fr)", + "name" : "Belgium - Multi language Chart of Accounts", "version" : "1.1", "author" : "OpenERP SA", "category": 'Localization/Account Charts', "description": """ Belgian localisation (on top of l10n_be): - * Multilanguage support (en/nl/fr) for Chart of Accounts, Taxes, Tax Codes and Journals + * Multilanguage support for Chart of Accounts, Taxes, Tax Codes and Journals * Multilingual accounting templates * Multilanguage support Analytic Chart of Accounts and Analytic Journals * Update partner titles for commonly used legal entities * Add constraint to ensure unique Tax Code per Company * Setup wizard changes - Copy translations for CoA, Tax, Tax Code and Fiscal Position from templates to target objects - - Add options to install the nl and fr languages during the setup + - Add options to install languages during the setup - Generate Financial Journals from the templates """, 'website': 'http://www.openerp.com', 'init_xml': [], - "depends" : ['account_accountant','l10n_be'], + "depends" : ['account_accountant'], 'update_xml': [ ], 'demo_xml': [ diff --git a/addons/l10n_multilang/account.py b/addons/l10n_multilang/account.py index f0583c13b53..f4d2c1bb78d 100644 --- a/addons/l10n_multilang/account.py +++ b/addons/l10n_multilang/account.py @@ -40,6 +40,14 @@ class account_account(osv.osv): account_account() +class account_tax(osv.osv): + _inherit = 'account.tax' + _columns = { + 'name': fields.char('Tax Name', size=128, required=True, select=True, translate=True), + } +account_tax() + + class account_tax_template(osv.osv): _inherit = 'account.tax.template' _columns = { @@ -60,10 +68,6 @@ class account_chart_template(osv.osv): _inherit = 'account.chart.template' _columns={ 'name': fields.char('Name', size=64, required=True, translate=True), - 'bank_from_template':fields.boolean('Banks/Cash from Template', help="Generate Bank/Cash accounts and journals from the Templates."), - } - _defaults = { - 'bank_from_template': False, } _order = 'name' account_chart_template() From 2ca78132ea89f7b0502a75056988981ecd93d344 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 18 Jul 2011 18:55:29 +0530 Subject: [PATCH 004/372] [IMP]Account:Improvement in Desription bzr revid: ron@tinyerp.com-20110718132529-9o3vusrrjzqtmn9q --- addons/l10n_multilang/__openerp__.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/l10n_multilang/__openerp__.py b/addons/l10n_multilang/__openerp__.py index b2b4c563dde..b4391e2c8f0 100644 --- a/addons/l10n_multilang/__openerp__.py +++ b/addons/l10n_multilang/__openerp__.py @@ -25,16 +25,12 @@ "author" : "OpenERP SA", "category": 'Localization/Account Charts', "description": """ - Belgian localisation (on top of l10n_be): * Multilanguage support for Chart of Accounts, Taxes, Tax Codes and Journals - * Multilingual accounting templates + * Multilanguage accounting templates * Multilanguage support Analytic Chart of Accounts and Analytic Journals - * Update partner titles for commonly used legal entities - * Add constraint to ensure unique Tax Code per Company * Setup wizard changes - Copy translations for CoA, Tax, Tax Code and Fiscal Position from templates to target objects - Add options to install languages during the setup - - Generate Financial Journals from the templates """, 'website': 'http://www.openerp.com', 'init_xml': [], From d6b0a13e14070d92cc2ce36958c1e8e4e16d0b28 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 18 Jul 2011 19:08:22 +0530 Subject: [PATCH 005/372] [IMP]Account:Improvments in Description bzr revid: ron@tinyerp.com-20110718133822-fgz05pasp03im1jz --- addons/l10n_multilang/__openerp__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/l10n_multilang/__openerp__.py b/addons/l10n_multilang/__openerp__.py index b4391e2c8f0..a63e853ae10 100644 --- a/addons/l10n_multilang/__openerp__.py +++ b/addons/l10n_multilang/__openerp__.py @@ -20,16 +20,15 @@ ############################################################################## { - "name" : "Belgium - Multi language Chart of Accounts", + "name" : "Multi language Chart of Accounts", "version" : "1.1", "author" : "OpenERP SA", "category": 'Localization/Account Charts', "description": """ - * Multilanguage support for Chart of Accounts, Taxes, Tax Codes and Journals - * Multilanguage accounting templates - * Multilanguage support Analytic Chart of Accounts and Analytic Journals + * Multilanguage support for Chart of Accounts, Taxes, Tax Codes , Journals, Accounting Templates, + Analytic Chart of Accounts and Analytic Journals * Setup wizard changes - - Copy translations for CoA, Tax, Tax Code and Fiscal Position from templates to target objects + - Copy translations for COA, Tax, Tax Code and Fiscal Position from templates to target objects - Add options to install languages during the setup """, 'website': 'http://www.openerp.com', From 028375c83f11186961a75ca0d88dbb55f0cc9942 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 20 Jul 2011 11:09:06 +0530 Subject: [PATCH 006/372] [IMP]Account:Improvement in wizard.multi.charts.accounts all fields have default used that is converted to default_get method bzr revid: ron@tinyerp.com-20110720053906-px9u1o3sfz4phq4q --- addons/account/account.py | 62 +++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index aced4041f13..a44ca2a8b5b 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2650,44 +2650,36 @@ class wizard_multi_charts_accounts(osv.osv_memory): res['value']["purchase_tax"] = purchase_tax_ids and purchase_tax_ids[0] or False return res - def _get_purchase_tax(self, cr, uid, context=None): + + def default_get(self, cr, uid, fields, context=None): + res = super(wizard_multi_charts_accounts, self).default_get(cr, uid, fields, context=context) + tax_templ_obj = self.pool.get('account.tax.template') + + if 'bank_accounts_id' in fields: + res.update({'bank_accounts_id': [{'acc_name': _('Current'), 'account_type': 'bank'}, + {'acc_name': _('Deposit'), 'account_type': 'bank'}, + {'acc_name': _('Cash'), 'account_type': 'cash'}]}) + if 'company_id' in fields: + res.update({'company_id': self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.id}) + if 'code_digits' in fields: + res.update({'code_digits': 6}) + if 'seq_journal' in fields: + res.update({'seq_journal': True}) + ids = self.pool.get('account.chart.template').search(cr, uid, [], context=context) if ids: - chart_template_id = ids[0] - purchase_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" - , "=", chart_template_id), ('type_tax_use', 'in', ('purchase','all'))], order="sequence") - return purchase_tax_ids and purchase_tax_ids[0] or False - return False + sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" + , "=", ids[0]), ('type_tax_use', 'in', ('sale','all'))], order="sequence") + purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" + , "=", ids[0]), ('type_tax_use', 'in', ('purchase','all'))], order="sequence") + if 'chart_template_id' in fields: + res.update({'chart_template_id':ids[0]}) + if 'sale_tax' in fields: + res.update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False}) + if 'purchase_tax' in fields: + res.update({'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False}) - def _get_sale_tax(self, cr, uid, context=None): - ids = self.pool.get('account.chart.template').search(cr, uid, [], context=context) - if ids: - chart_template_id = ids[0] - sale_tax_ids = self.pool.get('account.tax.template').search(cr, uid, [("chart_template_id" - , "=", chart_template_id), ('type_tax_use', 'in', ('sale','all'))], order="sequence") - return sale_tax_ids and sale_tax_ids[0] or False - return False - - def _get_chart(self, cr, uid, context=None): - ids = self.pool.get('account.chart.template').search(cr, uid, [], context=context) - if ids: - return ids[0] - return False - - def _get_default_accounts(self, cr, uid, context=None): - return [{'acc_name': _('Current'),'account_type':'bank'}, - {'acc_name': _('Deposit'),'account_type':'bank'}, - {'acc_name': _('Cash'),'account_type':'cash'}] - - _defaults = { - 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, [uid], c)[0].company_id.id, - 'chart_template_id': _get_chart, - 'bank_accounts_id': _get_default_accounts, - 'sale_tax': _get_sale_tax, - 'purchase_tax': _get_purchase_tax, - 'code_digits': 6, - 'seq_journal': True - } + return res def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(wizard_multi_charts_accounts, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False) From d07923239f01f8d745ec092b3050485968beea17 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 20 Jul 2011 11:54:43 +0530 Subject: [PATCH 007/372] [IMP]Account:optimize code of default_get method bzr revid: ron@tinyerp.com-20110720062443-cn65ey46czpd8v54 --- addons/account/account.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index a44ca2a8b5b..7e413f7a333 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2668,15 +2668,15 @@ class wizard_multi_charts_accounts(osv.osv_memory): ids = self.pool.get('account.chart.template').search(cr, uid, [], context=context) if ids: - sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" - , "=", ids[0]), ('type_tax_use', 'in', ('sale','all'))], order="sequence") - purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" - , "=", ids[0]), ('type_tax_use', 'in', ('purchase','all'))], order="sequence") if 'chart_template_id' in fields: - res.update({'chart_template_id':ids[0]}) + res.update({'chart_template_id': ids[0]}) if 'sale_tax' in fields: + sale_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" + , "=", ids[0]), ('type_tax_use', 'in', ('sale','all'))], order="sequence") res.update({'sale_tax': sale_tax_ids and sale_tax_ids[0] or False}) if 'purchase_tax' in fields: + purchase_tax_ids = tax_templ_obj.search(cr, uid, [("chart_template_id" + , "=", ids[0]), ('type_tax_use', 'in', ('purchase','all'))], order="sequence") res.update({'purchase_tax': purchase_tax_ids and purchase_tax_ids[0] or False}) return res From 7daeb8c47ef60c94dbc7c557dda8d92efa360f4b Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Thu, 21 Jul 2011 18:19:11 +0530 Subject: [PATCH 008/372] [IMP]l10n_multilang:Change the Multi wizard configuaration view and Add Language Field on wizard bzr revid: ron@tinyerp.com-20110721124911-h5tyniz8nufsqu1c --- addons/l10n_multilang/__init__.py | 4 +- addons/l10n_multilang/__openerp__.py | 8 +- addons/l10n_multilang/l10n_multilang.py | 44 +++++ addons/l10n_multilang/l10n_multilang.xml | 32 ++++ addons/l10n_multilang/l10n_multilang_test.xml | 161 ++++++++++++++++++ 5 files changed, 244 insertions(+), 5 deletions(-) create mode 100644 addons/l10n_multilang/l10n_multilang.py create mode 100644 addons/l10n_multilang/l10n_multilang.xml create mode 100644 addons/l10n_multilang/l10n_multilang_test.xml diff --git a/addons/l10n_multilang/__init__.py b/addons/l10n_multilang/__init__.py index 0aea333e9a9..446f3beb668 100644 --- a/addons/l10n_multilang/__init__.py +++ b/addons/l10n_multilang/__init__.py @@ -20,5 +20,5 @@ ############################################################################## import account - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +import l10n_multilang +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_multilang/__openerp__.py b/addons/l10n_multilang/__openerp__.py index e2c754adb4b..481abb1bf65 100644 --- a/addons/l10n_multilang/__openerp__.py +++ b/addons/l10n_multilang/__openerp__.py @@ -25,16 +25,18 @@ "author" : "OpenERP SA", "category": 'Localization/Account Charts', "description": """ - * Multilanguage support for Chart of Accounts, Taxes, Tax Codes , Journals, Accounting Templates, - Analytic Chart of Accounts and Analytic Journals + * Multi language support for Chart of Accounts, Taxes, Tax Codes , Journals, Accounting Templates, + Analytic Chart of Accounts and Analytic Journals. * Setup wizard changes - - Copy translations for COA, Tax, Tax Code and Fiscal Position from templates to target objects + - Copy translations for COA, Tax, Tax Code and Fiscal Position from templates to target objects. - Add option to install languages during the setup. """, 'website': 'http://www.openerp.com', 'init_xml': [], "depends" : ['account_accountant'], 'update_xml': [ + 'l10n_multilang.xml', + 'l10n_multilang_test.xml' ], 'demo_xml': [ ], diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py new file mode 100644 index 00000000000..f9fab08c216 --- /dev/null +++ b/addons/l10n_multilang/l10n_multilang.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +from osv import fields, osv + + +class wizard_multi_charts_accounts(osv.osv_memory): + """ + Change wizard that a new account chart for a company. + * load Default languages + * Replace creation of financial accounts by copy from template. + This change results in adherence to Belgian MAR numbering scheme for cash accounts. + * Create financial journals for each account of type liquidity + """ + _inherit = 'wizard.multi.charts.accounts' + + _columns = { + 'lang_ids': fields.many2many('res.lang', 'res_lang_type_rel', 'wizard_id', 'lang_id', 'Language'), + 'bank_from_template': fields.boolean('Banks/Cash from Template', + help="If True then Generate Bank/Cash accounts and journals from the Templates.", readonly=True), + } + +wizard_multi_charts_accounts() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_multilang/l10n_multilang.xml b/addons/l10n_multilang/l10n_multilang.xml new file mode 100644 index 00000000000..990407f9462 --- /dev/null +++ b/addons/l10n_multilang/l10n_multilang.xml @@ -0,0 +1,32 @@ + + + + + + 25 + onskip + + + + view.wizard.multi.chart + wizard.multi.charts.accounts + + + + + + + + + + + + {'invisible': [('bank_from_template', '=', False)]} + + + + + + + + diff --git a/addons/l10n_multilang/l10n_multilang_test.xml b/addons/l10n_multilang/l10n_multilang_test.xml new file mode 100644 index 00000000000..b91405cf27f --- /dev/null +++ b/addons/l10n_multilang/l10n_multilang_test.xml @@ -0,0 +1,161 @@ + + + + + + + + + special + + + + + + + Receivable + receivable + income + unreconciled + + + + Payable + payable + expense + unreconciled + + + + Asset View + asset + asset + + + + View + view + none + + + + Liability View + liability + liability + + + + Asset View + asset + asset + + + + + + Chart of Account A + 0 + view + + + + + + Balance Sheet + A00 + view + + + + + + + Profit and Loss + A01 + view + + + + + + + A0011 + Bank Account + + view + + + + + + Tax Template Root A + + + + Tax 001 A + + + + + Tax 002 A + + + + + + + Assets B + B00012 + view + + + + + + + Liabilities B + B00014 + view + + + + + + + Income B + B00021 + view + + + + + + + Expense B + B00024 + view + + + + + + + + + Demo Chart A + + + + + + + Demo Chart B + + + + + + + + + From a21478fde26e953e1ef84fa50a7925c698e63132 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 22 Jul 2011 12:37:41 +0530 Subject: [PATCH 009/372] [IMP]Account:Add parent_id field in Account.chart.template and Bank Account,Root Account ,Root Tax required when there is no parent bzr revid: ron@tinyerp.com-20110722070741-dxfzs55wlhgoq4wz --- addons/account/account.py | 1 + addons/account/account_view.xml | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 7e413f7a333..216c48ddb1b 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2475,6 +2475,7 @@ class account_chart_template(osv.osv): _columns={ 'name': fields.char('Name', size=64, required=True), + 'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'), 'account_root_id': fields.many2one('account.account.template','Root Account',required=True,domain=[('parent_id','=',False)]), 'tax_code_root_id': fields.many2one('account.tax.code.template','Root Tax Code',required=True,domain=[('parent_id','=',False)]), 'tax_template_ids': fields.one2many('account.tax.template', 'chart_template_id', 'Tax Template List', help='List of all the taxes that have to be installed by the wizard'), diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index d3d54a51918..aa0c7ae0c87 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2141,9 +2141,10 @@
- - - + + + + From b5f41c1cc7e8b645d86e0accc4ac6f4d86d262f9 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 22 Jul 2011 14:04:14 +0530 Subject: [PATCH 010/372] [IMP] account: l10n_multilang: 1)Get Default language on Language field 2)onchange on Template at that time languages change accordingly bzr revid: ron@tinyerp.com-20110722083414-8qzizw2fe1a8rxol --- addons/l10n_multilang/l10n_multilang.py | 32 ++++++++++++++++++++++++ addons/l10n_multilang/l10n_multilang.xml | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py index f9fab08c216..0c66ca387d6 100644 --- a/addons/l10n_multilang/l10n_multilang.py +++ b/addons/l10n_multilang/l10n_multilang.py @@ -33,6 +33,38 @@ class wizard_multi_charts_accounts(osv.osv_memory): """ _inherit = 'wizard.multi.charts.accounts' + def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None): + res = super(wizard_multi_charts_accounts, self).onchange_chart_template_id(cr, uid, ids, chart_template_id, context=context) + installed_lang = self.get_lang(cr, uid, chart_template_id, context=context) + res['value'].update({'lang_ids': installed_lang}) + return res + + def get_lang(self, cr, uid, template_id=False, context=None): + installed_lang = [] + if template_id: + cr.execute("SELECT module from ir_model_data where model='account.chart.template' and res_id=%s" % (template_id)) + modulename = cr.fetchone() + modulename = modulename and modulename[0] or False + if modulename: + import os + module_obj = self.pool.get('ir.module.module') + module_id = module_obj.search(cr, uid, [('name', '=', modulename)], context=context) + module = module_obj.browse(cr, uid, module_id, context=context)[0] + dirpath = module_obj._translations_subdir(module) + if dirpath: + po_files = os.listdir(dirpath) + for po in po_files: + lang_id = self.pool.get('res.lang').search(cr, uid, [('code', 'ilike', '%s' % (po.split('.')[0])), ('translatable', '=', True)], context=context) + if lang_id: + installed_lang.append(lang_id[0]) + return installed_lang + + def default_get(self, cr, uid, fields, context=None): + res = super(wizard_multi_charts_accounts, self).default_get(cr, uid, fields, context=context) + installed_lang = self.get_lang(cr, uid, res.get('chart_template_id'), context=context) + res.update({'lang_ids': installed_lang, 'bank_accounts_id': []}) + return res + _columns = { 'lang_ids': fields.many2many('res.lang', 'res_lang_type_rel', 'wizard_id', 'lang_id', 'Language'), 'bank_from_template': fields.boolean('Banks/Cash from Template', diff --git a/addons/l10n_multilang/l10n_multilang.xml b/addons/l10n_multilang/l10n_multilang.xml index 990407f9462..7affdb46323 100644 --- a/addons/l10n_multilang/l10n_multilang.xml +++ b/addons/l10n_multilang/l10n_multilang.xml @@ -14,7 +14,7 @@ - + From 4d882e63e19df8558f65f1bc42399d0d1671b8e1 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 22 Jul 2011 14:29:17 +0530 Subject: [PATCH 011/372] [IMP]: account: l10n fullness and inheritancy:Remove required=True from account_root_id,bank_account_view_id,tax_code_root_id and also optimize the code bzr revid: ron@tinyerp.com-20110722085917-rfnb8w8ycz0otuer --- addons/account/account.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 216c48ddb1b..09e61a8325a 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2476,19 +2476,19 @@ class account_chart_template(osv.osv): _columns={ 'name': fields.char('Name', size=64, required=True), 'parent_id': fields.many2one('account.chart.template', 'Parent Chart Template'), - 'account_root_id': fields.many2one('account.account.template','Root Account',required=True,domain=[('parent_id','=',False)]), - 'tax_code_root_id': fields.many2one('account.tax.code.template','Root Tax Code',required=True,domain=[('parent_id','=',False)]), + 'account_root_id': fields.many2one('account.account.template', 'Root Account', domain=[('parent_id','=',False)]), + 'tax_code_root_id': fields.many2one('account.tax.code.template', 'Root Tax Code', domain=[('parent_id','=',False)]), 'tax_template_ids': fields.one2many('account.tax.template', 'chart_template_id', 'Tax Template List', help='List of all the taxes that have to be installed by the wizard'), - 'bank_account_view_id': fields.many2one('account.account.template','Bank Account',required=True), - 'property_account_receivable': fields.many2one('account.account.template','Receivable Account'), - 'property_account_payable': fields.many2one('account.account.template','Payable Account'), - 'property_account_expense_categ': fields.many2one('account.account.template','Expense Category Account'), - 'property_account_income_categ': fields.many2one('account.account.template','Income Category Account'), - 'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'), - 'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'), + 'bank_account_view_id': fields.many2one('account.account.template', 'Bank Account'), + 'property_account_receivable': fields.many2one('account.account.template', 'Receivable Account'), + 'property_account_payable': fields.many2one('account.account.template', 'Payable Account'), + 'property_account_expense_categ': fields.many2one('account.account.template', 'Expense Category Account'), + 'property_account_income_categ': fields.many2one('account.account.template', 'Income Category Account'), + 'property_account_expense': fields.many2one('account.account.template', 'Expense Account on Product Template'), + 'property_account_income': fields.many2one('account.account.template', 'Income Account on Product Template'), 'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'), - 'property_account_income_opening': fields.many2one('account.account.template','Opening Entries Income Account'), - 'property_account_expense_opening': fields.many2one('account.account.template','Opening Entries Expense Account'), + 'property_account_income_opening': fields.many2one('account.account.template', 'Opening Entries Income Account'), + 'property_account_expense_opening': fields.many2one('account.account.template', 'Opening Entries Expense Account'), } account_chart_template() From aa245d62fa3fc461ecc7dcc0fa5241a7f69b5920 Mon Sep 17 00:00:00 2001 From: "Rucha (Open ERP)" Date: Fri, 22 Jul 2011 16:24:04 +0530 Subject: [PATCH 012/372] [REM]: l10n_multilang: Removed undefined onchange on COA template wizard bzr revid: rpa@tinyerp.com-20110722105404-4cxq8vn97atmu0jm --- addons/l10n_multilang/l10n_multilang.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_multilang/l10n_multilang.xml b/addons/l10n_multilang/l10n_multilang.xml index e4809aaa27f..7ad10f487db 100644 --- a/addons/l10n_multilang/l10n_multilang.xml +++ b/addons/l10n_multilang/l10n_multilang.xml @@ -9,7 +9,7 @@ - + From f9826a7f3c6c6afdaf9bc8a1c0d9d9ffd27af387 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 25 Jul 2011 11:09:34 +0530 Subject: [PATCH 013/372] [IMP] account: l10n_multilang: Copy Translation from Account Template to Destination object bzr revid: ron@tinyerp.com-20110725053934-zcbki8m3wyt4ilux --- addons/l10n_multilang/l10n_multilang.py | 77 ++++++++++++++++++++++++ addons/l10n_multilang/l10n_multilang.xml | 5 ++ 2 files changed, 82 insertions(+) diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py index 85a19c9fd08..e8e700bd1f6 100644 --- a/addons/l10n_multilang/l10n_multilang.py +++ b/addons/l10n_multilang/l10n_multilang.py @@ -21,6 +21,9 @@ from osv import fields, osv import os +import netsvc + +logger=netsvc.Logger() class wizard_multi_charts_accounts(osv.osv_memory): """ @@ -32,6 +35,80 @@ class wizard_multi_charts_accounts(osv.osv_memory): """ _inherit = 'wizard.multi.charts.accounts' + def copy_translation(self, cr, uid, langs, in_obj, in_field, in_ids, out_obj, out_ids): + done = False + error = False + xlat_obj = self.pool.get('ir.translation') + while not done: + #compare template with Accounts + if len(in_ids) != len(out_ids): + logger.notifyChannel('addons.'+self._name, netsvc.LOG_ERROR, + 'generate translations from template for %s failed (error 1)!' % out_obj._name) + error = True + break + #copy Translation from Source to Destination object + for lang in langs: + cr.execute("SELECT src, value FROM ir_translation " \ + "WHERE name=%s AND type='model' AND lang=%s AND res_id IN %s " \ + "ORDER by res_id", + (in_obj._name + ',' + in_field, lang, tuple(in_ids))) + xlats = cr.fetchall() + #IF there is no Translation Available or missing some Translation + if len(xlats) != len(out_ids): + logger.notifyChannel('addons.'+self._name, netsvc.LOG_ERROR, + 'There is no Translation available for template %s !' % out_obj._name) + error = True + break + for i in range(len(out_ids)): + src = xlats[i][0] + value = xlats[i][1] + out_record = out_obj.browse(cr, uid, out_ids[i]) + #compare with source to destination object name + if getattr(out_record, in_field) != src: + logger.notifyChannel('addons.'+self._name, netsvc.LOG_ERROR, + 'generate translations from template for %s failed (error 3)!' % out_obj._name) + error = True + break + #Copy Translation + xlat_obj.create(cr, uid, { + 'name': out_obj._name + ',' + in_field, + 'type': 'model', + 'res_id': out_record.id, + 'lang': lang, + 'src': src, + 'value': value, + }) + done = True + if error: + raise osv.except_osv(_('Warning!'), + _('The generation of translations from the template for %s failed!' % out_obj._name)) + + def execute(self, cr, uid, ids, context=None): + super(wizard_multi_charts_accounts, self).execute(cr, uid, ids, context=context) + obj_multi = self.browse(cr, uid, ids[0], context=context) + obj_mod = self.pool.get('ir.module.module') + obj_acc_template = self.pool.get('account.account.template') + obj_acc = self.pool.get('account.account') + obj_data = self.pool.get('ir.model.data') + + company_id = obj_multi.company_id.id + acc_template_root_id = obj_multi.chart_template_id.account_root_id.id + acc_root_id = obj_acc.search(cr, uid, [('company_id', '=', company_id), ('parent_id', '=', None)])[0] + + # load languages + langs = [] + for lang in obj_multi.lang_ids: + langs.append(lang.code) + installed_mids = obj_mod.search(cr, uid, [('state', '=', 'installed')]) + for lang in langs: + obj_mod.update_translations(cr, uid, installed_mids, lang) + + # copy account.account translations + in_field = 'name' + in_ids = obj_acc_template.search(cr, uid, [('id', 'child_of', [acc_template_root_id])], order='id')[1:] + out_ids = obj_acc.search(cr, uid, [('id', 'child_of', [acc_root_id])], order='id')[1:] + self.copy_translation(cr, uid, langs, obj_acc_template, in_field, in_ids, obj_acc, out_ids) + def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None): res = super(wizard_multi_charts_accounts, self).onchange_chart_template_id(cr, uid, ids, chart_template_id, context=context) installed_lang = self.get_lang(cr, uid, chart_template_id, context=context) diff --git a/addons/l10n_multilang/l10n_multilang.xml b/addons/l10n_multilang/l10n_multilang.xml index 7ad10f487db..71563ce526c 100644 --- a/addons/l10n_multilang/l10n_multilang.xml +++ b/addons/l10n_multilang/l10n_multilang.xml @@ -1,6 +1,11 @@ + + + 25 + onskip + view.wizard.multi.chart From 06726846c4c819cfeafacf6acd9764c153afce2d Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 26 Jul 2011 15:25:18 +0530 Subject: [PATCH 014/372] [ADD] account: l10n_multilang: 1)Add wizard=>to saw warning message 2)Optimize code of copy_translation method 3)checked indentation problems 4)remove Unused variable 5)Improved docstring bzr revid: ron@tinyerp.com-20110726095518-1irmhd3xr8mwfaui --- addons/l10n_multilang/l10n_multilang.py | 141 +++++++++++++---------- addons/l10n_multilang/l10n_multilang.xml | 19 ++- 2 files changed, 101 insertions(+), 59 deletions(-) diff --git a/addons/l10n_multilang/l10n_multilang.py b/addons/l10n_multilang/l10n_multilang.py index e8e700bd1f6..1e7ed1fef87 100644 --- a/addons/l10n_multilang/l10n_multilang.py +++ b/addons/l10n_multilang/l10n_multilang.py @@ -21,70 +21,94 @@ from osv import fields, osv import os -import netsvc +from tools.translate import _ + + +class translate_message(osv.osv_memory): + _name = "translate.message" + _description = "Give Message After Translation completed" + + def default_get(self, cr, uid, fields, context=None): + """ Get default values + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param fields: List of fields for default value + @param context: A standard dictionary + @return: Default values of fields + """ + if context is None: + context = {} + res ={} + if context.get('warning'): + if 'message' in fields: + res.update({'message': _(context.get('warning'))}) + return res + + _columns = { + 'message' : fields.text('Message', size=64, readonly=True), + } + +translate_message() -logger=netsvc.Logger() class wizard_multi_charts_accounts(osv.osv_memory): """ Change wizard that a new account chart for a company. - * load Default languages - * Replace creation of financial accounts by copy from template. - This change results in adherence to Belgian MAR numbering scheme for cash accounts. - * Create financial journals for each account of type liquidity + * Add option to install languages during the setup + * Copy translations for COA, Tax, Tax Code and Fiscal Position from templates to target objects. """ _inherit = 'wizard.multi.charts.accounts' - def copy_translation(self, cr, uid, langs, in_obj, in_field, in_ids, out_obj, out_ids): - done = False - error = False + def copy_translations(self, cr, uid, langs, in_obj, in_field, in_ids, out_obj, out_ids, context): + result = {} + if context is None: + context = {} xlat_obj = self.pool.get('ir.translation') - while not done: - #compare template with Accounts - if len(in_ids) != len(out_ids): - logger.notifyChannel('addons.'+self._name, netsvc.LOG_ERROR, - 'generate translations from template for %s failed (error 1)!' % out_obj._name) - error = True - break - #copy Translation from Source to Destination object - for lang in langs: - cr.execute("SELECT src, value FROM ir_translation " \ - "WHERE name=%s AND type='model' AND lang=%s AND res_id IN %s " \ - "ORDER by res_id", - (in_obj._name + ',' + in_field, lang, tuple(in_ids))) - xlats = cr.fetchall() - #IF there is no Translation Available or missing some Translation - if len(xlats) != len(out_ids): - logger.notifyChannel('addons.'+self._name, netsvc.LOG_ERROR, - 'There is no Translation available for template %s !' % out_obj._name) - error = True - break - for i in range(len(out_ids)): - src = xlats[i][0] - value = xlats[i][1] - out_record = out_obj.browse(cr, uid, out_ids[i]) - #compare with source to destination object name - if getattr(out_record, in_field) != src: - logger.notifyChannel('addons.'+self._name, netsvc.LOG_ERROR, - 'generate translations from template for %s failed (error 3)!' % out_obj._name) - error = True - break - #Copy Translation + #find the source from Account Template + result = [(x.id, x.name) for x in in_obj.browse(cr, uid, in_ids)] + src = dict(result) + message = '' + for lang in langs: + notdone = [] + #find the value from Translation + value = xlat_obj._get_ids(cr, uid, in_obj._name + ',' + in_field, 'model', lang, in_ids) + for j in range(len(in_ids)): + in_id = in_ids[j] + if not value[in_id]: + # if source have no translation available + notdone.append(src[in_id]) + else: + #copy Translation from Source to Destination object xlat_obj.create(cr, uid, { - 'name': out_obj._name + ',' + in_field, - 'type': 'model', - 'res_id': out_record.id, - 'lang': lang, - 'src': src, - 'value': value, - }) - done = True - if error: - raise osv.except_osv(_('Warning!'), - _('The generation of translations from the template for %s failed!' % out_obj._name)) - + 'name': out_obj._name + ',' + in_field, + 'type': 'model', + 'res_id': out_ids[j], + 'lang': lang, + 'src': src[in_id], + 'value': value, + }) + if notdone: + message += '\nLanguage:-%s \n\tThere is no translation available for following accounts: \n\t%s '\ + % (lang, '\n\t'.join(notdone)) + else: + message += '\nLanguage:-%s \n\tTranslation successfully done.' % (lang) + resource_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'l10n_multilang', 'view_translate_message_wizard') + #open new wizard its for saw warning message + if message: + context.update({'warning': message}) + return { + 'view_type': 'form', + 'view_mode': 'form', + 'res_model': 'translate.message', + 'views': [(resource_id and resource_id[1] or False,'form')], + 'type': 'ir.actions.act_window', + 'target': 'new', + 'context': context + } + def execute(self, cr, uid, ids, context=None): - super(wizard_multi_charts_accounts, self).execute(cr, uid, ids, context=context) + res = super(wizard_multi_charts_accounts, self).execute(cr, uid, ids, context=context) obj_multi = self.browse(cr, uid, ids[0], context=context) obj_mod = self.pool.get('ir.module.module') obj_acc_template = self.pool.get('account.account.template') @@ -97,17 +121,18 @@ class wizard_multi_charts_accounts(osv.osv_memory): # load languages langs = [] + installed_mids = obj_mod.search(cr, uid, [('state', '=', 'installed')]) for lang in obj_multi.lang_ids: langs.append(lang.code) - installed_mids = obj_mod.search(cr, uid, [('state', '=', 'installed')]) - for lang in langs: - obj_mod.update_translations(cr, uid, installed_mids, lang) + obj_mod.update_translations(cr, uid, installed_mids, lang.code) # copy account.account translations - in_field = 'name' in_ids = obj_acc_template.search(cr, uid, [('id', 'child_of', [acc_template_root_id])], order='id')[1:] out_ids = obj_acc.search(cr, uid, [('id', 'child_of', [acc_root_id])], order='id')[1:] - self.copy_translation(cr, uid, langs, obj_acc_template, in_field, in_ids, obj_acc, out_ids) + result = self.copy_translations(cr, uid, langs, obj_acc_template, 'name', in_ids, obj_acc, out_ids, context) + if result: + return result + return {} def onchange_chart_template_id(self, cr, uid, ids, chart_template_id=False, context=None): res = super(wizard_multi_charts_accounts, self).onchange_chart_template_id(cr, uid, ids, chart_template_id, context=context) diff --git a/addons/l10n_multilang/l10n_multilang.xml b/addons/l10n_multilang/l10n_multilang.xml index 71563ce526c..02b06a9147d 100644 --- a/addons/l10n_multilang/l10n_multilang.xml +++ b/addons/l10n_multilang/l10n_multilang.xml @@ -1,7 +1,7 @@ - + 25 onskip @@ -27,6 +27,23 @@ + + + Translation Process + translate.message + form + + + + + + + + + From 2275d445f95fcd7c11fbe59e94bc2f5c1feaf2f8 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Mon, 28 Nov 2011 10:43:22 +0530 Subject: [PATCH 138/372] [IMP] improve test case process of Job position bzr revid: jap@tinyerp.com-20111128051322-7bweo3pdz1u0g1fi --- addons/hr/test/open2recruit2close_job.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/hr/test/open2recruit2close_job.yml b/addons/hr/test/open2recruit2close_job.yml index f199160d9fc..7647f525146 100644 --- a/addons/hr/test/open2recruit2close_job.yml +++ b/addons/hr/test/open2recruit2close_job.yml @@ -1,14 +1,14 @@ - - In Order to test process of Job Position, + I test the process of Job position in hr module of OpenERP, - - I open Job Postion for "Jr. Application Engineer" + I open Job Postion for "Jr. Application Engineer". - !python {model: hr.job}: | self.job_open(cr, uid, [ref('job_jr_appli')]) - I check state of Job Position after opening it. - - !assert {model: hr.job, id: job_jr_appli}: + !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'open' state and no_of_recruitment = 0}: - state == 'open' - no_of_recruitment == 0 - @@ -19,7 +19,7 @@ - I check 'state' and number of 'Expected in Recruitment' after initiating the recruitment - - !assert {model: hr.job, id: job_jr_appli}: + !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'recruit' state and no_of_recruitment = 1.0}: - state == 'recruit' - no_of_recruitment == 1.0 - @@ -33,8 +33,8 @@ !python {model: hr.job}: | self.job_old(cr, uid, [ref('job_jr_appli')]) - - I check state of Job position and number of Expected in Recruitment after closed Job position. + I check 'state' and number of 'Expected in Recruitment' after closing the Job position. - - !assert {model: hr.job, id: job_jr_appli}: + !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'old' state and no_of_recruitment = 0}: - state == 'old' - no_of_recruitment == 0 \ No newline at end of file From a0f45aedd5c1cd529325bb525f04434d94d12e78 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 28 Nov 2011 11:16:05 +0530 Subject: [PATCH 139/372] [REVIEW] HR: testing cases of Human Resource Management bzr revid: hmo@tinyerp.com-20111128054605-8wb7xpf3fn9ntiea --- addons/hr/__openerp__.py | 2 +- addons/hr/test/hr_demo.yml | 10 ++++++++++ addons/hr/test/hr_employee_demo.yml | 21 --------------------- addons/hr/test/open2recruit2close_job.yml | 6 ++---- 4 files changed, 13 insertions(+), 26 deletions(-) create mode 100644 addons/hr/test/hr_demo.yml delete mode 100644 addons/hr/test/hr_employee_demo.yml diff --git a/addons/hr/__openerp__.py b/addons/hr/__openerp__.py index c1a75cbb7f5..4c99d0d5231 100644 --- a/addons/hr/__openerp__.py +++ b/addons/hr/__openerp__.py @@ -55,8 +55,8 @@ You can manage: 'hr_department_demo.xml', ], 'test': [ - 'test/hr_employee_demo.yml', 'test/open2recruit2close_job.yml', + 'test/hr_demo.yml', ], 'installable': True, 'active': False, diff --git a/addons/hr/test/hr_demo.yml b/addons/hr/test/hr_demo.yml new file mode 100644 index 00000000000..6dee06d5eb3 --- /dev/null +++ b/addons/hr/test/hr_demo.yml @@ -0,0 +1,10 @@ +- + !record {model: hr.job, id: job_jr_appli, view: False}: + no_of_employee: 0.0 + no_of_recruitment: 5.0 +- + !record {model: hr.employee, id: employee1, view: False}: + address_id: base.main_address + company_id: base.main_company + department_id: dep_technical + user_id: base.user_demo diff --git a/addons/hr/test/hr_employee_demo.yml b/addons/hr/test/hr_employee_demo.yml deleted file mode 100644 index 846747e9a25..00000000000 --- a/addons/hr/test/hr_employee_demo.yml +++ /dev/null @@ -1,21 +0,0 @@ -- - !record {model: hr.department, id: dep_technical, view: False}: - manager_id: base.user_root - name: 'R & D' -- - !record {model: hr.job, id: job_jr_appli, view: False}: - department_id: 'dep_technical' - description: 'Position of Junior Application Engineer' - expected_employees: 5.0 - name: 'JAE' - no_of_employee: 0.0 - no_of_recruitment: 5.0 - state: open -- - !record {model: hr.employee, id: employee1, view: False}: - address_id: base.main_address - company_id: base.main_company - department_id: dep_technical - name: smith - parent_id: hr.employee1 - user_id: base.user_demo \ No newline at end of file diff --git a/addons/hr/test/open2recruit2close_job.yml b/addons/hr/test/open2recruit2close_job.yml index 7647f525146..0e618f87a3d 100644 --- a/addons/hr/test/open2recruit2close_job.yml +++ b/addons/hr/test/open2recruit2close_job.yml @@ -1,8 +1,6 @@ - - I test the process of Job position in hr module of OpenERP, + In order to test the process of Human Resource Management, I open Job Postion for "Jr. Application Engineer". - - I open Job Postion for "Jr. Application Engineer". -- !python {model: hr.job}: | self.job_open(cr, uid, [ref('job_jr_appli')]) - @@ -37,4 +35,4 @@ - !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'old' state and no_of_recruitment = 0}: - state == 'old' - - no_of_recruitment == 0 \ No newline at end of file + - no_of_recruitment == 0 From 14dd6ec79008c48eb61c8eb15c30d803ef07d757 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 28 Nov 2011 11:39:21 +0530 Subject: [PATCH 140/372] [FIX] hr_recruitment: remove non-exits fields in demo file bzr revid: hmo@tinyerp.com-20111128060921-4v61dzokconpnzl0 --- addons/hr_recruitment/hr_recruitment_demo.xml | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment_demo.xml b/addons/hr_recruitment/hr_recruitment_demo.xml index 0fc2c94f034..f3790f3a43f 100644 --- a/addons/hr_recruitment/hr_recruitment_demo.xml +++ b/addons/hr_recruitment/hr_recruitment_demo.xml @@ -4,22 +4,17 @@ - - - - - @@ -33,44 +28,32 @@ - - - - - - - - - - - - @@ -78,36 +61,28 @@ - - - - - - - - @@ -121,14 +96,10 @@ - - - - @@ -141,14 +112,10 @@ - - - - @@ -157,18 +124,14 @@ - - - - From 3cba14171c02bdf818ce2b02be2049dbd509fe0e Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 28 Nov 2011 11:52:47 +0530 Subject: [PATCH 141/372] [IMP] hr_recruitment: improve yml test process to check attachment in email after getting bzr revid: hmo@tinyerp.com-20111128062247-ztxmc9zdrdzy57yp --- addons/hr_recruitment/test/recruitment_process.yml | 8 +++++--- addons/hr_recruitment/test/resume.eml | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml index 64e8ab687a8..33232ab0f2f 100644 --- a/addons/hr_recruitment/test/recruitment_process.yml +++ b/addons/hr_recruitment/test/recruitment_process.yml @@ -15,8 +15,10 @@ applicant_ids = self.search(cr, uid, [('email_from','=', 'Mr. Richard Anderson ')]) assert applicant_ids, "Applicant is not created after getting the mail" applicant = self.browse(cr, uid, applicant_ids[0], context=context) - assert applicant.name == "Application for the post of Jr.application Programmer", "Subject does not match" + resume_ids = self.pool.get('ir.attachment').search(cr, uid, [('datas_fname','=','resume.doc'),('res_model','=',self._name),('res_id','=',applicant.id)]) + assert applicant.name == "Application for the post of Jr.application Programmer.", "Subject does not match" assert applicant.state == "draft" + assert len(resume_ids), "Resume does not attached." - I assign the Job position to the applicant - @@ -54,7 +56,7 @@ !python {model: hr.applicant}: | self.action_print_survey(cr, uid, [ref('hr_case_programmer')]) - - On a successful meeting with the applicant, I hired employee. + On a successful interview with the applicant, I hired employee. - !python {model: hr.applicant}: | self.case_close(cr, uid, [ref('hr_case_programmer')]) @@ -62,4 +64,4 @@ I check that applicant is "Hired". - !assert {model: hr.applicant, id: hr_case_programmer}: - - state == 'done' \ No newline at end of file + - state == 'done' diff --git a/addons/hr_recruitment/test/resume.eml b/addons/hr_recruitment/test/resume.eml index 9529873a49c..00cc5620563 100644 --- a/addons/hr_recruitment/test/resume.eml +++ b/addons/hr_recruitment/test/resume.eml @@ -24,11 +24,11 @@ X-YMail-OSG: 09Al2uQVM1n5JcQepgua6wQsww7jiatAHXaSsMjP5Qvk9Ba LLM1_BE.EOvXdW38ZC_hHcrM4xYaYSR7c0WaOQsR8EZeXk_Vhio7HHUrdxZl 1oZz7YWK9Q04M023JJoM4v6IrThy3BNepluEFFcavkyOnCw-- X-Yahoo-SMTP: oNtzSBqswBAqJIGYOgyGesyleENrhUEtEgBkQ053 -Received: from [192.168.1.30] (jagdish.n_panchal@180.211.100.2 with plain) +Received: from [192.168.1.30] (test@180.211.100.2 with plain) by smtp205.mail.ne1.yahoo.com with SMTP; 18 Nov 2011 01:26:47 -0800 PST Message-ID: <4EC624C7.6020000@yahoo.in> Date: Fri, 18 Nov 2011 14:56:31 +0530 -From: Richard Anderson +From: Mr. Richard Anderson User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: hr@mycompany.com From 9c582e04e7b00d0f022f853e6228df2c642e4b7f Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 28 Nov 2011 12:03:18 +0530 Subject: [PATCH 142/372] [REF] hr_recruitment: refector code of case_close_with_rmp of hr_recruitment bzr revid: hmo@tinyerp.com-20111128063318-02c90onrf005yo9t --- addons/hr_recruitment/hr_recruitment.py | 47 +++++++------------ .../test/recruitment_process.yml | 2 +- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 931600fef9f..60657e9ff85 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -403,14 +403,6 @@ class hr_applicant(crm.crm_case, osv.osv): return res def case_close(self, cr, uid, ids, *args): - """ - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of case's Ids - @param *args: Give Tuple Value - """ - employee_obj = self.pool.get('hr.employee') res = super(hr_applicant, self).case_close(cr, uid, ids, *args) for (id, name) in self.name_get(cr, uid, ids): message = _("Applicant '%s' is being hired.") % name @@ -418,29 +410,22 @@ class hr_applicant(crm.crm_case, osv.osv): return res def case_close_with_emp(self, cr, uid, ids, *args): - """ - @param self: The object pointer - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of case's Ids - @param *args: Give Tuple Value - """ - employee_obj = self.pool.get('hr.employee') - partner_obj = self.pool.get('res.partner') - address_id = False - applicant = self.browse(cr, uid, ids)[0] - if applicant.partner_id: - address_id = partner_obj.address_get(cr, uid, [applicant.partner_id.id], ['contact'])['contact'] - if applicant.job_id: - self.pool.get('hr.job').write(cr, uid, [applicant.job_id.id], {'no_of_recruitment': applicant.job_id.no_of_recruitment - 1}) - emp_id = employee_obj.create(cr,uid,{'name': applicant.partner_name or applicant.name, - 'job_id': applicant.job_id.id, - 'address_home_id': address_id, - 'department_id': applicant.department_id.id - }) - else: - raise osv.except_osv(_('Warning!'),_('You must define Applied Job for Applicant !')) - return self.case_close(cr, uid, ids, *args) + hr_employee = self.pool.get('hr.employee') + for applicant in self.browse(cr, uid, ids): + address_id = False + if applicant.partner_id: + address_id = applicant.partner_id.address_get(['contact'])['contact'] + if applicant.job_id: + applicant.job_id.write({'no_of_recruitment': applicant.job_id.no_of_recruitment - 1}) + emp_id = hr_employee.create(cr,uid,{'name': applicant.partner_name or applicant.name, + 'job_id': applicant.job_id.id, + 'address_home_id': address_id, + 'department_id': applicant.department_id.id + }) + self.case_close(cr, uid, [applicant.id], *args) + else: + raise osv.except_osv(_('Warning!'),_('You must define Applied Job for Applicant !')) + return True def case_reset(self, cr, uid, ids, *args): """Resets case as draft diff --git a/addons/hr_recruitment/test/recruitment_process.yml b/addons/hr_recruitment/test/recruitment_process.yml index 33232ab0f2f..43575137a6e 100644 --- a/addons/hr_recruitment/test/recruitment_process.yml +++ b/addons/hr_recruitment/test/recruitment_process.yml @@ -59,7 +59,7 @@ On a successful interview with the applicant, I hired employee. - !python {model: hr.applicant}: | - self.case_close(cr, uid, [ref('hr_case_programmer')]) + self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')]) - I check that applicant is "Hired". - From be3f9fa4362d095d6d5268f46e433c7bcbf5b2e3 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 28 Nov 2011 15:07:23 +0530 Subject: [PATCH 143/372] [IMP] clean YML and added draft2open2close_phase.yml bzr revid: tpa@tinyerp.com-20111128093723-8cny1olo2wcnitxt --- addons/project_long_term/__openerp__.py | 7 +- .../project_long_term_demo.xml | 6 +- .../test/draft2open2close_phase.yml | 40 +++ .../test/phase_constraint.yml | 118 --------- .../test/project_schedule_consecutive_day.yml | 127 --------- .../project_schedule_without_wroking_hour.yml | 76 ------ .../test/schedule_project_phases.yml | 221 ++++------------ .../test/schedule_project_tasks.yml | 93 ++----- .../test/test_schedule_phases_case1.yml | 76 ------ .../test/test_schedule_phases_case2.yml | 193 -------------- .../test/test_schedule_tasks_case1.yml | 246 ------------------ 11 files changed, 112 insertions(+), 1091 deletions(-) create mode 100644 addons/project_long_term/test/draft2open2close_phase.yml delete mode 100644 addons/project_long_term/test/phase_constraint.yml delete mode 100644 addons/project_long_term/test/project_schedule_consecutive_day.yml delete mode 100644 addons/project_long_term/test/project_schedule_without_wroking_hour.yml delete mode 100644 addons/project_long_term/test/test_schedule_phases_case1.yml delete mode 100644 addons/project_long_term/test/test_schedule_phases_case2.yml delete mode 100644 addons/project_long_term/test/test_schedule_tasks_case1.yml diff --git a/addons/project_long_term/__openerp__.py b/addons/project_long_term/__openerp__.py index 31522d63ea2..f4dd4637f0f 100644 --- a/addons/project_long_term/__openerp__.py +++ b/addons/project_long_term/__openerp__.py @@ -43,14 +43,9 @@ Features "init_xml": [], "demo_xml": ["project_long_term_demo.xml"], "test": [ - 'test/test_schedule_phases_case1.yml', 'test/schedule_project_phases.yml', 'test/schedule_project_tasks.yml', - 'test/test_schedule_phases_case2.yml', - 'test/project_schedule_consecutive_day.yml', - 'test/project_schedule_without_wroking_hour.yml', - 'test/phase_constraint.yml', - 'test/test_schedule_tasks_case1.yml', + 'test/draft2open2close_phase.yml', ], "update_xml": [ "security/ir.model.access.csv", diff --git a/addons/project_long_term/project_long_term_demo.xml b/addons/project_long_term/project_long_term_demo.xml index fe3f8c8e510..ac15249499e 100644 --- a/addons/project_long_term/project_long_term_demo.xml +++ b/addons/project_long_term/project_long_term_demo.xml @@ -37,9 +37,9 @@ - + - + Development and Integration @@ -60,7 +60,7 @@ Deployement and Training - + 10 diff --git a/addons/project_long_term/test/draft2open2close_phase.yml b/addons/project_long_term/test/draft2open2close_phase.yml new file mode 100644 index 00000000000..610ccb8180a --- /dev/null +++ b/addons/project_long_term/test/draft2open2close_phase.yml @@ -0,0 +1,40 @@ +- + I make "Collect Requirement and Make SRS" in open state. +- + !python {model: project.phase}: | + self.set_open(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after put in open. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}: + - state == "open" +- + I make Phase in pending state because of resource problem. +- + !python {model: project.phase}: | + self.set_pending(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after put in pending. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}: + - state == "pending" +- + I make Phase in cancel state. +- + !python {model: project.phase}: | + self.set_cancel(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after put in cancel. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}: + - state == "cancelled" +- + I make Phase "Design Model" in done state. +- + !python {model: project.phase}: | + self.set_done(cr, uid, [ref("project_phase_2")]) +- + I check state of phase after put in done. +- + !assert {model: project.phase, id: project_phase_2, severity: error, string: Phase should be in done state}: + - state == "done" \ No newline at end of file diff --git a/addons/project_long_term/test/phase_constraint.yml b/addons/project_long_term/test/phase_constraint.yml deleted file mode 100644 index f4fa09e6e38..00000000000 --- a/addons/project_long_term/test/phase_constraint.yml +++ /dev/null @@ -1,118 +0,0 @@ -- - Given that I have a project 'Test Phases'. -- - !record {model: project.project, id: project_project_developyamlproject0}: - name: "Develop Yaml Project Module" - date_start: !eval time.strftime('%Y-%m-%d') - resource_calendar_id: resource.timesheet_group1 - members: - - base.user_admin -- - And I create three human ressources to work on this project, an analyst. -- - !record {model: resource.resource, id: resource_resource_analyst1}: - calendar_id: resource.timesheet_group1 - name: Analyst - resource_type: user - time_efficiency: 1.0 - user_id: base.user_admin -- - I define a developer HR. -- - !record {model: resource.resource, id: resource_resource_develop0}: - calendar_id: resource.timesheet_group1 - name: Developer - resource_type: user - time_efficiency: 1.0 - user_id: base.user_admin -- - I define a tester HR. -- - !record {model: resource.resource, id: resource_resource_tester1}: - calendar_id: resource.timesheet_group1 - name: tester - resource_type: user - time_efficiency: 1.0 - user_id: base.user_admin -- - Then I create three phases for my projects; Analysis, Development, Testing. -- - The first phase is 'Analysis' and has a duration of 6 days. -- - !record {model: project.phase, id: project_phase_analysisflowforyaml0}: - date_start: !eval time.strftime('%Y-%m-%d') - duration: 6.0 - name: "Analysis" - product_uom: product.uom_day - project_id: project_project_developyamlproject0 - state: draft - -- - I update the constrain and the analysis phase to not start before 4 days. -- - !python {model : project.phase }: | - pass - import datetime - from dateutil.relativedelta import * - start = datetime.date.today() + relativedelta(days=4) - self.write(cr,uid, [(ref("project_phase_analysisflowforyaml0"))], {'constraint_date_start': start}) -- - The second phase is 'Development' and depend on the 'Analysis', with a duration of 6 days. -- - !record {model: project.phase, id: project_phase_developyaml0}: - duration: 6.0 - name: Development - product_uom: product.uom_day - project_id: project_project_developyamlproject0 - previous_phase_ids: - - project_phase_analysisflowforyaml0 - -- - I update the Constrain Date Start adn Date End for phase Develop yaml -- - !python {model : project.phase }: | - pass - import datetime - #from dateutil.relativedelta import * - #start = datetime.date.today() - relativedelta(days=5) - #end = datetime.date.today() + relativedelta(days=10) - #self.write(cr,uid, [(ref("project_phase_developyaml0"))], {'constraint_date_start': start, 'constraint_date_end':end}) -- - The third phase is 'Testing' and depend on the 'Develop' phase, with a duration of 6 days. -- - !record {model: project.phase, id: project_phase_testyaml0}: - duration: 6.0 - name: Testing - product_uom: product.uom_day - project_id: project_project_developyamlproject0 - previous_phase_ids: - - project_phase_developyaml0 -- - Then I launch the scheduler to compute starting and ending phases on all phases of this project. -- - !record {model: project.compute.phases, id: project_compute_phases_0}: - project_id: project_project_developyamlproject0 - target_project: one -- - !python {model: project.project}: | - self.schedule_phases(cr, uid, [ref("project_project_developyamlproject0")]) -- - After scheduling, I check the starting date and ending date on the phases are correct. -- - !python {model: project.phase}: | - import datetime - from dateutil.relativedelta import * - minstart = (datetime.date.today() + relativedelta(days=4)).strftime('%Y-%m-%d') - minend = (datetime.date.today() + relativedelta(days=11)).strftime('%Y-%m-%d') - - phase1=self.browse(cr, uid, ref('project_phase_analysisflowforyaml0')) - assert phase1.date_start>=minstart, 'Error, the Analysis phase '+phase1.date_start+' should start after '+str(minstart) - assert phase1.date_end>=minend, 'Error, the Analysis phase should end after '+str(minend) - - phase2=self.browse(cr, uid, ref('project_phase_developyaml0')) - assert phase2.date_start>=phase1.date_end, 'Error, the phase Development should start after the end of the Analysis phase' - - phase3=self.browse(cr, uid, ref('project_phase_testyaml0')) - assert phase3.date_start>=phase2.date_end, 'Error, the phase Testing should start after the end of the Development phase' - assert phase3.date_start=minstart, 'Error, the Collect Requirement and Make SRS phase '+phase1.date_start+' should start after '+str(minstart) + assert phase1.date_end>=minend, 'Error, the Collect Requirement and Make SRS phase should end after '+str(minend) + phase2=self.browse(cr, uid, ref('project_phase_2')) + assert phase2.date_start>=phase1.date_end, 'Error, the phase Design Model should start after the end of the Collect Requirement and Make SRS phase' + + phase3=self.browse(cr, uid, ref('project_phase_3')) + assert phase3.date_start>=phase2.date_end, 'Error, the phase Development and Integration should start after the end of the Design Model phase' + + phase4=self.browse(cr, uid, ref('project_phase_4')) + assert phase4.date_start>=phase3.date_end, 'Error, the phase Review and Testing should start after the end of the Development and Integration phase' + + phase5=self.browse(cr, uid, ref('project_phase_5')) + assert phase5.date_start>=phase4.date_end, 'Error, the phase Deployement and Training start after the end of the Review and Testing phase' + assert phase5.date_start= start),'Start dates are wrong: %s < %s !' % (first_phase.date_start[:10], start) - assert (first_phase.date_end >= end),'End dates are wrong: %s <%s!' % (first_phase.date_end, end) - - second_phase = self.browse(cr, uid, ref('project_phase_secondphase0_case2')) - start = first_phase.date_end - end = (datetime.date.today() + relativedelta(days=4)).strftime('%Y-%m-%d') - assert second_phase.date_start >= start, 'Dates are wrong on second phase: %s < %s!' % (second_phase.date_start, start) - assert second_phase.date_end >= end, 'Dates are wrong on second phase %s < %s!' % (second_phase.date_end, end) - diff --git a/addons/project_long_term/test/test_schedule_phases_case2.yml b/addons/project_long_term/test/test_schedule_phases_case2.yml deleted file mode 100644 index 35173a897a3..00000000000 --- a/addons/project_long_term/test/test_schedule_phases_case2.yml +++ /dev/null @@ -1,193 +0,0 @@ -- - In order to test scheduling of project phases, I create two different - working periods and resources. And schedule the phases. -- - I create first working period 'Working Time A'. -- - !record {model: resource.calendar, id: resource_calendar_workingtimea0}: - attendance_ids: - - dayofweek: '0' - hour_from: 10.0 - hour_to: 16.0 - name: Monday - - dayofweek: '1' - hour_from: 10.0 - hour_to: 16.0 - name: Tuesday - - dayofweek: '2' - hour_from: 10.0 - hour_to: 16.0 - name: Wednesday - - dayofweek: '3' - hour_from: 10.0 - hour_to: 16.0 - name: Thursday - name: Working Time A - -- - Creating a resource.calendar.attendance record -- - !record {model: resource.calendar.attendance, id: resource_calendar_attendance_monday0}: - calendar_id: resource_calendar_workingtimea0 - dayofweek: '0' - hour_from: 10.0 - hour_to: 16.0 - name: Monday -- - Creating a resource.calendar.attendance record -- - !record {model: resource.calendar.attendance, id: resource_calendar_attendance_tuesday0}: - calendar_id: resource_calendar_workingtimea0 - dayofweek: '1' - hour_from: 10.0 - hour_to: 16.0 - name: Tuesday -- - Creating a resource.calendar.attendance record -- - !record {model: resource.calendar.attendance, id: resource_calendar_attendance_wednesday0}: - calendar_id: resource_calendar_workingtimea0 - dayofweek: '2' - hour_from: 10.0 - hour_to: 16.0 - name: Wednesday -- - Creating a resource.calendar.attendance record -- - !record {model: resource.calendar.attendance, id: resource_calendar_attendance_thursday0}: - calendar_id: resource_calendar_workingtimea0 - dayofweek: '3' - hour_from: 10.0 - hour_to: 16.0 - name: Thursday -- - I create second working period 'Working Time B'. -- - !record {model: resource.calendar, id: resource_calendar_workingtimeb0}: - attendance_ids: - - dayofweek: '4' - hour_from: 9.0 - hour_to: 18.0 - name: Friday - name: Working Time B -- - Creating a resource.calendar.attendance record -- - !record {model: resource.calendar.attendance, id: resource_calendar_attendance_friday0}: - calendar_id: resource_calendar_workingtimeb0 - dayofweek: '4' - hour_from: 9.0 - hour_to: 18.0 - name: Friday -- - I create first resource say 'Resource X' without assigning working period. -- - !record {model: resource.resource, id: resource_resource_resourcex0}: - name: Resource X - resource_type: user - time_efficiency: 1.0 - user_id: base.user_admin -- - I create first resource say 'Resource Y' with working period 'Working Time B'. -- - !record {model: resource.resource, id: resource_resource_resourcey0}: - calendar_id: resource_calendar_workingtimeb0 - name: Resource Y - resource_type: user - time_efficiency: 1.0 - user_id: base.user_admin -- - I create a project 'Development and Testing' and assign working period 'Working Time A'. -- - !record {model: project.project, id: project_project_project0}: - balance: 0.0 - credit: 0.0 - currency_id: base.EUR - debit: 0.0 - effective_hours: 0.0 - members: - - base.user_admin - name: Development and Testing - planned_hours: 20.0 - progress_rate: 0.0 - quantity: 0.0 - quantity_max: 0.0 - resource_calendar_id: resource_calendar_workingtimea0 - state: open - tasks: - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task 1 - planned_hours: 10.0 - remaining_hours: 10.0 - state: draft - total_hours: 10.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task 2 - planned_hours: 10.0 - remaining_hours: 10.0 - state: draft - total_hours: 10.0 - total_hours: 10.0 - members: - - project.res_users_analyst - - project.res_users_project_manager - - project.res_users_technical_leader - - project.res_users_developer - - project.res_users_designer - - project.res_users_tester - type_ids: - - project.project_tt_specification - - project.project_tt_development - - project.project_tt_testing - - project.project_tt_merge - -- - I create a phase 'Initial Phase' for project 'Development and Testing'. -- - !record {model: project.phase, id: project_phase_phase0}: - date_start: '2011-01-03 08:00:00' - duration: 0.0 - name: Initial Phase - product_uom: product.uom_day - project_id: project_project_project0 - state: draft -- - I create first task 'Developing module' and assign 10h. -- - !record {model: project.task, id: project_task_task0}: - delay_hours: 0.0 - effective_hours: 0.0 - name: Developing module - planned_hours: 10.0 - project_id: project_project_project0 - remaining_hours: 10.0 - state: draft - total_hours: 10.0 - phase_id: project_phase_phase0 -- - I create first task 'Testing module' and assign 10h. -- - !record {model: project.task, id: project_task_task1}: - delay_hours: 0.0 - effective_hours: 0.0 - name: Testing module - planned_hours: 10.0 - project_id: project_project_project0 - remaining_hours: 10.0 - state: draft - total_hours: 10.0 - phase_id: project_phase_phase0 -- - Now I create a record to compute the phase of project. -- - !record {model: project.compute.phases, id: project_compute_phases0}: - target_project: 'one' - project_id: project_project_project0 -- - I schedule the phases. -- - !python {model: project.compute.phases}: | - self.check_selection(cr, uid, [ref("project_compute_phases0")]) - diff --git a/addons/project_long_term/test/test_schedule_tasks_case1.yml b/addons/project_long_term/test/test_schedule_tasks_case1.yml deleted file mode 100644 index 3bb0ea87c43..00000000000 --- a/addons/project_long_term/test/test_schedule_tasks_case1.yml +++ /dev/null @@ -1,246 +0,0 @@ -- - In order to test scheduling of tasks, I create four tasks with different sequences and schedule them. -- - I create first user. -- - !record {model: res.users, id: res_users_user0}: - company_id: base.main_company - context_lang: en_US - groups_id: - - base.group_partner_manager - - base.group_user - login: user1 - name: User 1 - password: user1 -- - I create second user. -- - !record {model: res.users, id: res_users_user1}: - company_id: base.main_company - context_lang: en_US - groups_id: - - base.group_partner_manager - - base.group_user - login: user2 - name: User 2 - password: user2 -- - I create a Project. -- - !record {model: project.project, id: project_project_projecta0}: - balance: 0.0 - credit: 0.0 - currency_id: base.EUR - debit: 0.0 - effective_hours: 0.0 - name: Project A - members: - - res_users_user0 - - res_users_user1 - phase_ids: - - date_start: '2011-01-06 08:00:00' - duration: 2.0 - name: Phase A - product_uom: product.uom_day - state: draft - task_ids: - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task D - planned_hours: 5.0 - remaining_hours: 5.0 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task C - planned_hours: 5.0 - remaining_hours: 5.0 - sequence: 11 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task B - planned_hours: 5.0 - remaining_hours: 5.0 - sequence: 13 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task A - planned_hours: 5.0 - remaining_hours: 5.0 - sequence: 14 - state: draft - total_hours: 5.0 - planned_hours: 20.0 - progress_rate: 0.0 - quantity: 0.0 - quantity_max: 0.0 - state: open - tasks: - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task D - planned_hours: 5.0 - remaining_hours: 5.0 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task C - planned_hours: 5.0 - remaining_hours: 5.0 - sequence: 11 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task B - planned_hours: 5.0 - remaining_hours: 5.0 - sequence: 13 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task A - planned_hours: 5.0 - remaining_hours: 5.0 - sequence: 14 - state: draft - total_hours: 5.0 - total_hours: 15.0 -- - I create first task with highest sequence. -- - !record {model: project.task, id: project_task_taska0}: - delay_hours: 0.0 - effective_hours: 0.0 - name: Task A - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - sequence: 14 - state: draft - total_hours: 5.0 -- - I create second task. -- - !record {model: project.task, id: project_task_taskb0}: - delay_hours: 0.0 - effective_hours: 0.0 - name: Task B - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - sequence: 13 - state: draft - total_hours: 5.0 -- - I create third task. -- - !record {model: project.task, id: project_task_taskc0}: - delay_hours: 0.0 - effective_hours: 0.0 - name: Task C - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - sequence: 11 - state: draft - total_hours: 5.0 -- - I create fourth task with lowest sequence. -- - !record {model: project.task, id: project_task_taskd0}: - delay_hours: 0.0 - effective_hours: 0.0 - name: Task D - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - state: draft - total_hours: 5.0 -- - Now I create a resource for first user. -- - !record {model: resource.resource, id: resource_resource_user0}: - name: User 1 - resource_type: user - time_efficiency: 1.0 - user_id: res_users_user0 -- - I create a resource for second user. -- - !record {model: resource.resource, id: resource_resource_user1}: - name: User 2 - resource_type: user - time_efficiency: 1.0 - user_id: res_users_user1 -- - Now I create one phase for the project. -- - !record {model: project.phase, id: project_phase_phasea0}: - date_start: '2011-01-06 08:00:00' - duration: 2.0 - name: Phase A - product_uom: product.uom_day - project_id: project_project_projecta0 - state: draft - task_ids: - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task D - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task C - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - sequence: 11 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task B - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - sequence: 13 - state: draft - total_hours: 5.0 - - delay_hours: 0.0 - effective_hours: 0.0 - name: Task A - planned_hours: 5.0 - project_id: project_project_projecta0 - remaining_hours: 5.0 - sequence: 14 - state: draft - total_hours: 5.0 -- - Now I create a record to schedule the tasks of project. -- - !record {model: project.compute.tasks, id: project_compute_tasks0}: - project_id: project_project_projecta0 -- - I schedule the tasks. -- - !python {model: project.compute.tasks}: | - self.compute_date(cr, uid, [ref("project_compute_tasks0")]) -- - I check that whether the tasks now allocated to respected resources or not. -- - !python {model: project.task}: | - task_ids = self.search(cr, uid, [('project_id','=',ref('project_project_projecta0'))]) - for task in self.browse(cr, uid, task_ids): - if (not task.date_start) or (not task.date_end): - raise AssertionError("Tasks are not scheduled.") From 5ea00d2f0c270cd6315251f241d4c51674be9bfa Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 28 Nov 2011 18:23:28 +0530 Subject: [PATCH 144/372] [IMP] project_long_term: improve YML test cases of phase bzr revid: hmo@tinyerp.com-20111128125328-vd4ovcibw844y0d7 --- addons/project_long_term/__openerp__.py | 4 +- .../project_long_term_demo.xml | 5 ++ .../test/draft2open2close_phase.yml | 40 ---------- .../project_long_term/test/phase_process.yml | 79 +++++++++++++++++++ .../test/schedule_project_phases.yml | 63 --------------- .../test/schedule_project_tasks.yml | 25 ------ 6 files changed, 85 insertions(+), 131 deletions(-) delete mode 100644 addons/project_long_term/test/draft2open2close_phase.yml create mode 100644 addons/project_long_term/test/phase_process.yml delete mode 100644 addons/project_long_term/test/schedule_project_phases.yml delete mode 100644 addons/project_long_term/test/schedule_project_tasks.yml diff --git a/addons/project_long_term/__openerp__.py b/addons/project_long_term/__openerp__.py index f4dd4637f0f..9c6e1410b41 100644 --- a/addons/project_long_term/__openerp__.py +++ b/addons/project_long_term/__openerp__.py @@ -43,9 +43,7 @@ Features "init_xml": [], "demo_xml": ["project_long_term_demo.xml"], "test": [ - 'test/schedule_project_phases.yml', - 'test/schedule_project_tasks.yml', - 'test/draft2open2close_phase.yml', + 'test/phase_process.yml', ], "update_xml": [ "security/ir.model.access.csv", diff --git a/addons/project_long_term/project_long_term_demo.xml b/addons/project_long_term/project_long_term_demo.xml index ac15249499e..4cd6d5cdec4 100644 --- a/addons/project_long_term/project_long_term_demo.xml +++ b/addons/project_long_term/project_long_term_demo.xml @@ -5,6 +5,10 @@ This Demo data file Human Resources, Phases and Resources,Tasks allocation and also run scheduling of phase and tasks. --> + + + + @@ -13,6 +17,7 @@ 30 + diff --git a/addons/project_long_term/test/draft2open2close_phase.yml b/addons/project_long_term/test/draft2open2close_phase.yml deleted file mode 100644 index 610ccb8180a..00000000000 --- a/addons/project_long_term/test/draft2open2close_phase.yml +++ /dev/null @@ -1,40 +0,0 @@ -- - I make "Collect Requirement and Make SRS" in open state. -- - !python {model: project.phase}: | - self.set_open(cr, uid, [ref("project_phase_1")]) -- - I check state of phase after put in open. -- - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}: - - state == "open" -- - I make Phase in pending state because of resource problem. -- - !python {model: project.phase}: | - self.set_pending(cr, uid, [ref("project_phase_1")]) -- - I check state of phase after put in pending. -- - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}: - - state == "pending" -- - I make Phase in cancel state. -- - !python {model: project.phase}: | - self.set_cancel(cr, uid, [ref("project_phase_1")]) -- - I check state of phase after put in cancel. -- - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}: - - state == "cancelled" -- - I make Phase "Design Model" in done state. -- - !python {model: project.phase}: | - self.set_done(cr, uid, [ref("project_phase_2")]) -- - I check state of phase after put in done. -- - !assert {model: project.phase, id: project_phase_2, severity: error, string: Phase should be in done state}: - - state == "done" \ No newline at end of file diff --git a/addons/project_long_term/test/phase_process.yml b/addons/project_long_term/test/phase_process.yml new file mode 100644 index 00000000000..77d7b6bce1a --- /dev/null +++ b/addons/project_long_term/test/phase_process.yml @@ -0,0 +1,79 @@ +- + In order to test process of Phases, +- + I create a record to schedule the phase of project. +- + !record {model: project.compute.phases, id: project_compute_phases01}: + target_project: 'one' + project_id: project.project_integrate_openerp +- + I schedule the phases. +- + !python {model: project.compute.phases}: | + self.check_selection(cr, uid, [ref("project_compute_phases01")]) +- + I check the starting date and ending date on the phases after scheduling. +- + !python {model: project.project}: | + project = self.browse(cr, uid, ref("project.project_integrate_openerp"), context=context) + def _convert(date): + import time + return time.strptime(date, '%Y-%m-%d %H:%M:%S') + def _check(phase, _convert, _check): #TOFIX: why need to pass function ? + for next_phase in phase.next_phase_ids: + assert _convert(next_phase.date_start) >= _convert(phase.date_end), "Phase does not start in proper date." + _check(next_phase, _convert, _check) + return True + + for phase in project.phase_ids: + + assert phase.date_start, "Start date should be computed." + assert phase.date_end, "End date should be computed." + if not phase.previous_phase_ids and phase.constraint_date_start: + assert _convert(phase.date_start) >= _convert(phase.constraint_date_start), "Phase does not start in proper date." + _check(phase, _convert, _check) +- + I open phase. +- + !python {model: project.phase}: | + self.set_open(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after opened. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}: + - state == "open" +- + I put phase in pending state. +- + !python {model: project.phase}: | + self.set_pending(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after put in pending. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}: + - state == "pending" +- + I make Phase in cancel state. +- + !python {model: project.phase}: | + self.set_cancel(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after cancelled. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}: + - state == "cancelled" +- + I put again in draft phase. +- + !python {model: project.phase}: | + self.set_draft(cr, uid, [ref("project_phase_1")]) +- + I close phase. +- + !python {model: project.phase}: | + self.set_done(cr, uid, [ref("project_phase_1")]) +- + I check state of phase after closed. +- + !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in done state}: + - state == "done" diff --git a/addons/project_long_term/test/schedule_project_phases.yml b/addons/project_long_term/test/schedule_project_phases.yml deleted file mode 100644 index c7a2addddb2..00000000000 --- a/addons/project_long_term/test/schedule_project_phases.yml +++ /dev/null @@ -1,63 +0,0 @@ -- - I Set working period to Project 'Integrate a Sale and Warehouse Management' -- - !python {model: project.project}: | - self.write(cr, uid, [ref("project.project_integrate_openerp")], {'resource_calendar_id': ref("resource.timesheet_group1")}) -- - I update the constrain and the "Collect Requirement and Make SRS" to not start before 4 days. -- - !python {model : project.phase }: | - pass - import datetime - from dateutil.relativedelta import * - start = datetime.date.today() + relativedelta(days=4) - self.write(cr,uid, [(ref("project_phase_1"))], {'constraint_date_start': start}) -- - I Schedule Phases of Project. -- - !python {model: project.project}: | - self.schedule_phases(cr, uid, ref("project.project_integrate_openerp")) -- - Now I create a record to compute the phase of project. -- - !record {model: project.compute.phases, id: project_compute_phases01}: - target_project: 'one' - project_id: project.project_integrate_openerp -- - I schedule the phases. -- - !python {model: project.compute.phases}: | - self.check_selection(cr, uid, [ref("project_compute_phases01")]) -- - Check if phases scheduled, check that either of phase's start_date, end_date and user_id is not null -- - !python {model: project.project}: | - prj=self.browse(cr, uid, [ref("project.project_integrate_openerp")])[0] - for phase in prj.phase_ids: - if (not phase.date_start) or (not phase.date_end): - raise AssertionError("Phase not scheduled") -- - After scheduling, I check the starting date and ending date on the phases are correct. -- - !python {model: project.phase}: | - import datetime - from dateutil.relativedelta import * - minstart = (datetime.date.today() + relativedelta(days=4)).strftime('%Y-%m-%d') - minend = (datetime.date.today() + relativedelta(days=5)).strftime('%Y-%m-%d') - - phase1=self.browse(cr, uid, ref('project_phase_1')) - assert phase1.date_start>=minstart, 'Error, the Collect Requirement and Make SRS phase '+phase1.date_start+' should start after '+str(minstart) - assert phase1.date_end>=minend, 'Error, the Collect Requirement and Make SRS phase should end after '+str(minend) - - phase2=self.browse(cr, uid, ref('project_phase_2')) - assert phase2.date_start>=phase1.date_end, 'Error, the phase Design Model should start after the end of the Collect Requirement and Make SRS phase' - - phase3=self.browse(cr, uid, ref('project_phase_3')) - assert phase3.date_start>=phase2.date_end, 'Error, the phase Development and Integration should start after the end of the Design Model phase' - - phase4=self.browse(cr, uid, ref('project_phase_4')) - assert phase4.date_start>=phase3.date_end, 'Error, the phase Review and Testing should start after the end of the Development and Integration phase' - - phase5=self.browse(cr, uid, ref('project_phase_5')) - assert phase5.date_start>=phase4.date_end, 'Error, the phase Deployement and Training start after the end of the Review and Testing phase' - assert phase5.date_start Date: Mon, 28 Nov 2011 18:25:47 +0530 Subject: [PATCH 145/372] [IMP] project_long_term: indetation in yml bzr revid: hmo@tinyerp.com-20111128125547-sy83re0c5vjb51sy --- addons/project_long_term/test/phase_process.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/project_long_term/test/phase_process.yml b/addons/project_long_term/test/phase_process.yml index 77d7b6bce1a..725c5b2a97d 100644 --- a/addons/project_long_term/test/phase_process.yml +++ b/addons/project_long_term/test/phase_process.yml @@ -41,7 +41,7 @@ I check state of phase after opened. - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in open state}: - - state == "open" + - state == "open" - I put phase in pending state. - @@ -51,7 +51,7 @@ I check state of phase after put in pending. - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in pending state}: - - state == "pending" + - state == "pending" - I make Phase in cancel state. - @@ -61,7 +61,7 @@ I check state of phase after cancelled. - !assert {model: project.phase, id: project_phase_1, severity: error, string: Phase should be in cancel state}: - - state == "cancelled" + - state == "cancelled" - I put again in draft phase. - From 342b0a1ac8b37d6bfb2a0ff3cf7dfdd6cb37b504 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Tue, 29 Nov 2011 12:00:29 +0530 Subject: [PATCH 146/372] [IMP] To show many2many field on form view. bzr revid: jra@tinyerp.com-20111129063029-6pvqwh4uvts1pcft --- addons/web_mobile/static/src/xml/web_mobile.xml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/addons/web_mobile/static/src/xml/web_mobile.xml b/addons/web_mobile/static/src/xml/web_mobile.xml index 1d6f81404d2..1deb752cab6 100644 --- a/addons/web_mobile/static/src/xml/web_mobile.xml +++ b/addons/web_mobile/static/src/xml/web_mobile.xml @@ -298,13 +298,22 @@
    -
  • +
  • -
-
+ + + + + From ccb8bb9a1f219d013568135b7d11c11377b24ad9 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 29 Nov 2011 18:04:20 +0530 Subject: [PATCH 147/372] [IMP] account: Changed the Tax name and code which is generated from template dynamically because of account name constrain on account.tax model. bzr revid: ron@tinyerp.com-20111129123420-oto8m9ug8tobje9s --- addons/account/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index a347f5bcce2..bb9c95a404f 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -3246,7 +3246,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): for tax_type, value in tax_dict.items(): tax_name = tax_type == 'sale' and 'TAX Received' or 'TAX Paid' if value > 0.0: - tax_string = _('TAX %s%%') % (value) + tax_string = _('TAX %s %s%%') % (tax_type, value) new_tax_code_temp = obj_tax_code_template.create(cr, uid, {'name': tax_string, 'code': tax_string}, context=context) new_paid_tax_code_temp = obj_tax_code_template.create(cr, uid, {'name': _('%s %s%%') % (tax_name, value), 'code': _('%s %s%%') % (tax_name, value)}, context=context) sales_tax_temp = obj_tax_temp.create(cr, uid, { From 940500782a1358f4b449a00e308d48528a662407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 29 Nov 2011 15:04:09 +0100 Subject: [PATCH 148/372] [ADD] new view definition for page bzr revid: rlo@openerp.com-20111129140409-mzelxhp40w5y093k --- addons/web/controllers/main.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 7dbd696cfb4..cbb73477c6a 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -605,6 +605,14 @@ def fix_view_modes(action): if 'views' not in action: generate_views(action) + id_form = None + for index, (id, mode) in enumerate(action['views']): + if mode == 'form': + id_form = id + break + if id_form is not None: + action['views'].insert(index + 1, (id_form, 'page')) + if action.pop('view_type', 'form') != 'form': return action From 5b0783dd7aa044b1b1cd3c742cb4a1c267cc4ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roberto=20L=C3=B3pez=20L=C3=B3pez=20=28OpenERP=29?= Date: Tue, 29 Nov 2011 15:39:11 +0100 Subject: [PATCH 149/372] [ADD] page view split out from form view bzr revid: rlo@openerp.com-20111129143911-ac4ptj0nh2nsbdqo --- addons/web/__openerp__.py | 1 + addons/web/static/src/js/boot.js | 2 +- addons/web/static/src/js/view_form.js | 155 +------------------------- addons/web/static/src/js/view_page.js | 152 +++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 155 deletions(-) create mode 100644 addons/web/static/src/js/view_page.js diff --git a/addons/web/__openerp__.py b/addons/web/__openerp__.py index a6eaa32b3cd..433bebb5429 100644 --- a/addons/web/__openerp__.py +++ b/addons/web/__openerp__.py @@ -42,6 +42,7 @@ "static/src/js/data_import.js", "static/src/js/search.js", "static/src/js/view_form.js", + "static/src/js/view_page.js", "static/src/js/view_list.js", "static/src/js/view_list_editable.js", "static/src/js/view_tree.js", diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js index 58dcd922ea9..c2aea24276b 100644 --- a/addons/web/static/src/js/boot.js +++ b/addons/web/static/src/js/boot.js @@ -59,7 +59,7 @@ openerp.web = function(instance) { openerp.web.formats(instance); openerp.web.chrome(instance); openerp.web.data(instance); - var files = ["views","search","list","form","list_editable","web_mobile","view_tree","data_export","data_import","view_editor"]; + var files = ["views","search","list","form", "page","list_editable","web_mobile","view_tree","data_export","data_import","view_editor"]; for(var i=0; i Date: Tue, 29 Nov 2011 15:58:10 +0100 Subject: [PATCH 150/372] [ADD] page view template split out from form template bzr revid: rlo@openerp.com-20111129145810-5l47j142zrn1ki50 --- addons/web/static/src/js/view_page.js | 1 + addons/web/static/src/xml/base.xml | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_page.js b/addons/web/static/src/js/view_page.js index cfa6f41e7ba..325f2bf7444 100644 --- a/addons/web/static/src/js/view_page.js +++ b/addons/web/static/src/js/view_page.js @@ -2,6 +2,7 @@ openerp.web.page = function (openerp) { openerp.web.views.add('page', 'openerp.web.PageView'); openerp.web.PageView = openerp.web.FormView.extend({ + form_template: "PageView", init: function () { this._super.apply(this, arguments); this.registry = openerp.web.form.readonly; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 1fe4d028db4..577c6b52368 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -656,11 +656,7 @@ - - -
@@ -674,6 +670,16 @@
+ + + + + + + +
From bb67abe9140d73f6c8ad4c25eefc9d38be777485 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 30 Nov 2011 11:11:10 +0100 Subject: [PATCH 151/372] [IMP] account_voucher: improvements inj usability + changed the semantic of the payment_rate, which now depicts the rate of the payment_rate_currency_id against the voucher currency (instead of the main currency) bzr revid: qdp-launchpad@openerp.com-20111130101110-p19ujgsaqgfnuv1r --- addons/account_voucher/account_voucher.py | 100 +++++++++++------- .../test/account_voucher_report.yml | 4 +- addons/account_voucher/test/case4_cad_chf.yml | 2 + .../voucher_payment_receipt_view.xml | 18 ++-- 4 files changed, 76 insertions(+), 48 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 6860665f71d..22824cb8db0 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -159,15 +159,6 @@ class account_voucher(osv.osv): res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) doc = etree.XML(res['arch']) - # replace the label of the field payment_rate - currency_obj = self.pool.get('res.currency') - base_currency_id = currency_obj.search(cr, uid, [('rate','=',1.0),('rate_ids','=',1.0)], context=context) - symbol = base_currency_id and currency_obj.name_get(cr, uid, base_currency_id, context=context)[0][1] - string = _("Rate for this operation: 1 %s is") % symbol - payment_rate_field = doc.xpath("//field[@name='payment_rate']") - for field in payment_rate_field: - field.set('string', string) - if context.get('type', 'sale') in ('purchase', 'payment'): nodes = doc.xpath("//field[@name='partner_id']") for node in nodes: @@ -183,17 +174,25 @@ class account_voucher(osv.osv): credit += l['amount'] return abs(amount - abs(credit - debit)) - def onchange_line_ids(self, cr, uid, ids, line_dr_ids, line_cr_ids, amount, context=None): + def onchange_line_ids(self, cr, uid, ids, line_dr_ids, line_cr_ids, amount, voucher_currency, context=None): context = context or {} if not line_dr_ids and not line_cr_ids: return {'value':{}} line_osv = self.pool.get("account.voucher.line") line_dr_ids = resolve_o2m_operations(cr, uid, line_osv, line_dr_ids, ['amount'], context) line_cr_ids = resolve_o2m_operations(cr, uid, line_osv, line_cr_ids, ['amount'], context) - return {'value': {'writeoff_amount': self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount)}} + + #loop into the lines to see if there is an amount allocated on a voucher line with a currency different than the voucher currency + is_multi_currency = False + for voucher_line in line_dr_ids+line_cr_ids: + if voucher_line.get('currency_id',False) != voucher_currency: + is_multi_currency = True + break + return {'value': {'writeoff_amount': self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount), 'is_multi_currency': is_multi_currency}} def _get_writeoff_amount(self, cr, uid, ids, name, args, context=None): if not ids: return {} + currency_obj = self.pool.get('res.currency') res = {} debit = credit = 0.0 for voucher in self.browse(cr, uid, ids, context=context): @@ -201,18 +200,24 @@ class account_voucher(osv.osv): debit += l.amount for l in voucher.line_cr_ids: credit += l.amount - res[voucher.id] = abs(voucher.amount - abs(credit - debit)) + currency = voucher.currency_id or voucher.company_id.currency_id + res[voucher.id] = currency_obj.round(cr, uid, currency, abs(voucher.amount - abs(credit - debit))) return res def _paid_amount_in_company_currency(self, cr, uid, ids, name, args, context=None): if not ids: return {} res = {} - debit = credit = 0.0 + voucher_rate = company_currency_rate = 1.0 for voucher in self.browse(cr, uid, ids, context=context): - rate = voucher.currency_id.rate or voucher.company_id.currency_id.rate - if voucher.currency_id == voucher.payment_rate_currency_id: - rate = voucher.payment_rate - res[voucher.id] = voucher.amount / rate * voucher.company_id.currency_id.rate + if voucher.currency_id: + ctx = context.copy() + ctx.update({'date': voucher.date}) + voucher_rate = self.browse(cr, uid, voucher.id, context=ctx).currency_id.rate + if voucher.company_id.currency_id.id == voucher.payment_rate_currency_id.id: + company_currency_rate = voucher.payment_rate + else: + company_currency_rate = voucher.company_id.currency_id.rate + res[voucher.id] = voucher.amount / voucher_rate * company_currency_rate return res _name = 'account.voucher' @@ -275,9 +280,10 @@ class account_voucher(osv.osv): 'analytic_id': fields.many2one('account.analytic.account','Write-Off Analytic Account', readonly=True, states={'draft': [('readonly', False)]}), 'writeoff_amount': fields.function(_get_writeoff_amount, string='Reconcile Amount', type='float', readonly=True), 'payment_rate_currency_id': fields.many2one('res.currency', 'Payment Rate Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}), - 'payment_rate': fields.float('Payment Rate', digits=(12,6), required=True, readonly=True, states={'draft': [('readonly', False)]}, - help='The specific rate that will be used for this voucher for the selected currency.'), + 'payment_rate': fields.float('Exchange Rate', digits=(12,6), required=True, readonly=True, states={'draft': [('readonly', False)]}, + help='The specific rate that will be used, in this voucher, between the selected currency (in \'Payment Rate Currency\' field) and the voucher currency.'), 'paid_amount_in_company_currency': fields.function(_paid_amount_in_company_currency, string='Paid Amount in Company Currency', type='float', readonly=True), + 'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'), } _defaults = { 'period_id': _get_period, @@ -448,10 +454,15 @@ class account_voucher(osv.osv): return default def onchange_rate(self, cr, uid, ids, rate, amount, currency_id, payment_rate_currency_id, company_id, context=None): - res = {'value': {}} - if rate and amount and currency_id and currency_id == payment_rate_currency_id: - company_rate = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.rate - res['value']['paid_amount_in_company_currency'] = amount / rate * company_rate + res = {'value': {'paid_amount_in_company_currency': amount}} + company_currency = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id + if rate and amount and currency_id:# and currency_id == payment_rate_currency_id: + voucher_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context).rate + if company_currency.id == payment_rate_currency_id: + company_rate = rate + else: + company_rate = self.pool.get('res.company').browse(cr, uid, company_id, context=context).currency_id.rate + res['value']['paid_amount_in_company_currency'] = amount / voucher_rate * company_rate return res def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, payment_rate_currency_id, company_id, context=None): @@ -578,6 +589,7 @@ class account_voucher(osv.osv): else: amount_original = currency_pool.compute(cr, uid, company_currency, currency_id, line.credit or line.debit or 0.0) amount_unreconciled = currency_pool.compute(cr, uid, company_currency, currency_id, abs(line.amount_residual)) + currency_id = line.currency_id and line.currency_id.id or line.company_id.currency_id.id rs = { 'name':line.move_id.name, 'type': line.credit and 'dr' or 'cr', @@ -588,6 +600,7 @@ class account_voucher(osv.osv): 'date_original':line.date, 'date_due':line.date_maturity, 'amount_unreconciled': amount_unreconciled, + 'currency_id': currency_id, } #split voucher amount by most old first, but only for lines in the same currency @@ -650,7 +663,9 @@ class account_voucher(osv.osv): res['value'].update({'period_id':pids[0]}) if payment_rate_currency_id: ctx.update({'date': date}) - payment_rate = self.pool.get('res.currency').browse(cr, uid, payment_rate_currency_id, context=ctx).rate + payment_rate = 1.0 + if payment_rate_currency_id != currency_id: + payment_rate = self.pool.get('res.currency').browse(cr, uid, payment_rate_currency_id, context=ctx).rate vals = self.onchange_payment_rate_currency(cr, uid, ids, currency_id, payment_rate, payment_rate_currency_id, date, amount, company_id, context=context) vals['value'].update({'payment_rate': payment_rate}) for key in vals.keys(): @@ -674,12 +689,13 @@ class account_voucher(osv.osv): currency_id = journal.currency.id ctx = context.copy() ctx.update({'date': date}) - payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context=ctx).rate - vals['value'].update({'payment_rate': payment_rate}) + #on change of the journal, we need to TODO coment me + payment_rate = 1.0 + res = self.onchange_rate(cr, uid, ids, payment_rate, amount, currency_id, currency_id, company_id, context=ctx) for key in res.keys(): vals[key].update(res[key]) - if currency_id: + vals['value'].update({'payment_rate': payment_rate}) vals['value'].update({'currency_id': currency_id}) vals['value'].update({'payment_rate_currency_id': currency_id}) res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context) @@ -912,12 +928,7 @@ class account_voucher(osv.osv): # the rate specified on the voucher is for the company currency rate_between_voucher_and_base = voucher.currency_id.rate or 1.0 rate_between_base_and_company = voucher.payment_rate or 1.0 - res = amount / rate_between_voucher_and_base * rate_between_base_and_company - elif voucher.payment_rate_currency_id.id == voucher.currency_id.id: - # the rate specified on the voucher is for the voucher currency - rate_between_base_and_company = voucher.company_id.currency_id.rate or 1.0 - rate_between_voucher_and_base = voucher.payment_rate or 1.0 - res = amount / rate_between_voucher_and_base * rate_between_base_and_company + res = currency_obj.round(cr, uid, voucher.company_id.currency_id, (amount / rate_between_voucher_and_base * rate_between_base_and_company)) else: # the rate specified on the voucher is not relevant, we use all the rates in the system res = currency_obj.compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, amount, context=context) @@ -997,7 +1008,7 @@ class account_voucher(osv.osv): if not (tax_data.base_code_id and tax_data.tax_code_id): raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name)) - # compute the amount in foreign currency. + # compute the amount in foreign currency amount_currency = False if line.move_line_id: # We want to set it on the account move line as soon as the original line had a foreign currency @@ -1200,6 +1211,20 @@ class account_voucher_line(osv.osv): rs_data[line.id] = res return rs_data + def _currency_id(self, cr, uid, ids, name, args, context=None): + ''' + This function returns the currency id of a voucher line. It's either the currency of the + associated move line (if any) or the currency of the voucher or the company currency. + ''' + res = {} + for line in self.browse(cr, uid, ids, context=context): + move_line = line.move_line_id + if move_line: + res[line.id] = move_line.currency_id and move_line.currency_id.id or move_line.company_id.currency_id.id + else: + res[line.id] = line.voucher_id.currency_id and line.voucher_id.currency_id.id or line.voucher_id.company_id.currency_id.id + return res + _columns = { 'voucher_id':fields.many2one('account.voucher', 'Voucher', required=1, ondelete='cascade'), 'name':fields.char('Description', size=256), @@ -1216,6 +1241,7 @@ class account_voucher_line(osv.osv): 'amount_original': fields.function(_compute_balance, multi='dc', type='float', string='Original Amount', store=True), 'amount_unreconciled': fields.function(_compute_balance, multi='dc', type='float', string='Open Balance', store=True), 'company_id': fields.related('voucher_id','company_id', relation='res.company', type='many2one', string='Company', store=True, readonly=True), + 'currency_id': fields.function(_currency_id, string='Currency', type='many2one', relation='res.currency', readonly=True), } _defaults = { 'name': '', @@ -1252,10 +1278,10 @@ class account_voucher_line(osv.osv): ttype = 'dr' else: ttype = 'cr' - account_id = move_line.account_id.id res.update({ - 'account_id':account_id, - 'type': ttype + 'account_id': move_line.account_id.id, + 'type': ttype, + 'currency_id': move_line.currency_id and move_line.currency_id.id or move_line.company_id.currency_id.id, }) return { 'value':res, diff --git a/addons/account_voucher/test/account_voucher_report.yml b/addons/account_voucher/test/account_voucher_report.yml index b41c33e4470..85432f747aa 100644 --- a/addons/account_voucher/test/account_voucher_report.yml +++ b/addons/account_voucher/test/account_voucher_report.yml @@ -1,7 +1,7 @@ - Demo for Account Voucher - - !record {model: account.voucher, id: account_voucher_voucheraxelor0}: + !record {model: account.voucher, id: account_voucher_voucheraxelor0again}: account_id: account.cash company_id: base.main_company journal_id: account.bank_journal @@ -19,6 +19,6 @@ - !python {model: account.voucher}: | import netsvc, tools, os - (data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher_voucheraxelor0")], {}, {}) + (data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher_voucheraxelor0again")], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data) diff --git a/addons/account_voucher/test/case4_cad_chf.yml b/addons/account_voucher/test/case4_cad_chf.yml index 7c0f9274ff8..f31a7393a8e 100644 --- a/addons/account_voucher/test/case4_cad_chf.yml +++ b/addons/account_voucher/test/case4_cad_chf.yml @@ -128,6 +128,8 @@ for item in voucher_id.line_cr_ids: if item.amount_unreconciled == 186.74: data += [(item.id, 186.74)] + else: + data += [(item.id, 0.0)] for line_id, amount in data: self.pool.get('account.voucher.line').write(cr, uid, [line_id], {'amount': amount}) assert (voucher_id.state=='draft'), "Voucher is not in draft state" diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index db7c9d9ec54..6ed7ab0fe7c 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -92,7 +92,7 @@ - + - + - + @@ -203,11 +203,11 @@ - + - + @@ -318,7 +318,7 @@ - + - + - + - + From 4cb6d48f1ff5fa21244396768ed82860f7ceb4a6 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Wed, 30 Nov 2011 16:56:14 +0530 Subject: [PATCH 152/372] [IMP] Improve m2m and o2m to show selected record in formview. bzr revid: jra@tinyerp.com-20111130112614-qrkmra8rzok7nksn --- .../web_mobile/static/src/js/form_mobile.js | 136 ++++++------------ .../web_mobile/static/src/xml/web_mobile.xml | 19 +-- 2 files changed, 47 insertions(+), 108 deletions(-) diff --git a/addons/web_mobile/static/src/js/form_mobile.js b/addons/web_mobile/static/src/js/form_mobile.js index cc816b75a21..13ff38bca5c 100644 --- a/addons/web_mobile/static/src/js/form_mobile.js +++ b/addons/web_mobile/static/src/js/form_mobile.js @@ -41,13 +41,13 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ var fields = result.fields; var view_fields = result.arch.children; var get_fields = this.get_fields(view_fields); + var values = self.datarecord; for (var j = 0; j < view_fields.length; j++) { if (view_fields[j].tag == 'notebook') { var notebooks = view_fields[j]; } } - self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : self.datarecord ,'temp_flag':'1'})); - self.formatdata(get_fields, fields, result, self.datarecord,self.element_id,'element'); + self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : values ,'temp_flag':'1'})); self.$element.find("[data-role=header]").find('h1').html(self.head_title); self.$element.find("[data-role=header]").find('#home').click(function(){ $.mobile.changePage("#oe_menu", "slide", false, true); @@ -55,110 +55,56 @@ openerp.web_mobile.FormView = openerp.web.Widget.extend({ self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(i){ for (var k = 0; k < notebooks.children.length; k++) { if (notebooks.children[k].attrs.string == $(this).attr('id')) { - get_fields = self.get_fields(notebooks.children[k].children); - for (var i = 0; i < get_fields.length; i++) { - if (fields[get_fields[i].attrs.name].type == 'one2many'){ - self.relational_fields = get_fields[i].attrs.name; - if(fields[get_fields[i].attrs.name].views.form){ - var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children); - var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields; - var notebook=fields[get_fields[i].attrs.name].views.form.arch; - } - } - } - $(this).find('div#page_content').html(self.render({'get_fields': get_fields,'fields' : result.fields, 'values' : self.datarecord})); + get_fields_notebook = self.get_fields(notebooks.children[k].children); + $(this).find('div#page_content').html(self.render({'get_fields': get_fields_notebook,'fields' : fields, 'values' : values})); } - self.formatdata(get_fields, fields, result, self.datarecord,'page_content','element'); } }); - self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').find('div#page_content').find('[data-role=content]').find('ul').find('li').click(function(ev){ + self.$element.find('#o2m_m2m').click(function(ev) { ev.preventDefault(); ev.stopPropagation(); - var latid,lastid; - $(this).parents().each(function(){ - latid = $(this).attr('id'); - self.$element.find('[data-role=collapsible-set]').find('[data-role=collapsible]').each(function(){ - if(latid==$(this).attr('id')){ - lastid = $(this).attr('id'); - } - }); - }); var relational = $(this).attr('for'); - if(result.fields[relational]){ - var head = $.trim($(this).text()); - var dataset = new openerp.web.DataSetSearch(self, result.fields[relational].relation, result.fields[relational].context); - dataset.domain=[['id', 'in', self.datarecord[relational]]]; - dataset.read_slice([], {limit:80}, function(result1,ids){ + var rel_field = fields[relational]; + var head = rel_field.string; + var rel_model = rel_field.relation; + var rel_ids = values[relational]; + if (rel_ids) { + var datasearch = new openerp.web.DataSetSearch(self, rel_field.relation, rel_field.context); + datasearch.domain=[['id', 'in', rel_ids]]; + datasearch.read_slice([], {limit:80}, function(listrec){ _.extend(self.action.context,{"html_name_get" : true}); - var dataset1 = new openerp.web.DataSet(self, result.fields[relational].relation,result.fields[relational].context); - dataset1.name_get(result1,function(res){ - var additional = ""; - if(res['html_name_get']){ - additional = res['display']; - } - if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){ - $('
').appendTo('#moe'); - $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res,'data': additional})); - $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('h1').html(head); - $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('#home').click(function(){ - $.mobile.changePage("#oe_menu", "slide", false, true); - }); - $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("a#list-id").click(function(ev){ - ev.preventDefault(); - ev.stopPropagation(); - var head_title = $(this).text(); - var listid = $(ev.currentTarget).data('id'); - dataset = new openerp.web.DataSetSearch(self, dataset.model, null, null); - dataset.read_slice([],{}, function (result_relational) { - for (var i = 0; i < result_relational.length; i++) { - if (result_relational[i].id == listid) { - var data_relational = result_relational[i]; - } - } - if(!$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html()){ - $('
').appendTo('#moe'); - for (var k = 0; k < notebooks.children.length; k++) { - if (notebooks.children[k].attrs.string == lastid) { - get_fields = self.get_fields(notebooks.children[k].children); - for (var i = 0; i < get_fields.length; i++) { - if (fields[get_fields[i].attrs.name].type == 'one2many'){ - self.relational_fields = get_fields[i].attrs.name; - if(fields[get_fields[i].attrs.name].views.form){ - var get_fields_test = self.get_fields(fields[get_fields[i].attrs.name].views.form.arch.children); - var fields_test = fields[get_fields[i].attrs.name]['views'].form.fields; - var notebook=fields[get_fields[i].attrs.name].views.form.arch; - } - } - } - } - } - if(notebook){ - $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(self.render({'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields_test, 'values' : data_relational, 'temp_flag':'1' })); - }else{ - $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(self.render({'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields, 'values' : data_relational, 'temp_flag':'1' })); - } - $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('h1').html(head_title); - $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('#home').click(function(){ - $.mobile.changePage("#oe_menu", "slide", false, true); - }); - if(notebook){ - self.formatdata(get_fields_test, fields_test, result, data_relational,'oe_form_'+listid+result.fields[relational].relation,'element'); - }else{ - self.formatdata(get_fields_test, fields, result, data_relational,'oe_form_'+listid+result.fields[relational].relation,'element'); - } - $.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true); - self.formatdata('', '', '', '','oe_form_'+listid+result.fields[relational].relation,'slider'); + var dataset = new openerp.web.DataSet(self, rel_field.relation,rel_field.context); + dataset.name_get(listrec,function(res){ + var additional = ""; + if(res['html_name_get']){ + additional = res['display']; + } + if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){ + $('
').appendTo('#moe'); + $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res,'data': additional})); + $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('h1').html(head); + $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('#home').click(function(){ + $.mobile.changePage("#oe_menu", "slide", false, true); + }); + $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("a#list-id").click(function(ev){ + ev.preventDefault(); + ev.stopPropagation(); + var head_title = $(this).text(); + var listid = $(ev.currentTarget).data('id'); + if(!$('[id^="oe_form_'+listid+rel_field.relation+'"]').html()){ + $('
').appendTo('#moe'); + this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+listid+rel_field.relation, listid, '', head, rel_field.relation, false); + this.formview.start(); }else{ - $.mobile.changePage('#oe_form_'+listid+result.fields[relational].relation, "slide", false, true); + $.mobile.changePage('#oe_form_'+listid+rel_field.relation, "slide", false, true); } }); - }); - $.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true); - }else{ - $.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true); - } + $.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true); + }else{ + $.mobile.changePage("#oe_list_"+relational+"_"+self.element_id, "slide", false, true); + } }); - }); + }); } }); self.$element.find('#m2o_btn').click(this.open_m2o_form); diff --git a/addons/web_mobile/static/src/xml/web_mobile.xml b/addons/web_mobile/static/src/xml/web_mobile.xml index 1deb752cab6..f94117e6e0e 100644 --- a/addons/web_mobile/static/src/xml/web_mobile.xml +++ b/addons/web_mobile/static/src/xml/web_mobile.xml @@ -279,7 +279,9 @@ @@ -296,24 +298,15 @@ - + - - -
From 832436c1487ca6accf074da8e73ce5cccda51c48 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 30 Nov 2011 14:30:08 +0100 Subject: [PATCH 153/372] [IMP] account_voucher: usability changes bzr revid: qdp-launchpad@openerp.com-20111130133008-lki16nzzlz78s0h8 --- addons/account_voucher/account_voucher.py | 6 ++--- .../voucher_payment_receipt_view.xml | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 22824cb8db0..999de8dfbf4 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -274,11 +274,11 @@ class account_voucher(osv.osv): 'payment_option':fields.selection([ ('without_writeoff', 'Keep Open'), ('with_writeoff', 'Reconcile Payment Balance'), - ], 'Payment Difference', required=True, readonly=True, states={'draft': [('readonly', False)]}), + ], 'Payment Difference', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="This field helps you to choose what you want to do with the eventual difference between the paid amount and the sum of allocated amounts. You can either choose to keep open this difference on the partner's account, or reconcile it with the payment(s)"), 'writeoff_acc_id': fields.many2one('account.account', 'Counterpart Account', readonly=True, states={'draft': [('readonly', False)]}), 'comment': fields.char('Counterpart Comment', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}), 'analytic_id': fields.many2one('account.analytic.account','Write-Off Analytic Account', readonly=True, states={'draft': [('readonly', False)]}), - 'writeoff_amount': fields.function(_get_writeoff_amount, string='Reconcile Amount', type='float', readonly=True), + 'writeoff_amount': fields.function(_get_writeoff_amount, string='Difference Amount', type='float', readonly=True, help="Computed as the difference between the amount stated in the voucher and the sum of allocation on the voucher lines."), 'payment_rate_currency_id': fields.many2one('res.currency', 'Payment Rate Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}), 'payment_rate': fields.float('Exchange Rate', digits=(12,6), required=True, readonly=True, states={'draft': [('readonly', False)]}, help='The specific rate that will be used, in this voucher, between the selected currency (in \'Payment Rate Currency\' field) and the voucher currency.'), @@ -1231,7 +1231,7 @@ class account_voucher_line(osv.osv): 'account_id':fields.many2one('account.account','Account', required=True), 'partner_id':fields.related('voucher_id', 'partner_id', type='many2one', relation='res.partner', string='Partner'), 'untax_amount':fields.float('Untax Amount'), - 'amount':fields.float('Amount', digits_compute=dp.get_precision('Account')), + 'amount':fields.float('Allocation', digits_compute=dp.get_precision('Account')), 'reconcile': fields.boolean('Full Reconcile'), 'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Dr/Cr'), 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'), diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 6ed7ab0fe7c..e2060a04533 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -102,8 +102,8 @@ - - + + @@ -116,8 +116,8 @@ - - + + @@ -177,9 +177,9 @@ - + - + @@ -193,9 +193,9 @@ - + - + @@ -329,9 +329,9 @@ - + - + @@ -345,9 +345,9 @@ - + - + From 8dcc7aac7ae32007795cf9c44f4a725a2c248404 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 30 Nov 2011 14:33:11 +0100 Subject: [PATCH 154/372] [IMP] account_voucher: usability changes bzr revid: qdp-launchpad@openerp.com-20111130133311-8t4sxrikywrkkkhh --- addons/account_voucher/voucher_payment_receipt_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index e2060a04533..13cbaa74688 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -252,7 +252,7 @@ - - + +
@@ -672,12 +670,10 @@ - - - - + + + + From f247fb7dccda0fad8c82706b2ad914f7367f5eee Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Mon, 5 Dec 2011 15:00:54 +0100 Subject: [PATCH 184/372] [FIX] pos bzr revid: rco@openerp.com-20111205140054-u85cerkhw65o8vnp --- addons/point_of_sale/point_of_sale_view.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index b1e3e6a6d00..165c6c83e3a 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -797,14 +797,16 @@ Start Point of Sale pos.ui + Point of Sale - images/pos.png - images/pos-hover.png + + From c2b1f5202658cd0efb366b4114bfad503c9d109e Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 5 Dec 2011 15:02:57 +0100 Subject: [PATCH 185/372] [REM] form view in mail message o2ms bzr revid: xmo@openerp.com-20111205140257-1h0dnuly3tqdqsnb --- addons/crm/crm_lead_view.xml | 61 +------------------ addons/crm_claim/crm_claim_view.xml | 28 +-------- .../crm_fundraising/crm_fundraising_view.xml | 28 +-------- addons/crm_helpdesk/crm_helpdesk_view.xml | 28 +-------- addons/event/event_view.xml | 28 +-------- addons/hr_recruitment/hr_recruitment_view.xml | 28 +-------- addons/mail/mail_thread_view.xml | 21 +------ addons/project_issue/project_issue_view.xml | 28 +-------- .../project_mailgate_view.xml | 24 +------- .../project_messages_view.xml | 9 --- 10 files changed, 10 insertions(+), 273 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 6527fa4cf25..e9c77b3bdc6 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -147,7 +147,7 @@ - + @@ -157,35 +157,6 @@ context="{'mail.compose.message.mode':'reply', 'message_id':active_id}" icon="terp-mail-replied" type="action" /> -
- - - - - - - - - - - - - - - - -