From 3d98f01646fc82233698d895170eadeaee459938 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Wed, 17 Jun 2009 09:27:15 +0200 Subject: [PATCH 002/594] [ADD] Added a module to easily enter RIBs (standard French bank details slips). bzr revid: ls@numerigraphe.fr-20090617072715-hdkf86qq0nskc5q7 --- addons/base_rib/__init__.py | 26 +++++++ addons/base_rib/__terp__.py | 40 +++++++++++ addons/base_rib/base_rib.py | 112 ++++++++++++++++++++++++++++++ addons/base_rib/base_rib_data.xml | 38 ++++++++++ addons/base_rib/base_rib_view.xml | 90 ++++++++++++++++++++++++ addons/base_rib/i18n/fr_FR.po | 81 +++++++++++++++++++++ 6 files changed, 387 insertions(+) create mode 100644 addons/base_rib/__init__.py create mode 100644 addons/base_rib/__terp__.py create mode 100644 addons/base_rib/base_rib.py create mode 100644 addons/base_rib/base_rib_data.xml create mode 100644 addons/base_rib/base_rib_view.xml create mode 100644 addons/base_rib/i18n/fr_FR.po diff --git a/addons/base_rib/__init__.py b/addons/base_rib/__init__.py new file mode 100644 index 00000000000..f715da6a386 --- /dev/null +++ b/addons/base_rib/__init__.py @@ -0,0 +1,26 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import base_rib + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/base_rib/__terp__.py b/addons/base_rib/__terp__.py new file mode 100644 index 00000000000..4712b449b9d --- /dev/null +++ b/addons/base_rib/__terp__.py @@ -0,0 +1,40 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + + +{ + 'name': 'RIB', + 'version': '0.1', + 'category': 'Generic Modules/Base', + 'description': """ +This module install the base for RIB bank accounts (French standard for bank accounts). +To make it easier to enter RIB data, it will also allow to search for banks by code. + + """, + "author" : "Numérigraphe SARL", + 'depends': ['base', 'account'], + 'init_xml': ['base_rib_data.xml', ], + 'update_xml': ['base_rib_view.xml', ], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_rib/base_rib.py b/addons/base_rib/base_rib.py new file mode 100644 index 00000000000..34c86902a67 --- /dev/null +++ b/addons/base_rib/base_rib.py @@ -0,0 +1,112 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import string +import unicodedata + +import netsvc +from osv import fields, osv + +# Add fields and behavior for French RIB +class res_partner_bank(osv.osv): + _inherit = "res.partner.bank" + + def _check_key(self, cr, uid, ids): + ''' + Check the RIB key + ''' + for bank_acc in self.browse(cr, uid, ids): + # ignore the accounts of type other than rib + if bank_acc.state !='rib': + continue + + # Fail if the needed values are empty of too short + if (not bank_acc.bank or not bank_acc.bank.code or len(bank_acc.bank.code) != 5 + or not bank_acc.office or len(bank_acc.office) != 5 + or not bank_acc.acc_number or len(bank_acc.acc_number) != 11 + or not bank_acc.key or len(bank_acc.key) != 2): + return False + + # get the rib data (without the key) + rib = "%s%s%s" % (bank_acc.bank.code, bank_acc.office, bank_acc.acc_number) + # translate letters into numbers according to a specific table (notice how s -> 2) + # Note: maketrans and translate work best with latin1 - that should not be a problem for RIB data + rib = rib.lower().encode('latin-1').translate(string.maketrans(u'abcdefghijklmnopqrstuvwxyz', u'12345678912345678923456789')) + + # compute the key + key = 97 - (100 * int(rib)) % 97 + + if int(bank_acc.key) != key: + return False + return True + + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + #overwrite the search method in order to search not only on bank type == basic account number but also on type == rib + res = super(res_partner_bank, self).search(cr, uid, args, offset, limit, order, context=context, count=count) + if filter(lambda x:x[0] == 'acc_number' , args): + #get the value of the search + rib_value = filter(lambda x:x[0] == 'acc_number' , args)[0][2] + #get the other arguments of the search + args1 = filter(lambda x:x[0] != 'acc_number' , args) + #add the new criterion + args1 += [('rib', 'ilike', rib_value)] + #append the results to the older search + res += super(res_partner_bank, self).search(cr, uid, args1, offset, limit, + order, context=context, count=count) + return res + + _columns = { + 'office': fields.char('Office Code', size=5, readonly=True, help="Office Code"), + 'key': fields.char('Key', size=2, readonly=True, help="The key is a number allowing to check the correctness of the other codes."), + } + + _constraints = [(_check_key, "The RIB key does not correspond to the other codes.", ["key"])] + +res_partner_bank() + +# overload the name_search method on banks to make it easier to enter RIB data +class res_bank(osv.osv): + _inherit = 'res.bank' + + # allow a search by code + def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): + if not args: + args = [] + if context is None: + context = {} + ids = [] + if name: + ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context) + if not ids: + ids = self.search(cr, user, [('code', operator, name)] + args, limit=limit, context=context) + return self.name_get(cr, user, ids, context) + + # show the code before the name + def name_get(self, cr, uid, ids, context=None): + result = [] + for bank in self.browse(cr, uid, ids, context): + result.append((bank.id, (bank.code and (bank.code + ' - ') or '') + bank.name)) + return result + +res_bank() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/base_rib/base_rib_data.xml b/addons/base_rib/base_rib_data.xml new file mode 100644 index 00000000000..40d57851912 --- /dev/null +++ b/addons/base_rib/base_rib_data.xml @@ -0,0 +1,38 @@ + + + + + + + RIB Bank Details + rib + + + bank + + + + + + office + + + + + + acc_number + + + + 11 + + + key + + + + + + diff --git a/addons/base_rib/base_rib_view.xml b/addons/base_rib/base_rib_view.xml new file mode 100644 index 00000000000..eacfaf1cb5b --- /dev/null +++ b/addons/base_rib/base_rib_view.xml @@ -0,0 +1,90 @@ + + + + + + res.partner.form.rib0.inherit + res.partner + + form + + + + + + res.partner.form.rib1.inherit + res.partner + + form + + + + + + + + + + + res.partner.form.rib2.inherit + res.partner + + form + + + + + + + + + diff --git a/addons/base_rib/i18n/fr_FR.po b/addons/base_rib/i18n/fr_FR.po new file mode 100644 index 00000000000..af12a611964 --- /dev/null +++ b/addons/base_rib/i18n/fr_FR.po @@ -0,0 +1,81 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * base_rib +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-06-16 14:15:16+0000\n" +"PO-Revision-Date: 2009-06-16 14:15:16+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_key_field +msgid "key" +msgstr "key" + +#. module: base_rib +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "XML non valide pour l'architecture de la vue" + +#. module: base_rib +#: model:ir.module.module,description:base_rib.module_meta_information +msgid "\n" +"This module install the base for RIB bank accounts (French standard for bank accounts). \n" +"To make it easier to enter RIB data, it will also allow to search for banks by code.\n" +"\n" +" " +msgstr "\n" +"Ce module configure la base pour la saisie des RIB (Relevés d'Identité Bancaires) standards français. \n" +"Pour faciliter la saisie des RIB, il permet également une recherche des banques par code.\n" +"\n" +" " + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_office_field +msgid "office" +msgstr "Agence" + +#. module: base_rib +#: field:res.partner.bank,office:0 +#: help:res.partner.bank,office:0 +msgid "Office Code" +msgstr "Code agence" + +#. module: base_rib +#: model:res.partner.bank.type,name:base_rib.bank_rib +msgid "RIB Bank Details" +msgstr "Relevé d'identité bancaire (RIB)" + +#. module: base_rib +#: help:res.partner.bank,key:0 +msgid "The key is a number allowing to check the correctness of the other codes." +msgstr "La clé est un nombre permettant de vérifier que les autres codes sont corrects." + +#. module: base_rib +#: field:res.partner.bank,key:0 +msgid "Key" +msgstr "Clé" + +#. module: base_rib +#: model:ir.module.module,shortdesc:base_rib.module_meta_information +msgid "RIB" +msgstr "RIB" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field +msgid "bank" +msgstr "bank" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field +msgid "acc_number" +msgstr "acc_number" + From cf00c7a7be240762baf092d30966a54a930d8df4 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Fri, 19 Jun 2009 10:28:35 +0200 Subject: [PATCH 003/594] Fixed licence for base_rib bzr revid: ls@numerigraphe.fr-20090619082835-b4vr0z9tojhpnk5a --- addons/base_rib/__init__.py | 4 +--- addons/base_rib/__terp__.py | 5 +---- addons/base_rib/base_rib.py | 4 +--- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/addons/base_rib/__init__.py b/addons/base_rib/__init__.py index f715da6a386..b49b0bdb212 100644 --- a/addons/base_rib/__init__.py +++ b/addons/base_rib/__init__.py @@ -1,9 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# Copyright (C) 2009 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/addons/base_rib/__terp__.py b/addons/base_rib/__terp__.py index 4712b449b9d..30741be0543 100644 --- a/addons/base_rib/__terp__.py +++ b/addons/base_rib/__terp__.py @@ -1,9 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# Copyright (C) 2009 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +18,6 @@ # ############################################################################## - { 'name': 'RIB', 'version': '0.1', diff --git a/addons/base_rib/base_rib.py b/addons/base_rib/base_rib.py index 34c86902a67..69a9d2284f2 100644 --- a/addons/base_rib/base_rib.py +++ b/addons/base_rib/base_rib.py @@ -1,9 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved -# $Id$ +# Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From 297637f890a77b7b119698f56ca6264fac71b1aa Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Fri, 19 Jun 2009 13:54:17 +0200 Subject: [PATCH 004/594] [IMP] POT file for base_rib. bzr revid: ls@numerigraphe.fr-20090619115417-e14n1md5j9aakzmc --- addons/base_rib/i18n/base_rib.pot | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 addons/base_rib/i18n/base_rib.pot diff --git a/addons/base_rib/i18n/base_rib.pot b/addons/base_rib/i18n/base_rib.pot new file mode 100644 index 00000000000..393825233e5 --- /dev/null +++ b/addons/base_rib/i18n/base_rib.pot @@ -0,0 +1,77 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * base_rib +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2009-06-19 11:39:18+0000\n" +"PO-Revision-Date: 2009-06-19 11:39:18+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_key_field +msgid "key" +msgstr "" + +#. module: base_rib +#: constraint:ir.ui.view:0 +msgid "Invalid XML for View Architecture!" +msgstr "" + +#. module: base_rib +#: model:ir.module.module,description:base_rib.module_meta_information +msgid "\n" +"This module install the base for RIB bank accounts (French standard for bank accounts). \n" +"To make it easier to enter RIB data, it will also allow to search for banks by code.\n" +"\n" +" " +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_office_field +msgid "office" +msgstr "" + +#. module: base_rib +#: field:res.partner.bank,office:0 +#: help:res.partner.bank,office:0 +msgid "Office Code" +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type,name:base_rib.bank_rib +msgid "RIB Bank Details" +msgstr "" + +#. module: base_rib +#: help:res.partner.bank,key:0 +msgid "The key is a number allowing to check the correctness of the other codes." +msgstr "" + +#. module: base_rib +#: field:res.partner.bank,key:0 +msgid "Key" +msgstr "" + +#. module: base_rib +#: model:ir.module.module,shortdesc:base_rib.module_meta_information +msgid "RIB" +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field +msgid "bank" +msgstr "" + +#. module: base_rib +#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field +msgid "acc_number" +msgstr "" + From 5ec8cd1146a15d170c5f460f570f38b6037889b9 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Mon, 23 May 2011 18:04:04 +0530 Subject: [PATCH 005/594] [FIX] analytic:Wrong adaptation of the partner address in the Project view lp bug: https://launchpad.net/bugs/781189 fixed bzr revid: ara@tinyerp.com-20110523123404-zjqi69go1ecv36f1 --- addons/account/project/project_view.xml | 3 ++- addons/analytic/analytic.py | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index 8fd35a21a89..983d8311229 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -88,7 +88,8 @@ - + + diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 6dfaac21e70..e487a742e47 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -236,6 +236,13 @@ class account_analytic_account(osv.osv): res['value']['partner_id'] = partner return res + def onchange_partner_id(self, cr, uid, ids, partner, context=None): + partner_obj = self.pool.get('res.partner') + if not partner: + return {'value':{'contact_id': False}} + address = partner_obj.address_get(cr, uid, [partner], ['contact']) + return {'value':{'contact_id': address['contact']}} + def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100): if not args: args=[] From ecd639c4ef8d7ab73cef51767ef3397e30bc9d94 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Wed, 25 May 2011 15:44:03 +0530 Subject: [PATCH 006/594] [FIX] STOCK:Physical Inventory - wrong calculation, now calculate current location stock not child location stock lp bug: https://launchpad.net/bugs/787717 fixed bzr revid: aag@tinyerp.co.in-20110525101403-l02frg06h70lq6y4 --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 636ae0cb067..7811d22377f 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2646,7 +2646,7 @@ class stock_inventory_line(osv.osv): return {'value': {'product_qty': 0.0, 'product_uom': False}} obj_product = self.pool.get('product.product').browse(cr, uid, product) uom = uom or obj_product.uom_id.id - amount = self.pool.get('stock.location')._product_get(cr, uid, location_id, [product], {'uom': uom, 'to_date': to_date})[product] + amount = self.pool.get('stock.location')._product_get(cr, uid, location_id, [product], {'uom': uom, 'to_date': to_date, 'compute_child': False})[product] result = {'product_qty': amount, 'product_uom': uom} return {'value': result} From f407e76f9167b8fbad0cbe50a8a23d93567a674d Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Wed, 25 May 2011 16:39:06 +0530 Subject: [PATCH 007/594] [FIX] Accounting - Generic Chart of Accounts - Wrong demo data lp bug: https://launchpad.net/bugs/785110 fixed bzr revid: ara@tinyerp.com-20110525110906-nel3idjx81zsuq5s --- addons/account/configurable_account_chart.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/account/configurable_account_chart.xml b/addons/account/configurable_account_chart.xml index 1a0a21d3971..14dceb185a6 100644 --- a/addons/account/configurable_account_chart.xml +++ b/addons/account/configurable_account_chart.xml @@ -593,12 +593,18 @@ - + - + + + + + + + From 753dba6bf7510c012da1d366b04c3c9b749d01a3 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Fri, 17 Jun 2011 19:13:05 +0530 Subject: [PATCH 008/594] [FIX] stock:payment term is set for supplier invoices in PO from Picking lp bug: https://launchpad.net/bugs/798256 fixed bzr revid: aag@tinyerp.co.in-20110617134305-2f5gvs58blj1e5rf --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index d478ab39c9c..ef71c273273 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1012,7 +1012,7 @@ class stock_picking(osv.osv): 'address_invoice_id': address_invoice_id, 'address_contact_id': address_contact_id, 'comment': comment, - 'payment_term': payment_term_id, + 'payment_term': address.partner_id.property_payment_term and address.partner_id.property_payment_term.id or False, 'fiscal_position': partner.property_account_position.id, 'date_invoice': context.get('date_inv',False), 'company_id': picking.company_id.id, From b55387a8bb0b8fd4b4e3164652cef72e839ad825 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Tue, 21 Jun 2011 14:27:43 +0530 Subject: [PATCH 009/594] [REF] account: Replaced tax mappings for Normal tax in generic chart of accounts demo data. bzr revid: uco@tinyerp.com-20110621085743-36fua2qguh2q1cj9 --- addons/account/configurable_account_chart.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/configurable_account_chart.xml b/addons/account/configurable_account_chart.xml index 14dceb185a6..2373d01618c 100644 --- a/addons/account/configurable_account_chart.xml +++ b/addons/account/configurable_account_chart.xml @@ -592,8 +592,8 @@ - - + + From 8e6ca32aebb6a20ccc3586814f9c263856154497 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Tue, 21 Jun 2011 17:55:25 +0530 Subject: [PATCH 010/594] [FIX] sale: Fixed wrong quantities on Sales Analysis report. lp bug: https://launchpad.net/bugs/798148 fixed bzr revid: uco@tinyerp.com-20110621122525-td4gwknknl92bx54 --- addons/sale/report/sale_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py index aaaec228d7b..57f47176b75 100644 --- a/addons/sale/report/sale_report.py +++ b/addons/sale/report/sale_report.py @@ -95,7 +95,7 @@ class sale_report(osv.osv): else u.name end) as uom_name, - sum(l.product_uom_qty * u.factor) as product_uom_qty, + sum(l.product_uom_qty / u.factor) as product_uom_qty, sum(l.product_uom_qty * l.price_unit) as price_total, pt.categ_id, l.order_id from From 965b3320826d05e807ed490817baa6012678065b Mon Sep 17 00:00:00 2001 From: "mayur maheshwari (Open ERP)" Date: Tue, 21 Jun 2011 18:15:42 +0530 Subject: [PATCH 011/594] [FIX]product: set a default value public price in pricelist rule lp bug: https://launchpad.net/bugs/799615 fixed bzr revid: mma@tinyerp.com-20110621124542-lldjf5fnjb6ff9e5 --- addons/product/pricelist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 81cec0e7d95..abbc6dc86f2 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -522,7 +522,7 @@ class product_pricelist_item(osv.osv): _description = "Pricelist item" _order = "sequence, min_quantity desc" _defaults = { - 'base': lambda *a: -1, + 'base': lambda *a: 1, 'min_quantity': lambda *a: 0, 'sequence': lambda *a: 5, 'price_discount': lambda *a: 0, From c5fe5a76c36097eef182bb19288e8a395d83c2e3 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Tue, 21 Jun 2011 18:59:56 +0530 Subject: [PATCH 012/594] [FIX] stock:payment term is set for supplier invoices in PO from Picking and code optimize lp bug: https://launchpad.net/bugs/798256 fixed bzr revid: aag@tinyerp.co.in-20110621132956-d3tru3edcsx430fe --- addons/stock/stock.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index ef71c273273..8b83cad915d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -971,7 +971,6 @@ class stock_picking(osv.osv): for picking in self.browse(cr, uid, ids, context=context): if picking.invoice_state != '2binvoiced': continue - payment_term_id = False partner = picking.address_id and picking.address_id.partner_id if not partner: raise osv.except_osv(_('Error, no partner !'), @@ -979,13 +978,7 @@ class stock_picking(osv.osv): if not inv_type: inv_type = self._get_invoice_type(picking) - - if inv_type in ('out_invoice', 'out_refund'): - account_id = partner.property_account_receivable.id - payment_term_id = self._get_payment_term(cr, uid, picking) - else: - account_id = partner.property_account_payable.id - + account_id = partner.property_account_payable.id address_contact_id, address_invoice_id = \ self._get_address_invoice(cr, uid, picking).values() address = address_obj.browse(cr, uid, address_contact_id, context=context) @@ -1012,7 +1005,7 @@ class stock_picking(osv.osv): 'address_invoice_id': address_invoice_id, 'address_contact_id': address_contact_id, 'comment': comment, - 'payment_term': address.partner_id.property_payment_term and address.partner_id.property_payment_term.id or False, + 'payment_term': self._get_payment_term(cr, uid, picking), 'fiscal_position': partner.property_account_position.id, 'date_invoice': context.get('date_inv',False), 'company_id': picking.company_id.id, From 91efe04bcbf794849dd583388a7b5c1ebbfe2cdc Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Wed, 22 Jun 2011 14:56:54 +0530 Subject: [PATCH 013/594] [FIX] stock:payment term is set for supplier invoices in PO from Picking and code optimize bzr revid: aag@tinyerp.co.in-20110622092654-2f96sin4szcnvcuy --- addons/stock/stock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 8b83cad915d..35f54c2c8c2 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -978,7 +978,11 @@ class stock_picking(osv.osv): if not inv_type: inv_type = self._get_invoice_type(picking) - account_id = partner.property_account_payable.id + + if inv_type in ('out_invoice', 'out_refund'): + account_id = partner.property_account_receivable.id + else: + account_id = partner.property_account_payable.id address_contact_id, address_invoice_id = \ self._get_address_invoice(cr, uid, picking).values() address = address_obj.browse(cr, uid, address_contact_id, context=context) From f469345cfdcadf9c2985d95bad6318535209a971 Mon Sep 17 00:00:00 2001 From: "mayur maheshwari (Open ERP)" Date: Mon, 27 Jun 2011 10:43:35 +0530 Subject: [PATCH 014/594] [FIX]purchase,sale,stock: putting a product UOM decimal prescription In quantity field lp bug: https://launchpad.net/bugs/800970 fixed bzr revid: mma@tinyerp.com-20110627051335-nj8cnvdd993aagfb --- addons/purchase/purchase.py | 2 +- addons/sale/sale.py | 2 +- addons/stock/wizard/stock_partial_move.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6f6ab0c1b44..124de6d2136 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -614,7 +614,7 @@ class purchase_order_line(osv.osv): _columns = { 'name': fields.char('Description', size=256, required=True), - 'product_qty': fields.float('Quantity', required=True, digits=(16,2)), + 'product_qty': fields.float('Quantity', required=True, digits_compute= dp.get_precision('Product UoM')), 'date_planned': fields.date('Scheduled Date', required=True, select=True), 'taxes_id': fields.many2many('account.tax', 'purchase_order_taxe', 'ord_id', 'tax_id', 'Taxes'), 'product_uom': fields.many2one('product.uom', 'Product UOM', required=True), diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 0b436f0dc91..53e60b3d1a2 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -856,7 +856,7 @@ class sale_order_line(osv.osv): 'type': fields.selection([('make_to_stock', 'from stock'), ('make_to_order', 'on order')], 'Procurement Method', required=True, readonly=True, states={'draft': [('readonly', False)]}), 'property_ids': fields.many2many('mrp.property', 'sale_order_line_property_rel', 'order_id', 'property_id', 'Properties', readonly=True, states={'draft': [('readonly', False)]}), 'address_allotment_id': fields.many2one('res.partner.address', 'Allotment Partner'), - 'product_uom_qty': fields.float('Quantity (UoM)', digits=(16, 2), required=True, readonly=True, states={'draft': [('readonly', False)]}), + 'product_uom_qty': fields.float('Quantity (UoM)', digits_compute= dp.get_precision('Product UoM'), required=True, readonly=True, states={'draft': [('readonly', False)]}), 'product_uom': fields.many2one('product.uom', 'Unit of Measure ', required=True, readonly=True, states={'draft': [('readonly', False)]}), 'product_uos_qty': fields.float('Quantity (UoS)', readonly=True, states={'draft': [('readonly', False)]}), 'product_uos': fields.many2one('product.uom', 'Product UoS'), diff --git a/addons/stock/wizard/stock_partial_move.py b/addons/stock/wizard/stock_partial_move.py index 874b22844d1..20bb351a42c 100644 --- a/addons/stock/wizard/stock_partial_move.py +++ b/addons/stock/wizard/stock_partial_move.py @@ -22,6 +22,7 @@ from osv import fields, osv from tools.translate import _ import time +import decimal_precision as dp class stock_partial_move_memory_out(osv.osv_memory): @@ -29,7 +30,7 @@ class stock_partial_move_memory_out(osv.osv_memory): _rec_name = 'product_id' _columns = { 'product_id' : fields.many2one('product.product', string="Product", required=True), - 'quantity' : fields.float("Quantity", required=True), + 'quantity' : fields.float("Quantity", required=True, digits_compute= dp.get_precision('Product UoM')), 'product_uom': fields.many2one('product.uom', 'Unit of Measure', required=True), 'prodlot_id' : fields.many2one('stock.production.lot', 'Production Lot'), 'move_id' : fields.many2one('stock.move', "Move"), From 3161713bea39e3dc1458ab1a869b9a956494f2af Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Fri, 15 Jul 2011 18:12:38 +0530 Subject: [PATCH 015/594] [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 016/594] [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 017/594] [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 018/594] [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 019/594] [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 020/594] [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 021/594] [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 022/594] [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 023/594] [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 024/594] [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 025/594] [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 026/594] [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 027/594] [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 028/594] [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 c565752d0000b6c9f9c8ae74719207a6d52c163a Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 22 Nov 2011 18:57:15 +0530 Subject: [PATCH 250/594] [FIX] crm: Clicked on forword button for lead forward to its partner, Its gave traceback bzr revid: ron@tinyerp.com-20111122132715-hiqd32vdckfxdqg1 --- addons/crm_partner_assign/wizard/crm_forward_to_partner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py index 29a60ba71ba..c49115078cd 100644 --- a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py +++ b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py @@ -64,9 +64,10 @@ class crm_lead_forward_to_partner(osv.osv_memory): res = {} res_id = context.get('active_id') model = context.get('active_model') - body_text = self._get_body_text(cr, uid, model, res_id, history_type, context=context) + lead = self.pool.get(model).browse(cr, uid, res_id, context) + body_text = self._get_info_body_text(cr, uid, lead, context=context) context['mail.compose.message.body'] = history_type - if msg_val: + if body_text: res = {'value': {'body_text' : body_text}} return res From f97682aac2c1640d3855e1db33232082713291b0 Mon Sep 17 00:00:00 2001 From: Antoine Huvelle Date: Tue, 22 Nov 2011 15:08:59 +0100 Subject: [PATCH 251/594] [IMP] fonts bzr revid: ahu@openerp.com-20111122140859-z0vff9cyfod0ykoa --- addons/web/static/src/css/base.css | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index dfd92da0916..72788351576 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -5,6 +5,7 @@ body.openerp { min-width: 1000px; overflow-y: scroll; font-size: 80%; + font-family: Ubuntu, Helvetica, sans-serif; } body.openerp, .openerp textarea, .openerp input, .openerp select, .openerp option, .openerp button, .openerp .ui-widget { @@ -272,7 +273,7 @@ label.error { filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#BD5E54', endColorstr='#90322A',GradientType=0 ); /* IE6-9 */ background: linear-gradient(top, #bd5e54 0%,#90322a 60%); /* W3C */ - border: 1px solid #6E2A24; + border: 1px solid #5E1A14; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -283,7 +284,7 @@ label.error { text-transform: uppercase; line-height: 20px; font-weight: bold; - font-size: 85%; + font-size: 75%; white-space: nowrap; } @@ -442,6 +443,8 @@ label.error { margin: 0; padding: 4px 10px; text-shadow: 0 1px 0 #111111; + font-weight:600; + line-height:14px; } .openerp .header_title small { color: #ccc; @@ -509,6 +512,10 @@ label.error { font-weight: bold; } +.openerp .logout { + font-size:80%; +} + /* Footer */ .openerp div.oe_footer { background: none repeat scroll 0 0 #CCCCCC; @@ -552,6 +559,9 @@ label.error { .openerp .oe_vm_switch { float: right; } +.openerp .oe-view-manager-header .oe_view_title { + font-size:150%; +} /* SearchView */ .openerp .filter_label, .openerp .filter_icon { @@ -831,6 +841,7 @@ label.error { .openerp .oe-list-pager .oe-pager-state { cursor: pointer; font-size:90%; + color:#555; } .openerp .oe-listview .oe-group-name { @@ -925,6 +936,10 @@ label.error { } /* Form */ +.openerp .oe_form_frame_cell input[type="checkbox"] { + margin-top:5px; + vertical-align:center; +} .openerp table.oe_frame td { color: #4c4c4c; } @@ -1000,7 +1015,7 @@ label.error { } .openerp .oe_forms label.oe_label, .openerp .oe_forms label.oe_label_help { - margin: 3px 0 0 10px; + margin: 3px 0 0 3px; } .openerp label.oe_label_help span { font-size: 80%; @@ -1199,6 +1214,7 @@ label.error { .openerp .view-manager-main-content { width: 100%; + padding:0px 7px; } .openerp .oe-view-manager-header { overflow: auto; @@ -1515,6 +1531,7 @@ label.error { .oe-shortcut-toggle { height: 20px; padding: 0; + margin-top:4px; width: 24px; cursor: pointer; display: block; From b3366f526e042936cb24a756987b089e3a558ea9 Mon Sep 17 00:00:00 2001 From: Antoine Huvelle Date: Tue, 22 Nov 2011 15:50:11 +0100 Subject: [PATCH 252/594] [IMP] kanban view font size bzr revid: ahu@openerp.com-20111122145011-1x3siw26qrwc8j51 --- addons/web_kanban/static/src/css/kanban.css | 23 +++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 86818f6541c..57fedecfbad 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -1,3 +1,4 @@ + .openerp .oe_kanban_view .ui-sortable-placeholder { border: 1px dotted black; visibility: visible !important; @@ -18,9 +19,10 @@ } .openerp .oe_kanban_group_title { - color: #000000; - font-size: 130%; + font-size: 100%; font-weight: bold; + padding-left:2px; + color: #666666; } .openerp .oe_kanban_group_title_undefined { color: #666666; @@ -45,10 +47,10 @@ .openerp .oe_kanban_fold_icon { cursor: pointer; float: left; - padding: 2px 2px 0 0; + padding: 4px 2px 0 2px; width: 16px; height: 16px; - background: url(/web_kanban/static/src/img/minus-icon.png) no-repeat; + background: url(/web_kanban/static/src/img/minus-icon.png) no-repeat center center; } .openerp .oe_kanban_group_folded .oe_kanban_fold_icon { background: url(/web_kanban/static/src/img/plus-icon.png) no-repeat; @@ -64,6 +66,7 @@ } .openerp ul.oe_kanban_aggregates span { text-decoration: underline; + font-size:90%; } .openerp .oe_kanban_action_button { @@ -90,12 +93,13 @@ padding: 0 4px 0 4px; } .openerp .oe_kanban_title2 { - font-size: 110%; + font-size: 100%; font-weight: bold; + color:#3A3A3A; padding: 0 4px 0 4px; } .openerp .oe_kanban_title3 { - font-size: 100%; + font-size: 95%; font-weight: normal; padding: 0 4px 0 4px; } @@ -105,6 +109,7 @@ } .openerp .oe_kanban_table { width: 100%; + font-size:95%; border: none; border-collapse: collapse; margin: 0; @@ -116,7 +121,13 @@ } .openerp .oe_kanban_box_content { padding: 4px; + font-size:90%; } +.openerp .oe_kanban_box_content div:last-child { + padding-top:4px; + color:#555; +} + .openerp .oe_kanban_buttons_set { border-top: 1px dotted; white-space: nowrap; From ea92099e3df707677b7bf8721e872b834bbea2af Mon Sep 17 00:00:00 2001 From: Antoine Huvelle Date: Tue, 22 Nov 2011 17:14:37 +0100 Subject: [PATCH 253/594] [IMP] non-editable view changes bzr revid: ahu@openerp.com-20111122161437-3d8q3v27uofvpii4 --- addons/web/static/src/css/base.css | 13 +++++++++++++ addons/web_kanban/static/src/css/kanban.css | 3 +++ 2 files changed, 16 insertions(+) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 72788351576..3b9071bec23 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -934,6 +934,19 @@ label.error { .openerp .oe_form_notebook .ui-tabs-selected { background: #f9f9f9; } +/* Unedit Form */ +.openerp .field_char, .openerp .field_date, .openerp .field_float, .openerp .field_selection, .openerp .oe_form_field_many2one a { + vertical-align:middle; + padding-top:3px; + font-size:90%; + color:#222; +} +.openerp .oe_form_field_many2one a { + color:#9A0404; + line-height:12px; +} + + /* Form */ .openerp .oe_form_frame_cell input[type="checkbox"] { diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css index 57fedecfbad..bc68c8068a0 100644 --- a/addons/web_kanban/static/src/css/kanban.css +++ b/addons/web_kanban/static/src/css/kanban.css @@ -102,6 +102,9 @@ font-size: 95%; font-weight: normal; padding: 0 4px 0 4px; + line-height:16px; +} +.openerp .oe_kanban_title3 img{ } .openerp .oe_kanban_small { font-size: 80%; From 25b36b599a25463fb9ca89ea2bca8fea4405e51f Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 22 Nov 2011 17:55:37 +0100 Subject: [PATCH 254/594] [IMP] account_voucher: multi currency handling bzr revid: qdp-launchpad@openerp.com-20111122165537-2c8a9ov2qjklq2wj --- addons/account_voucher/account_voucher.py | 140 ++++++++++++++---- .../account_voucher/test/account_voucher.yml | 1 - addons/account_voucher/test/sales_receipt.yml | 1 - .../voucher_payment_receipt_view.xml | 53 +++---- 4 files changed, 136 insertions(+), 59 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index fd6dac9f90d..4b099eedc66 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -90,6 +90,17 @@ class account_voucher(osv.osv): return tax_id return False + def _get_payment_rate_currency(self, cr, uid, context=None): + if context is None: context = {} + journal_pool = self.pool.get('account.journal') + journal_id = context.get('journal_id', False) + if journal_id: + journal = journal_pool.browse(cr, uid, journal_id, context=context) + if journal.currency: + return journal.currency.id + #no journal given in the context, use company currency as default + return self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id + def _get_currency(self, cr, uid, context=None): if context is None: context = {} journal_pool = self.pool.get('account.journal') @@ -143,11 +154,21 @@ 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']) - nodes = doc.xpath("//field[@name='partner_id']") + + # 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: node.set('domain', "[('supplier', '=', True)]") - res['arch'] = etree.tostring(doc) + res['arch'] = etree.tostring(doc) return res def _compute_writeoff_amount(self, cr, uid, line_dr_ids, line_cr_ids, amount): @@ -184,7 +205,10 @@ class account_voucher(osv.osv): res = {} debit = credit = 0.0 for voucher in self.browse(cr, uid, ids, context=context): - res[voucher.id] = voucher.amount / voucher.payment_rate + 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 return res _name = 'account.voucher' @@ -247,8 +271,9 @@ class account_voucher(osv.osv): '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), + '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 rate between the journal currency and the company currency for this particular payment.'), + help='The specific rate that will be used for this voucher for the selected currency.'), 'paid_amount_in_company_currency': fields.function(_paid_amount_in_company_currency, string='Paid Amount in Company Currency', type='float', readonly=True), } _defaults = { @@ -269,6 +294,7 @@ class account_voucher(osv.osv): 'payment_option': 'without_writeoff', 'comment': _('Write-Off'), 'payment_rate': 1.0, + 'payment_rate_currency_id': _get_payment_rate_currency, } def compute_tax(self, cr, uid, ids, context=None): @@ -374,7 +400,7 @@ class account_voucher(osv.osv): }) return {'value':default} - def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context=None): + def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, company_id=False, context=None): """price Returns a dict that contains new values and context @@ -413,20 +439,25 @@ class account_voucher(osv.osv): default['value']['account_id'] = account_id default['value']['type'] = ttype or tr_type - vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context) + vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, company_id, context) default['value'].update(vals.get('value')) return default - def onchange_rate(self, cr, uid, ids, rate, amount, context=None): - res = {'value': {'paid_amount_in_company_currency': 0.0}} - if rate and amount: - res['value']['paid_amount_in_company_currency'] = amount / rate + 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 return res - def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, context=None): + 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): + if context is None: + context = {} res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, amount, currency_id, ttype, date, context=context) - vals = self.onchange_rate(cr, uid, ids, rate, amount, context=context) + ctx = context.copy() + ctx.update({'date': date}) + vals = self.onchange_rate(cr, uid, ids, rate, amount, currency_id, payment_rate_currency_id, company_id, context=ctx) for key in vals.keys(): res[key].update(vals[key]) return res @@ -582,7 +613,22 @@ class account_voucher(osv.osv): default['value']['writeoff_amount'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price) return default - def onchange_date(self, cr, uid, ids, date, currency_id, amount, context=None): + def onchange_payment_rate_currency(self, cr, uid, ids, currency_id, payment_rate_currency_id, date, amount, company_id, context=None): + if context is None: + context = {} + res = {'value': {}} + #set the default payment rate of the voucher and compute the paid amount in company currency + if currency_id and currency_id == payment_rate_currency_id: + ctx = context.copy() + ctx.update({'date': date}) + payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context=ctx).rate + res['value'].update({'payment_rate': payment_rate}) + vals = self.onchange_rate(cr, uid, ids, payment_rate, amount, currency_id, payment_rate_currency_id, company_id, context=ctx) + for key in vals.keys(): + res[key].update(vals[key]) + return res + + def onchange_date(self, cr, uid, ids, date, currency_id, payment_rate_currency_id, amount, company_id, context=None): """ @param date: latest value from user input for field date @param args: other arguments @@ -590,22 +636,19 @@ class account_voucher(osv.osv): @return: Returns a dict which contains new values, and context """ res = {'value': {}} + #FIXME: use find() hereunder + #set the period of the voucher period_pool = self.pool.get('account.period') pids = period_pool.search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)]) if pids: res['value'].update({'period_id':pids[0]}) - #set the default payment rate of the voucher and compute the paid amount in company currency - payment_rate = 1.0 - if currency_id: - payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context={'date': date}).rate - res['value'].update({'payment_rate': payment_rate}) - vals = self.onchange_rate(cr, uid, ids, payment_rate, amount, context=context) + vals = self.onchange_payment_rate_currency(cr, uid, ids, currency_id, payment_rate_currency_id, date, amount, company_id, context=context) for key in vals.keys(): res[key].update(vals[key]) return res - def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, date, amount, ttype, context=None): + def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, date, amount, ttype, company_id, context=None): if not journal_id: return False journal_pool = self.pool.get('account.journal') @@ -620,12 +663,16 @@ class account_voucher(osv.osv): currency_id = False if journal.currency: currency_id = journal.currency.id - payment_rate = self.pool.get('res.currency').browse(cr, uid, currency_id, context={'date': date}).rate + 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}) - res = self.onchange_rate(cr, uid, ids, payment_rate, amount, context=context) + 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]) - vals['value'].update({'currency_id': currency_id}) + if currency_id: + 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) for key in res.keys(): vals[key].update(res[key]) @@ -730,9 +777,9 @@ class account_voucher(osv.osv): # TODO: Make this logic available. # -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt if voucher_brw.type in ('purchase', 'payment'): - credit = voucher_brw.amount / voucher_brw.payment_rate + credit = voucher_brw.paid_amount_in_company_currency#voucher_brw.amount / voucher_brw.payment_rate * voucher_brw.company_id.currency_id.rate elif voucher_brw.type in ('sale', 'receipt'): - debit = voucher_brw.amount / voucher_brw.payment_rate + debit = voucher_brw.paid_amount_in_company_currency#amount / voucher_brw.payment_rate * voucher_brw.company_id.currency_id.rate if debit < 0: credit = -debit; debit = 0.0 if credit < 0: debit = -credit; credit = 0.0 sign = debit - credit < 0 and -1 or 1 @@ -831,6 +878,24 @@ class account_voucher(osv.osv): } return (move_line, move_line_counterpart) + def _convert_amount(self, cr, uid, amount, voucher_id, context=None): + #TODO: doccument me + currency_obj = self.pool.get('res.currency') + voucher = self.browse(cr, uid, voucher_id, context=context) + res = amount + if voucher.payment_rate_currency_id.id == voucher.company_id.currency_id.id: + 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: + 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 + else: + res = currency_obj.compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, amount, context=ctx) + print 'res', res + return res + def voucher_move_line_create(self, cr, uid, voucher_id, line_total, move_id, company_currency, current_currency, context=None): ''' Create one account move line, on the given account move, per voucher line where amount is not 0.0. @@ -843,24 +908,32 @@ class account_voucher(osv.osv): :param company_currency: id of currency of the company to which the voucher belong :param current_currency: id of currency of the voucher :return: Tuple build as (remaining amount not allocated on voucher lines, list of account_move_line created in this method) - :rtype: tuple(int, list of int) + :rtype: tuple(float, list of int) ''' + if context is None: + context = {} move_line_obj = self.pool.get('account.move.line') currency_obj = self.pool.get('res.currency') tot_line = line_total rec_lst_ids = [] - voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context) + voucher_brw = self.pool.get('account.voucher').browse(cr, uid, voucher_id, context) + ctx = context.copy() + ctx.update({'date': voucher_brw.date}) for line in voucher_brw.line_ids: #create one move line per voucher line where amount is not 0.0 if not line.amount: continue - #we check if the voucher line is fully paid or not and create a move line to balance the payment and initial invoice if needed + #TODO: comment me + amount = self._convert_amount(cr, uid, line.untax_amount or line.amount, voucher_brw.id, context=ctx) + #residual amount in company currency + #amount_residual = line.move_line_id.amount_residual - amount + #TODO: remove me if line.amount == line.amount_unreconciled: - amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate + # amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate amount_residual = line.move_line_id.amount_residual - amount #residual amount in company currency else: - amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate + # amount = (line.untax_amount or line.amount) / voucher_brw.payment_rate amount_residual = 0.0 move_line = { 'journal_id': voucher_brw.journal_id.id, @@ -997,6 +1070,9 @@ class account_voucher(osv.osv): for voucher in self.browse(cr, uid, ids, context=context): if voucher.move_id: continue + #TODO: -need to check- Can't we just use the context returned by _sel_context? + ctx = context.copy() + ctx.update({'date': voucher.date}) company_currency = self._get_company_currency(cr, uid, voucher.id, context) current_currency = self._get_current_currency(cr, uid, voucher.id, context) context = self._sel_context(cr, uid, voucher.id, context) @@ -1010,9 +1086,9 @@ class account_voucher(osv.osv): line_total = move_line_brw.debit - move_line_brw.credit rec_list_ids = [] if voucher.type == 'sale': - line_total = line_total - (voucher.tax_amount / voucher.payment_rate) + line_total = line_total - self._convert_amount(cr, uid, voucher.tax_amount, voucher.id, context=ctx) elif voucher.type == 'purchase': - line_total = line_total + (voucher.tax_amount / voucher.payment_rate) + line_total = line_total + self._convert_amount(cr, uid, voucher.tax_amount, voucher.id, context=ctx) #create one move line per voucher line where amount is not 0.0 line_total, rec_list_ids = self.voucher_move_line_create(cr, uid, voucher.id, line_total, move_id, company_currency, current_currency, context) diff --git a/addons/account_voucher/test/account_voucher.yml b/addons/account_voucher/test/account_voucher.yml index 33ae609e3f3..7e5482aa931 100644 --- a/addons/account_voucher/test/account_voucher.yml +++ b/addons/account_voucher/test/account_voucher.yml @@ -5,7 +5,6 @@ account_id: account.cash amount: 1000.0 company_id: base.main_company - currency_id: base.EUR journal_id: account.bank_journal name: Voucher for Axelor narration: Basic Pc diff --git a/addons/account_voucher/test/sales_receipt.yml b/addons/account_voucher/test/sales_receipt.yml index d3fd720ec6d..7ea4f7d1c55 100644 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -5,7 +5,6 @@ account_id: account.a_recv amount: 30000.0 company_id: base.main_company - currency_id: base.EUR journal_id: account.sales_journal line_cr_ids: - account_id: account.a_sale diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 46720b2732c..4adebed8a1a 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -75,13 +75,13 @@
- + - + - - - - - - + + + + + + + @@ -140,14 +141,14 @@ - + - + @@ -188,12 +189,13 @@ - - + + - - + domain="[('type','=','other')]" colspan="4"/> + + + @@ -289,14 +291,14 @@ + on_change="onchange_amount(amount, payment_rate, partner_id, journal_id, currency_id, type, date, payment_rate_currency_id, company_id, context)"/> - + @@ -337,12 +339,13 @@ - - + + - - + domain="[('type','=','other')]" colspan="4"/> + + + From e2c80d7ca8bf0611fb5ea8c27e17f8d6a37dc6b0 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 23 Nov 2011 11:13:47 +0530 Subject: [PATCH 255/594] [FIX] crm: Click on Ge Assing button Traceback generate , put comments created demo data of crm_lead for onchange event bzr revid: ron@tinyerp.com-20111123054347-0mo8pkly1857beff --- addons/crm/__openerp__.py | 2 +- addons/crm_partner_assign/crm_lead_view.xml | 2 +- addons/crm_partner_assign/partner_geo_assign.py | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index ba073060456..f7d56ce373b 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -123,7 +123,7 @@ Creates a dashboard for CRM that includes: 'test/process/merge_opportunity.yml', 'test/process/cancel_lead.yml', 'test/process/segmentation.yml', - 'test/ui/demo_data.yml', + #'test/ui/demo_data.yml', TODO : After installing crm_partner_assign view error 'test/ui/duplicate_lead.yml', 'test/ui/delete_lead.yml' ], diff --git a/addons/crm_partner_assign/crm_lead_view.xml b/addons/crm_partner_assign/crm_lead_view.xml index 2ec3c85353b..7cf47b95939 100644 --- a/addons/crm_partner_assign/crm_lead_view.xml +++ b/addons/crm_partner_assign/crm_lead_view.xml @@ -27,7 +27,7 @@ - + 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 312/594] [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 313/594] [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 5e0a6fe7d762619af497aa7fdd0411aaf670bf2d Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 28 Nov 2011 12:27:18 +0530 Subject: [PATCH 314/594] [FIX] crm, crm_partner_assing: Fixed : [crm, crm_partner_assign installed] and i try to reinstall crm module and generate lead record from yml Its generated traceback: Error Cannot find field partner_assigned_id in the following view parts composing the view of object model crm.lead bzr revid: ron@tinyerp.com-20111128065718-qqtju7r8cxizdagq --- addons/crm/crm_lead_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index fad7859fee5..82be78a5728 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -444,7 +444,7 @@ Opportunities crm.lead form - 10 + 20 From 42a7b9f9a6e28352412817acd1fba728b7340d6d Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Mon, 28 Nov 2011 12:35:29 +0530 Subject: [PATCH 315/594] [IMP] crm, crm_claim: Removed commented lines from __openerp__.py bzr revid: ron@tinyerp.com-20111128070529-eizoo3f93d0qrfob --- addons/crm/__openerp__.py | 2 +- addons/crm_claim/__openerp__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index acba8d3c510..a98a0cbc6a4 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -123,7 +123,7 @@ Creates a dashboard for CRM that includes: 'test/process/merge_opportunity.yml', 'test/process/cancel_lead.yml', 'test/process/segmentation.yml', - 'test/ui/crm_demo.yml', #TODO : After installing crm_partner_assign view error + 'test/ui/crm_demo.yml', 'test/ui/duplicate_lead.yml', 'test/ui/delete_lead.yml' ], diff --git a/addons/crm_claim/__openerp__.py b/addons/crm_claim/__openerp__.py index 217bec232c1..8c3854ffd2e 100644 --- a/addons/crm_claim/__openerp__.py +++ b/addons/crm_claim/__openerp__.py @@ -49,7 +49,7 @@ automatically new claims based on incoming emails. 'crm_claim_demo.xml', ], 'test': ['test/process/claim.yml', - 'test/ui/claim_demo.yml'#TODO : After installing crm_partner_assign view error + 'test/ui/claim_demo.yml' ], 'installable': True, 'active': False, From 25f83943e19904a9358ad15fb59e6f26f2baffcf Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 15:43:48 +0100 Subject: [PATCH 316/594] =?UTF-8?q?[IMP]=20extensive=20module=20descriptio?= =?UTF-8?q?n=20[IMP]=20assign=20(c)=20back=20to=20Num=C3=A9rigraphe?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit lp bug: https://launchpad.net/bugs/387958 fixed bzr revid: ls@numerigraphe.fr-20111128144348-ccl8ays59rc2hvj2 --- addons/l10n_fr_rib/__init__.py | 2 +- addons/l10n_fr_rib/__openerp__.py | 17 ++++++++++++++--- addons/l10n_fr_rib/bank.py | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/addons/l10n_fr_rib/__init__.py b/addons/l10n_fr_rib/__init__.py index bdaab364c54..a061d3f40a2 100644 --- a/addons/l10n_fr_rib/__init__.py +++ b/addons/l10n_fr_rib/__init__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2011 OpenERP SA (). +# Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as diff --git a/addons/l10n_fr_rib/__openerp__.py b/addons/l10n_fr_rib/__openerp__.py index 16ae81fb431..87614dfa01e 100644 --- a/addons/l10n_fr_rib/__openerp__.py +++ b/addons/l10n_fr_rib/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2011 OpenERP SA (). +# Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -24,8 +24,19 @@ 'version': '1.0', 'category': 'Hidden', 'description': ''' -This module installs the base for RIB bank accounts (French standard for bank accounts). -To make it easier to enter RIB data, it will also allow to search for banks by code.''', +This module lets users enter the banking details of Partners in the RIB format (French standard for bank accounts details). +RIB Bank Accounts can be entered in the "Accounting" tab of the Partner form by specifying the account type "RIB". The four standard RIB fields will then become mandatory: +- Bank Code +- Office Code +- Account number +- RIB key +As a safety measure, OpenERP will check the RIB key whenever a RIB is saved, and will refuse to record the data if the key is incorrect. Please bear in mind that this can only happen when the user presses the "save" button, for example on the Partner Form. +Since each bank account may relate to a Bank, users may enter the RIB Bank Code in the Bank form - it will the pre-fill the Bank Code on the RIB when they select the Bank. +To make this easier, this module will also let users find Banks using their RIB code. + +The module base_iban can be a useful addition to this module, because French banks are now progressively adopting the international IBAN format instead of the RIB format. +The RIB and IBAN codes for a single account can be entered by recording two Bank Accounts in OpenERP: the first with the type "RIB", the second with the type "IBAN". +''', 'author' : u'Numérigraphe SARL', 'depends': ['base', 'account'], 'init_xml': ['bank_data.xml', ], diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index b1a285ef743..22b1bad01e1 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2011 OpenERP SA (). +# Copyright (C) 2011 Numérigraphe SARL. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as From 6710f39da0f85b43984d718be31ef201744ce729 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 16:10:16 +0100 Subject: [PATCH 317/594] [DEL] l10n_fr_rib: drop useless Bank Account search() overload bzr revid: ls@numerigraphe.fr-20111128151016-0z48km039apfq3q5 --- addons/l10n_fr_rib/bank.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index 22b1bad01e1..ea32bca4467 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -54,23 +54,6 @@ class res_partner_bank(osv.osv): return False return True - def search(self, cr, uid, args, offset=0, limit=None, order=None, - context=None, count=False): - """Search on type == rib""" - res = super(res_partner_bank, self).search(cr, uid, args, offset, - limit=limit, order=order, context=context, count=count) - if filter(lambda x:x[0] == 'acc_number' , args): - #get the value of the search - rib_value = filter(lambda x:x[0] == 'acc_number' , args)[0][2] - #get the other arguments of the search - args1 = filter(lambda x:x[0] != 'acc_number' , args) - #add the new criterion - args1 += [('rib', 'ilike', rib_value)] - #append the results to the older search - res += super(res_partner_bank, self).search(cr, uid, args1, offset, - limit, order, context=context, count=count) - return res - def onchange_bank_id(self, cr, uid, ids, bank_id, context=None): """Change the bank code""" result = super(res_partner_bank, self).onchange_bank_id(cr, uid, ids, bank_id, From a3229487ec6ef480158263e07b8595c7bbdd0c9f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 17:00:01 +0100 Subject: [PATCH 318/594] [REF] l10n_fr_rib: refactored bank name_search as suggested by Olivier Dony (OpenERP) [IMP] l10n_fr_rib: don't re-check error condition when constructing the message for key mismatch [FIx] l10n_fr_rib: wrong field name for bank code bzr revid: ls@numerigraphe.fr-20111128160001-q7re8fxr9lv2ad9g --- addons/l10n_fr_rib/bank.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index ea32bca4467..4875dc33512 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -61,7 +61,7 @@ class res_partner_bank(osv.osv): if bank_id: bank = self.pool.get('res.bank').browse(cr, uid, bank_id, context=context) - result['bank_code'] = bank.code + result['bank_code'] = bank.rib_code return {'value': result} _columns = { @@ -74,8 +74,6 @@ class res_partner_bank(osv.osv): def _construct_constraint_msg(self, cr, uid, ids, context=None): """Quote the data in the warning message""" - if self._check_key(cr, uid, ids): - return # Only process the first id if type(ids) not in (int, long): id = ids[0] @@ -100,17 +98,17 @@ class res_bank(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): - """Search by bank code""" - if args is None: - args = [] - ids = [] - if name: - ids = self.search(cr, user, [('name', operator, name)] + args, + """Search by bank code in addition to the standard search""" + # Get the standard results + results = super(res_bank, self).name_search(cr, user, + name, args=args ,operator=operator, context=context, limit=limit) + # Get additional results using the RIB code + ids = self.search(cr, user, [('rib_code', operator, name)], limit=limit, context=context) - if not ids: - ids = self.search(cr, user, [('code', operator, name)] + args, - limit=limit, context=context) - return self.name_get(cr, user, ids, context) + # Merge the results + results = list(set(results + self.name_get(cr, user, ids, context))) + print results + return results _columns = { 'rib_code': fields.char('RIB Bank Code', size=64), From 64c50d804ca677c87bc35a61be113d5d56b0cef9 Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 28 Nov 2011 17:05:29 +0100 Subject: [PATCH 319/594] [IMP] remove print statement bzr revid: ls@numerigraphe.fr-20111128160529-f7nz0d3n0vqber8h --- addons/l10n_fr_rib/bank.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/l10n_fr_rib/bank.py b/addons/l10n_fr_rib/bank.py index 4875dc33512..6f7fe819d13 100644 --- a/addons/l10n_fr_rib/bank.py +++ b/addons/l10n_fr_rib/bank.py @@ -107,7 +107,6 @@ class res_bank(osv.osv): limit=limit, context=context) # Merge the results results = list(set(results + self.name_get(cr, user, ids, context))) - print results return results _columns = { From 342b0a1ac8b37d6bfb2a0ff3cf7dfdd6cb37b504 Mon Sep 17 00:00:00 2001 From: "Jiten (OpenERP)" Date: Tue, 29 Nov 2011 12:00:29 +0530 Subject: [PATCH 320/594] [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 42f388bfa979db3a674fb6b01f2cd197a5409daf Mon Sep 17 00:00:00 2001 From: Vo Minh Thu Date: Tue, 29 Nov 2011 12:20:32 +0100 Subject: [PATCH 321/594] [IMP] openerp.wizard: added deprecation warning as wizards must be implemented using the TransientModel class. bzr revid: vmt@openerp.com-20111129112032-urq2qno8yu1hfan8 --- openerp/wizard/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openerp/wizard/__init__.py b/openerp/wizard/__init__.py index 2ed01921afa..55bf68292e6 100644 --- a/openerp/wizard/__init__.py +++ b/openerp/wizard/__init__.py @@ -31,6 +31,7 @@ from openerp.osv.osv import except_osv from openerp.osv.orm import except_orm from openerp.netsvc import Logger, LOG_ERROR import sys +import warnings class except_wizard(Exception): def __init__(self, name, value): @@ -43,6 +44,10 @@ class interface(netsvc.Service): def __init__(self, name): assert not self.exists('wizard.'+name), 'The wizard "%s" already exists!' % (name,) + warnings.warn( + "The wizard %s uses the deprecated openerp.wizard.interface class.\n" + "It must use the openerp.osv.TransientModel class instead." % \ + self._name, DeprecationWarning, stacklevel=3) super(interface, self).__init__('wizard.'+name) self.wiz_name = name From ccb8bb9a1f219d013568135b7d11c11377b24ad9 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 29 Nov 2011 18:04:20 +0530 Subject: [PATCH 322/594] [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 323/594] [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 324/594] [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:43:05 +0100 Subject: [PATCH 325/594] ci before merge bzr revid: ahu@openerp.com-20111129144305-98tbd9ur7ksk37n9 --- addons/web/static/src/css/base.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 4bd920eb3ab..44d7ac89c8b 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1113,12 +1113,17 @@ label.error { } /* Uneditable Form View */ +.openerp .oe_form_readonly { + +} .openerp .oe_form_readonly .field_char, .openerp .oe_form_readonly .oe_form_field_email { - padding-top:4px; + padding-top:4px; + background-color:white; } .openerp .oe_form_readonly .field_selection { padding-top:2px; + background-color:white; } From a9a4f65dd3f17ef916b597ca163a226208e71c05 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:58:10 +0100 Subject: [PATCH 326/594] [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 b98a370ca6fb4f4f1fbfd2052abf95e73374c2ee Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 30 Nov 2011 11:00:24 +0530 Subject: [PATCH 327/594] [FIX]:bad layout of dashboard lp bug: https://launchpad.net/bugs/897227 fixed bzr revid: ksa@tinyerp.com-20111130053024-tudikew3uo8zx14q --- addons/hr/hr_board.xml | 2 +- addons/hr_timesheet_sheet/board_hr_timesheet_view.xml | 2 ++ addons/mrp/board_manufacturing_view.xml | 2 +- addons/project/board_project_view.xml | 2 +- addons/project_scrum/board_project_scrum_view.xml | 2 +- addons/stock/board_warehouse_view.xml | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/hr/hr_board.xml b/addons/hr/hr_board.xml index 620f1f51c88..07fa76bba16 100644 --- a/addons/hr/hr_board.xml +++ b/addons/hr/hr_board.xml @@ -8,7 +8,7 @@ form - + diff --git a/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml b/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml index 39ab5fe3482..88e56ec6639 100644 --- a/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml +++ b/addons/hr_timesheet_sheet/board_hr_timesheet_view.xml @@ -41,7 +41,9 @@ form + + diff --git a/addons/mrp/board_manufacturing_view.xml b/addons/mrp/board_manufacturing_view.xml index 427780f344c..55deb48a83d 100644 --- a/addons/mrp/board_manufacturing_view.xml +++ b/addons/mrp/board_manufacturing_view.xml @@ -7,7 +7,7 @@ form - + diff --git a/addons/project/board_project_view.xml b/addons/project/board_project_view.xml index a58557c94ba..50fa1b4f613 100644 --- a/addons/project/board_project_view.xml +++ b/addons/project/board_project_view.xml @@ -81,7 +81,7 @@ form - + diff --git a/addons/project_scrum/board_project_scrum_view.xml b/addons/project_scrum/board_project_scrum_view.xml index 2a9d3532b2d..dd01832b575 100644 --- a/addons/project_scrum/board_project_scrum_view.xml +++ b/addons/project_scrum/board_project_scrum_view.xml @@ -76,7 +76,7 @@ form - + diff --git a/addons/stock/board_warehouse_view.xml b/addons/stock/board_warehouse_view.xml index 3c645aecb5b..43600c1201d 100644 --- a/addons/stock/board_warehouse_view.xml +++ b/addons/stock/board_warehouse_view.xml @@ -45,7 +45,7 @@ form - + From a65a26d178ba59f5ea0cc5f41a858f6417939ac1 Mon Sep 17 00:00:00 2001 From: "Amit Bhavsar (Open ERP)" Date: Wed, 30 Nov 2011 11:04:26 +0530 Subject: [PATCH 328/594] [polish3],rename the string and remove col bzr revid: amb@tinyerp.com-20111130053426-3wjau1hcgmagq6hm --- addons/survey/survey_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 0188d9555e8..26b19eeccd9 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -37,7 +37,7 @@ - + From a7c5f12504209b6f2b022dcbd525253e4cd13172 Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Wed, 30 Nov 2011 12:57:59 +0530 Subject: [PATCH 329/594] [FIX] account : Account voucher: Analytic account associated with write off entries while payment does not consider lp bug: https://launchpad.net/bugs/893977 fixed bzr revid: bde@tinyerp.com-20111130072759-n1oqq2dg2l3j313k --- addons/account_voucher/account_voucher.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index fd6dac9f90d..a0d2b4660cb 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -935,6 +935,7 @@ class account_voucher(osv.osv): move_line = {} voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context) + analytic_id = voucher_brw.analytic_id.id or False current_currency_obj = voucher_brw.currency_id or voucher_brw.journal_id.company_id.currency_id if not currency_obj.is_zero(cr, uid, current_currency_obj, line_total): @@ -958,6 +959,7 @@ class account_voucher(osv.osv): 'debit': diff < 0 and -diff or 0.0, 'amount_currency': company_currency <> current_currency and voucher_brw.writeoff_amount or False, 'currency_id': company_currency <> current_currency and current_currency or False, + 'analytic_account_id': analytic_id } return move_line From d24f90eebf84f7e079744756d0adf68cf090a8db Mon Sep 17 00:00:00 2001 From: "Bharat (OpenERP)" Date: Wed, 30 Nov 2011 14:23:35 +0530 Subject: [PATCH 330/594] [IMP] : directly assigned the analytic_id if persists bzr revid: bde@tinyerp.com-20111130085335-tkx6zg8f8hvzgu1z --- addons/account_voucher/account_voucher.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index a0d2b4660cb..bec616e2c69 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -935,7 +935,6 @@ class account_voucher(osv.osv): move_line = {} voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context) - analytic_id = voucher_brw.analytic_id.id or False current_currency_obj = voucher_brw.currency_id or voucher_brw.journal_id.company_id.currency_id if not currency_obj.is_zero(cr, uid, current_currency_obj, line_total): @@ -959,7 +958,7 @@ class account_voucher(osv.osv): 'debit': diff < 0 and -diff or 0.0, 'amount_currency': company_currency <> current_currency and voucher_brw.writeoff_amount or False, 'currency_id': company_currency <> current_currency and current_currency or False, - 'analytic_account_id': analytic_id + 'analytic_account_id': voucher_brw.analytic_id and voucher_brw.analytic_id.id or False } return move_line From ad7e7c48e02b7b5ac2392bfde38ee2d1c7b634fc Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 30 Nov 2011 14:36:19 +0530 Subject: [PATCH 331/594] [REM] crm_partner_assign: removed crm_partner_assign/test/ui/partner_assign_demo.yml bzr revid: ron@tinyerp.com-20111130090619-37he2tau7vb3a2en --- addons/crm_partner_assign/__openerp__.py | 1 - addons/crm_partner_assign/test/ui/partner_assign_demo.yml | 7 ------- 2 files changed, 8 deletions(-) delete mode 100644 addons/crm_partner_assign/test/ui/partner_assign_demo.yml diff --git a/addons/crm_partner_assign/__openerp__.py b/addons/crm_partner_assign/__openerp__.py index b816f1c8353..555717899b1 100644 --- a/addons/crm_partner_assign/__openerp__.py +++ b/addons/crm_partner_assign/__openerp__.py @@ -51,7 +51,6 @@ You can also use the geolocalization without using the GPS coordinates. ], 'test': [ 'test/process/partner_assign.yml', - 'test/ui/partner_assign_demo.yml' ], 'installable': True, 'active': False, diff --git a/addons/crm_partner_assign/test/ui/partner_assign_demo.yml b/addons/crm_partner_assign/test/ui/partner_assign_demo.yml deleted file mode 100644 index a178e767eb2..00000000000 --- a/addons/crm_partner_assign/test/ui/partner_assign_demo.yml +++ /dev/null @@ -1,7 +0,0 @@ -- - I call onchange event to change partner address and Email. -- - !python {model: crm.lead.forward.to.partner}: | - action = self.on_change_partner(cr, uid, ref("crm.crm_case_qrecorp0"), ref("base.res_partner_9")) - assert action['value']['email_to'] == 'info@balmerinc.be', "Email is wrong" - self.on_change_email(cr, uid, [ref('crm.crm_case_qrecorp0')], ref('base.user_root')) From e1fbd4ad7a492bf38fada37aa9615d9768bbc1e2 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 30 Nov 2011 15:10:11 +0530 Subject: [PATCH 332/594] [REF] crm: moved Extra info Tab after comunication and history bzr revid: ron@tinyerp.com-20111130094011-qsmras8t8qkazqhx --- addons/crm/crm_lead_view.xml | 56 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index fddd1b1743d..ee551bc2400 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -143,34 +143,6 @@ type="object" icon="gtk-convert" /> - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -223,6 +195,34 @@ name="%(mail.action_email_compose_message_wizard)d" icon="terp-mail-message-new" type="action"/> + + + + + + + + + + + + + + + + + + + + + + + + + + From bb67abe9140d73f6c8ad4c25eefc9d38be777485 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 30 Nov 2011 11:11:10 +0100 Subject: [PATCH 333/594] [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 334/594] [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 f56cc312e46d3f63fcd6c5e57f3fb3293855ae6e Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 30 Nov 2011 17:36:40 +0530 Subject: [PATCH 335/594] [IMP] crm_parner_assign, crm: Corrected history[whole, laetst, case info] for lead forword to its nearest partner email wizard bzr revid: ron@tinyerp.com-20111130120640-t6l8pec0fb6pehjq --- addons/crm/crm_lead.py | 2 +- addons/crm_partner_assign/wizard/crm_forward_to_partner.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 9510041d37f..cbaa917eb88 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -422,7 +422,7 @@ class crm_lead(crm_case, osv.osv): else: value = lead[field_name] - body.append("%s: %s\n" % (field.string, value or '')) + body.append("%s: %s" % (field.string, value or '')) return "\n".join(body + ['---']) def _merge_notification(self, cr, uid, opportunity_id, opportunities, context=None): diff --git a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py index 4286de91ed1..565f99b9db1 100644 --- a/addons/crm_partner_assign/wizard/crm_forward_to_partner.py +++ b/addons/crm_partner_assign/wizard/crm_forward_to_partner.py @@ -66,8 +66,7 @@ class crm_lead_forward_to_partner(osv.osv_memory): res_id = context.get('active_id') model = context.get('active_model') lead = self.pool.get(model).browse(cr, uid, res_id, context) - body_text = self._get_info_body_text(cr, uid, lead, context=context) - context['mail.compose.message.body'] = history_type + body_text = self._get_message_body_text(cr, uid, lead, history_type, context=context) if body_text: res = {'value': {'body_text' : body_text}} return res @@ -171,7 +170,7 @@ class crm_lead_forward_to_partner(osv.osv_memory): to = 'To: %s' % (message.email_to or '') sentdate = 'Date: %s' % (message.date or '') desc = '\n%s'%(message.body_text) - original = [header, sender, to, sentdate, desc] + original = [header, sender, to, sentdate, desc, '\n'] original = '\n'.join(original) body += original return body or '' From 379ab719eec090c3dc83775c9856a564948d074f Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 30 Nov 2011 18:36:14 +0530 Subject: [PATCH 336/594] [IMP] crm: After Merged oppportunity, correct value of merge_description, and Email_cc[It means Text field value have filtered] bzr revid: ron@tinyerp.com-20111130130614-s9e1a8v6hra0kmxr --- addons/crm/crm_lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index cbaa917eb88..49272c97576 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -369,7 +369,7 @@ class crm_lead(crm_case, osv.osv): return res and res.id or False def _concat_all(attr): - return ', '.join([getattr(opportunity, attr) or '' for opportunity in opportunities if hasattr(opportunity, attr)]) + return ', '.join(filter(lambda x: x, [getattr(opportunity, attr) or '' for opportunity in opportunities if hasattr(opportunity, attr)])) data = {} for field_name in fields: From b552ff1991575bf167e2fe889521aa9268ecd7fc Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 30 Nov 2011 14:11:54 +0100 Subject: [PATCH 337/594] [IMP] Seperate menu tips from action view manager's content bzr revid: fme@openerp.com-20111130131154-cu9hrcxyjvw15wnc --- addons/web/static/src/js/views.js | 6 +++--- addons/web/static/src/xml/base.xml | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 582a526e57a..b19cf7a7626 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -426,8 +426,8 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner }); if (this.action.help && !this.flags.low_profile) { var Users = new session.web.DataSet(self, 'res.users'), - header = this.$element.find('.oe-view-manager-header'); - header.delegate('blockquote button', 'click', function() { + $tips = this.$element.find('.oe_view_manager_menu_tips'); + $tips.delegate('blockquote button', 'click', function() { var $this = $(this); //noinspection FallthroughInSwitchStatementJS switch ($this.attr('name')) { @@ -444,7 +444,7 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner if (!(user && user.id === self.session.uid)) { return; } - header.find('blockquote').toggle(user.menu_tips); + $tips.find('blockquote').toggle(user.menu_tips); }); } } diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 23fa97ce7f5..754364c6c8d 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -418,6 +418,7 @@ + +
@@ -443,21 +444,28 @@
+ + + +
+

+
+ + +
+
+ + +
-
-

-
- - -
-
- + From 9e965230f6b06c90931915836c12b8e01cbda905 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Wed, 30 Nov 2011 14:25:43 +0100 Subject: [PATCH 338/594] [IMP] Include star shortcut in the view title h2 element bzr revid: fme@openerp.com-20111130132543-fcl4avnrmpryaryt --- addons/web/static/src/js/views.js | 6 +++--- addons/web/static/src/xml/base.xml | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index b19cf7a7626..e8af1290e48 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -280,7 +280,7 @@ session.web.ViewManager = session.web.Widget.extend(/** @lends session.web.View } } $.when(view_promise).then(function () { - self.$element.find('.oe_view_title:first').text( + self.$element.find('.oe_view_title_text:first').text( self.display_title()); }); return view_promise; @@ -472,10 +472,10 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner view_id = (fvg && fvg.view_id) || '--'; self.$element.find('.oe_get_xml_view span').text(view_id); if (!self.action.name && fvg) { - self.$element.find('.oe_view_title').text(fvg.arch.attrs.string || fvg.name); + self.$element.find('.oe_view_title_text').text(fvg.arch.attrs.string || fvg.name); } - var $title = self.$element.find('.oe_view_title'), + var $title = self.$element.find('.oe_view_title_text'), $search_prefix = $title.find('span.oe_searchable_view'); if (controller.searchable !== false) { if (!$search_prefix.length) { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 754364c6c8d..e097c4cd771 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -423,7 +423,7 @@

- +

@@ -463,9 +463,11 @@ - + + + From 832436c1487ca6accf074da8e73ce5cccda51c48 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 30 Nov 2011 14:30:08 +0100 Subject: [PATCH 339/594] [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 340/594] [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 @@