From 326f25c24f8acb9c31f9d7b92ce5a5a37b13be89 Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 28 Dec 2010 12:09:17 +0530 Subject: [PATCH 01/12] [IMP] account: Improved general ledger report bzr revid: pso@tinyerp.com-20101228063917-uygz0v52d4pw259d --- addons/account/report/account_general_ledger.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index 0dd4e354625..4d2a417e52e 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -159,19 +159,13 @@ class general_ledger(report_sxw.rml_parse, common_report_header): else: sql_sort='l.date, l.move_id' sql = """ - SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id, + SELECT l.id AS lid, l.date AS ldate, j.code AS lcode, l.currency_id,l.amount_currency,l.ref AS lref, l.name AS lname, COALESCE(l.debit,0) AS debit, COALESCE(l.credit,0) AS credit, l.period_id AS lperiod_id, l.partner_id AS lpartner_id, m.name AS move_name, m.id AS mmove_id,per.code as period_code, - case when a.currency_id is not null then - l.amount_currency - else - 0.0 - end as amount_currency, c.symbol AS currency_code, i.id AS invoice_id, i.type AS invoice_type, i.number AS invoice_number, p.name AS partner_name FROM account_move_line l JOIN account_move m on (l.move_id=m.id) - LEFT JOIN account_account a ON (l.account_id=a.id) LEFT JOIN res_currency c on (l.currency_id=c.id) LEFT JOIN res_partner p on (l.partner_id=p.id) LEFT JOIN account_invoice i on (m.id =i.move_id) @@ -192,8 +186,8 @@ class general_ledger(report_sxw.rml_parse, common_report_header): else 0.0 end) as amount_currency, - c.symbol AS currency_code, - l.currency_id AS currency_id, + '' AS currency_code, + NULL AS currency_id, '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, '' AS partner_name FROM account_move_line l @@ -204,7 +198,6 @@ class general_ledger(report_sxw.rml_parse, common_report_header): LEFT JOIN account_invoice i on (m.id =i.move_id) JOIN account_journal j on (l.journal_id=j.id) WHERE %s AND m.state IN %s AND l.account_id = %%s - group by c.symbol, l.currency_id """ %(self.init_query, tuple(move_state)) self.cr.execute(sql, (account.id,)) res_init = self.cr.dictfetchall() From fbe53992bc9a16bef65d14b185ef989142d9515e Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 28 Dec 2010 12:19:46 +0530 Subject: [PATCH 02/12] [IMP] account: Improved condition for general ledger report bzr revid: pso@tinyerp.com-20101228064946-y6tbf5fqa0eiv7dm --- addons/account/report/account_general_ledger.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index b904aba298f..10e54428496 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -179,8 +179,13 @@ class general_ledger(report_sxw.rml_parse, common_report_header): if res_lines and self.init_balance: #FIXME: replace the label of lname with a string translatable sql = """ - SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id, + SELECT 0 AS lid, '' AS ldate, '' AS lcode, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id, '' AS move_name, '' AS mmove_id, '' AS period_code, + sum(case when a.currency_id is not null then + l.amount_currency + else + 0.0 + end) as amount_currency, '' AS currency_code, NULL AS currency_id, '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, From 2a7d9df5058498950b7e57242d8b48e3eeb568a6 Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 28 Dec 2010 14:33:07 +0530 Subject: [PATCH 03/12] [IMP] account: Corrected amount currency for general and partner ledger report bzr revid: pso@tinyerp.com-20101228090307-7oq5dkx477b35be0 --- addons/account/report/account_general_ledger.py | 3 +++ addons/account/report/account_general_ledger.rml | 2 +- .../report/account_general_ledger_landscape.rml | 4 ++-- addons/account/report/account_partner_ledger.py | 11 +++++++++-- addons/account/report/account_partner_ledger.rml | 10 +++------- .../account/report/account_partner_ledger_other.rml | 4 +--- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index 10e54428496..4d2a417e52e 100644 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -192,6 +192,7 @@ class general_ledger(report_sxw.rml_parse, common_report_header): '' AS partner_name FROM account_move_line l LEFT JOIN account_move m on (l.move_id=m.id) + LEFT JOIN account_account a ON (l.account_id=a.id) LEFT JOIN res_currency c on (l.currency_id=c.id) LEFT JOIN res_partner p on (l.partner_id=p.id) LEFT JOIN account_invoice i on (m.id =i.move_id) @@ -214,6 +215,8 @@ class general_ledger(report_sxw.rml_parse, common_report_header): l['amount_currency'] = abs(l['amount_currency']) * -1 if l['amount_currency'] != None: self.tot_currency = self.tot_currency + l['amount_currency'] + self.cr.execute("select distinct currency_id from account_invoice") + l['cur_id']=self.cr.fetchall() return res def _sum_debit_account(self, account): diff --git a/addons/account/report/account_general_ledger.rml b/addons/account/report/account_general_ledger.rml index d3da592e085..e0359249657 100644 --- a/addons/account/report/account_general_ledger.rml +++ b/addons/account/report/account_general_ledger.rml @@ -518,7 +518,7 @@ [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] + [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 56624256300..6892a1fd4bd 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -508,7 +508,7 @@ [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]] @@ -550,7 +550,7 @@ [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']] + [[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 92d84e05c26..16e03b2f71c 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -47,6 +47,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): 'get_fiscalyear': self._get_fiscalyear, 'get_journal': self._get_journal, 'get_partners':self._get_partners, + 'sum_currency_amount_account': self._sum_currency_amount_account, 'get_intial_balance':self._get_intial_balance, 'display_initial_balance':self._display_initial_balance, 'display_currency':self._display_currency, @@ -125,6 +126,10 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): return new else: return self.comma_me(new) + + def _get_currency(self): + self.cr.execute("select distinct currency_id from account_invoice") + return self.cr.fetchall() def lines(self, partner): move_state = ['draft','posted'] @@ -137,7 +142,9 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): else: RECONCILE_TAG = "AND l.reconcile_id IS NULL" self.cr.execute( - "SELECT l.id, l.date, j.code, acc.code as a_code, acc.name as a_name, l.ref, m.name as move_name, l.name, l.debit, l.credit, l.amount_currency,l.currency_id, c.symbol AS currency_code " \ + "SELECT l.id, l.date, j.code, acc.code as a_code, acc.name as a_name, l.ref, m.name as move_name, l.name, l.debit, l.credit," \ + "sum(case when acc.currency_id is not null then l.amount_currency else 0.0 end) as amount_currency," \ + "l.currency_id, c.symbol AS currency_code " \ "FROM account_move_line l " \ "LEFT JOIN account_journal j " \ "ON (l.journal_id = j.id) " \ @@ -149,7 +156,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): "AND l.account_id IN %s AND " + self.query +" " \ "AND m.state IN %s " \ " " + RECONCILE_TAG + " "\ - "ORDER BY l.date", + "GROUP BY l.id, l.date, j.code, acc.code, acc.name, l.ref, m.name, l.name, l.debit, l.credit, l.currency_id, c.symbol ORDER BY l.date", (partner.id, tuple(self.account_ids), tuple(move_state))) res = self.cr.dictfetchall() sum = 0.0 diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index 1a32bc13bde..1e6feac31e9 100644 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -586,9 +586,7 @@ [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] - - - + [[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] @@ -609,9 +607,7 @@ [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] - - - + [[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] @@ -646,7 +642,7 @@ - [[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]] + [[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index b3dec993cdb..fd9573cd283 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -593,9 +593,7 @@ [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]] - - - + [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]] From f5cea07b866d18cd4ef20de39bcbcef4834acf0f Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 28 Dec 2010 17:44:59 +0530 Subject: [PATCH 04/12] [ADD] product_multi_company: Added new module for several prices, one for each company bzr revid: pso@tinyerp.com-20101228121459-9yyaxxqlm5h59ie1 --- addons/product_multi_company/__init__.py | 24 ++++++++ addons/product_multi_company/__openerp__.py | 39 +++++++++++++ addons/product_multi_company/i18n/en_US.po | 32 +++++++++++ addons/product_multi_company/i18n/fr.po | 32 +++++++++++ .../i18n/product_multi_company.pot | 32 +++++++++++ .../product_multi_company.py | 56 +++++++++++++++++++ 6 files changed, 215 insertions(+) create mode 100644 addons/product_multi_company/__init__.py create mode 100644 addons/product_multi_company/__openerp__.py create mode 100644 addons/product_multi_company/i18n/en_US.po create mode 100644 addons/product_multi_company/i18n/fr.po create mode 100644 addons/product_multi_company/i18n/product_multi_company.pot create mode 100644 addons/product_multi_company/product_multi_company.py diff --git a/addons/product_multi_company/__init__.py b/addons/product_multi_company/__init__.py new file mode 100644 index 00000000000..34163abb1a2 --- /dev/null +++ b/addons/product_multi_company/__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 product_multi_company + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/product_multi_company/__openerp__.py b/addons/product_multi_company/__openerp__.py new file mode 100644 index 00000000000..1697331e56f --- /dev/null +++ b/addons/product_multi_company/__openerp__.py @@ -0,0 +1,39 @@ +# -*- 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" : "Product multi company ", + "version" : "1.1", + "author" : "OpenERP SA", + "category" : "Generic Modules/Inventory Control", + "depends" : [ "product"], + "init_xml" : [], + "demo_xml" : [], + "description": """ + This module defines several prices, one for each company. + """, + 'update_xml': [], + 'test':[], + 'installable': True, + 'active': False, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/product_multi_company/i18n/en_US.po b/addons/product_multi_company/i18n/en_US.po new file mode 100644 index 00000000000..e8510fe0bcd --- /dev/null +++ b/addons/product_multi_company/i18n/en_US.po @@ -0,0 +1,32 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_multi_company +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.0-rc1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2010-12-28 12:10:13+0000\n" +"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company +#: model:ir.model,name:product_multi_company.model_product_template +msgid "Product Template" +msgstr "" + +#. module: product_multi_company +#: constraint:product.template:0 +msgid "Error: The default UOM and the purchase UOM must be in the same category." +msgstr "" + +#. module: product_multi_company +#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo +msgid "pricelist.partnerinfo" +msgstr "" + diff --git a/addons/product_multi_company/i18n/fr.po b/addons/product_multi_company/i18n/fr.po new file mode 100644 index 00000000000..e8510fe0bcd --- /dev/null +++ b/addons/product_multi_company/i18n/fr.po @@ -0,0 +1,32 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_multi_company +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.0-rc1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2010-12-28 12:10:13+0000\n" +"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company +#: model:ir.model,name:product_multi_company.model_product_template +msgid "Product Template" +msgstr "" + +#. module: product_multi_company +#: constraint:product.template:0 +msgid "Error: The default UOM and the purchase UOM must be in the same category." +msgstr "" + +#. module: product_multi_company +#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo +msgid "pricelist.partnerinfo" +msgstr "" + diff --git a/addons/product_multi_company/i18n/product_multi_company.pot b/addons/product_multi_company/i18n/product_multi_company.pot new file mode 100644 index 00000000000..e8510fe0bcd --- /dev/null +++ b/addons/product_multi_company/i18n/product_multi_company.pot @@ -0,0 +1,32 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * product_multi_company +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.0.0-rc1\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2010-12-28 12:10:13+0000\n" +"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company +#: model:ir.model,name:product_multi_company.model_product_template +msgid "Product Template" +msgstr "" + +#. module: product_multi_company +#: constraint:product.template:0 +msgid "Error: The default UOM and the purchase UOM must be in the same category." +msgstr "" + +#. module: product_multi_company +#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo +msgid "pricelist.partnerinfo" +msgstr "" + diff --git a/addons/product_multi_company/product_multi_company.py b/addons/product_multi_company/product_multi_company.py new file mode 100644 index 00000000000..1b1166cbc41 --- /dev/null +++ b/addons/product_multi_company/product_multi_company.py @@ -0,0 +1,56 @@ +# -*- 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 osv, fields + +class product_template(osv.osv): + _inherit = "product.template" + _columns={ + 'list_price': fields.property('product.template', + type='float', + string='Public Price', + method=True, + view_load=True, + required=True, size=64), + 'standard_price': fields.property('product.template', + type='float', + string='Standard Price', + method=True, + view_load=True, + required=True, size=64, + help="Product's cost for accounting stock valuation. It is the base price for the supplier price."), + } +product_template() + +class pricelist_partnerinfo(osv.osv): + _inherit = 'pricelist.partnerinfo' + _columns = { + 'price': fields.property('pricelist.partnerinfo', + type='float', + string='Seller Price', + method=True, + view_load=True, + required=True, size=64, + help="This price will be considered as a price for the supplier UoM if any or the default Unit of Measure of the product otherwise"), + } +pricelist_partnerinfo() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From a5da39afbed7bf1096b4739f6ff62a0d7c73551c Mon Sep 17 00:00:00 2001 From: pso Date: Tue, 28 Dec 2010 18:58:29 +0530 Subject: [PATCH 05/12] [IMP] product_multi_company: Improved description bzr revid: pso@tinyerp.com-20101228132829-7op9kqzpdkgjdhwa --- addons/product_multi_company/__openerp__.py | 2 +- addons/product_multi_company/product_multi_company.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/product_multi_company/__openerp__.py b/addons/product_multi_company/__openerp__.py index 1697331e56f..f933ceb4423 100644 --- a/addons/product_multi_company/__openerp__.py +++ b/addons/product_multi_company/__openerp__.py @@ -28,7 +28,7 @@ "init_xml" : [], "demo_xml" : [], "description": """ - This module defines several prices, one for each company. + This module updates the definitions of standard price, public price and seller price with property fields. """, 'update_xml': [], 'test':[], diff --git a/addons/product_multi_company/product_multi_company.py b/addons/product_multi_company/product_multi_company.py index 1b1166cbc41..3c9c52f04e3 100644 --- a/addons/product_multi_company/product_multi_company.py +++ b/addons/product_multi_company/product_multi_company.py @@ -23,6 +23,7 @@ from osv import osv, fields class product_template(osv.osv): _inherit = "product.template" + _description = "Product Template" _columns={ 'list_price': fields.property('product.template', type='float', @@ -42,6 +43,7 @@ product_template() class pricelist_partnerinfo(osv.osv): _inherit = 'pricelist.partnerinfo' + _description = "Pricelist Partner" _columns = { 'price': fields.property('pricelist.partnerinfo', type='float', From b65cbd5d4268d48cf407eae5c6de62488a257996 Mon Sep 17 00:00:00 2001 From: pso Date: Wed, 29 Dec 2010 12:21:08 +0530 Subject: [PATCH 06/12] [FIX] account: Set domain for showing move lines only for current year lp bug: https://launchpad.net/bugs/694876 fixed bzr revid: pso@tinyerp.com-20101229065108-cibbrgwxzt58l021 --- addons/account/board_account_view.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml index 93bcc7724be..a4f70442c9c 100644 --- a/addons/account/board_account_view.xml +++ b/addons/account/board_account_view.xml @@ -26,7 +26,8 @@ form tree,graph {'group_by':['user_type'], 'group_by_no_leaf':1} - + [('period_id','in','current_year')] + Treasury From 58c546d6c0e385e78303a0a271df0d85d1000e6b Mon Sep 17 00:00:00 2001 From: pso Date: Mon, 3 Jan 2011 17:57:41 +0530 Subject: [PATCH 07/12] [IMP] account: Improved ledger reports bzr revid: pso@tinyerp.com-20110103122741-f4tcs1by9bdib65g --- addons/account/report/account_general_ledger.py | 3 ++- addons/account/report/account_partner_ledger.py | 16 ++++------------ addons/account/report/account_partner_ledger.rml | 8 ++++---- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/addons/account/report/account_general_ledger.py b/addons/account/report/account_general_ledger.py index 4d2a417e52e..6edf87c36c3 100755 --- a/addons/account/report/account_general_ledger.py +++ b/addons/account/report/account_general_ledger.py @@ -187,7 +187,7 @@ class general_ledger(report_sxw.rml_parse, common_report_header): 0.0 end) as amount_currency, '' AS currency_code, - NULL AS currency_id, + a.currency_id AS currency_id, '' AS invoice_id, '' AS invoice_type, '' AS invoice_number, '' AS partner_name FROM account_move_line l @@ -198,6 +198,7 @@ class general_ledger(report_sxw.rml_parse, common_report_header): LEFT JOIN account_invoice i on (m.id =i.move_id) JOIN account_journal j on (l.journal_id=j.id) WHERE %s AND m.state IN %s AND l.account_id = %%s + GROUP BY a.currency_id """ %(self.init_query, tuple(move_state)) self.cr.execute(sql, (account.id,)) res_init = self.cr.dictfetchall() diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 16e03b2f71c..2d03cb8cb52 100755 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -127,10 +127,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): else: return self.comma_me(new) - def _get_currency(self): - self.cr.execute("select distinct currency_id from account_invoice") - return self.cr.fetchall() - def lines(self, partner): move_state = ['draft','posted'] if self.target_move == 'posted': @@ -165,6 +161,8 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): for r in res: sum += r['debit'] - r['credit'] r['progress'] = sum + self.cr.execute("select distinct currency_id from account_invoice") + r['cur_id'] = self.cr.fetchall() full_account.append(r) return full_account @@ -397,16 +395,10 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): return 'Receivable and Payable Accounts' return '' - def _sum_currency_amount_account(self, account, form): - self._set_get_account_currency_code(account.id) + def _sum_currency_amount_account(self, account): self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,)) total = self.cr.fetchone() - if self.account_currency: - return_field = str(total[0]) + self.account_currency - return return_field - else: - currency_total = self.tot_currency = 0.0 - return currency_total + return total[0] or 0.0 def _display_initial_balance(self, data): if self.initial_balance: diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index 83902eba144..4086dd1a605 100755 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -572,7 +572,7 @@ - [[ p.ref ]] - [[ p.name ]] + test[[ p.ref ]] - [[ p.name ]] [[ formatLang((sum_debit_partner(p))) ]] @@ -605,8 +605,8 @@ [[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]] - [[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] - + [[ len(line['cur_id'])==1 and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]] + @@ -640,7 +640,7 @@ - [[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] + [[ (len(line['cur_id'])==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] From a13b42acbf82b81513c222de09afc6c033ef6d5d Mon Sep 17 00:00:00 2001 From: pso Date: Mon, 3 Jan 2011 18:15:57 +0530 Subject: [PATCH 08/12] [REMOVE] Removed product_multi_company as its moved in extra addons bzr revid: pso@tinyerp.com-20110103124557-sefdfx336jkbrzky --- addons/product_multi_company/__init__.py | 24 -------- addons/product_multi_company/__openerp__.py | 39 ------------- addons/product_multi_company/i18n/en_US.po | 32 ---------- addons/product_multi_company/i18n/fr.po | 32 ---------- .../i18n/product_multi_company.pot | 32 ---------- .../product_multi_company.py | 58 ------------------- 6 files changed, 217 deletions(-) delete mode 100644 addons/product_multi_company/__init__.py delete mode 100644 addons/product_multi_company/__openerp__.py delete mode 100644 addons/product_multi_company/i18n/en_US.po delete mode 100644 addons/product_multi_company/i18n/fr.po delete mode 100644 addons/product_multi_company/i18n/product_multi_company.pot delete mode 100644 addons/product_multi_company/product_multi_company.py diff --git a/addons/product_multi_company/__init__.py b/addons/product_multi_company/__init__.py deleted file mode 100644 index 34163abb1a2..00000000000 --- a/addons/product_multi_company/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- 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 product_multi_company - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/product_multi_company/__openerp__.py b/addons/product_multi_company/__openerp__.py deleted file mode 100644 index f933ceb4423..00000000000 --- a/addons/product_multi_company/__openerp__.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- 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" : "Product multi company ", - "version" : "1.1", - "author" : "OpenERP SA", - "category" : "Generic Modules/Inventory Control", - "depends" : [ "product"], - "init_xml" : [], - "demo_xml" : [], - "description": """ - This module updates the definitions of standard price, public price and seller price with property fields. - """, - 'update_xml': [], - 'test':[], - 'installable': True, - 'active': False, -} - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/product_multi_company/i18n/en_US.po b/addons/product_multi_company/i18n/en_US.po deleted file mode 100644 index e8510fe0bcd..00000000000 --- a/addons/product_multi_company/i18n/en_US.po +++ /dev/null @@ -1,32 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * product_multi_company -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 6.0.0-rc1\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2010-12-28 12:10:13+0000\n" -"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company -#: model:ir.model,name:product_multi_company.model_product_template -msgid "Product Template" -msgstr "" - -#. module: product_multi_company -#: constraint:product.template:0 -msgid "Error: The default UOM and the purchase UOM must be in the same category." -msgstr "" - -#. module: product_multi_company -#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo -msgid "pricelist.partnerinfo" -msgstr "" - diff --git a/addons/product_multi_company/i18n/fr.po b/addons/product_multi_company/i18n/fr.po deleted file mode 100644 index e8510fe0bcd..00000000000 --- a/addons/product_multi_company/i18n/fr.po +++ /dev/null @@ -1,32 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * product_multi_company -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 6.0.0-rc1\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2010-12-28 12:10:13+0000\n" -"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company -#: model:ir.model,name:product_multi_company.model_product_template -msgid "Product Template" -msgstr "" - -#. module: product_multi_company -#: constraint:product.template:0 -msgid "Error: The default UOM and the purchase UOM must be in the same category." -msgstr "" - -#. module: product_multi_company -#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo -msgid "pricelist.partnerinfo" -msgstr "" - diff --git a/addons/product_multi_company/i18n/product_multi_company.pot b/addons/product_multi_company/i18n/product_multi_company.pot deleted file mode 100644 index e8510fe0bcd..00000000000 --- a/addons/product_multi_company/i18n/product_multi_company.pot +++ /dev/null @@ -1,32 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * product_multi_company -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 6.0.0-rc1\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2010-12-28 12:10:13+0000\n" -"PO-Revision-Date: 2010-12-28 12:10:13+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: product_multi_company -#: model:ir.model,name:product_multi_company.model_product_template -msgid "Product Template" -msgstr "" - -#. module: product_multi_company -#: constraint:product.template:0 -msgid "Error: The default UOM and the purchase UOM must be in the same category." -msgstr "" - -#. module: product_multi_company -#: model:ir.model,name:product_multi_company.model_pricelist_partnerinfo -msgid "pricelist.partnerinfo" -msgstr "" - diff --git a/addons/product_multi_company/product_multi_company.py b/addons/product_multi_company/product_multi_company.py deleted file mode 100644 index 3c9c52f04e3..00000000000 --- a/addons/product_multi_company/product_multi_company.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- 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 osv, fields - -class product_template(osv.osv): - _inherit = "product.template" - _description = "Product Template" - _columns={ - 'list_price': fields.property('product.template', - type='float', - string='Public Price', - method=True, - view_load=True, - required=True, size=64), - 'standard_price': fields.property('product.template', - type='float', - string='Standard Price', - method=True, - view_load=True, - required=True, size=64, - help="Product's cost for accounting stock valuation. It is the base price for the supplier price."), - } -product_template() - -class pricelist_partnerinfo(osv.osv): - _inherit = 'pricelist.partnerinfo' - _description = "Pricelist Partner" - _columns = { - 'price': fields.property('pricelist.partnerinfo', - type='float', - string='Seller Price', - method=True, - view_load=True, - required=True, size=64, - help="This price will be considered as a price for the supplier UoM if any or the default Unit of Measure of the product otherwise"), - } -pricelist_partnerinfo() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From 2dd3cb72645619a3f51ea37e575a3948140606ed Mon Sep 17 00:00:00 2001 From: pso Date: Mon, 3 Jan 2011 18:27:49 +0530 Subject: [PATCH 09/12] [IMP] account: Removed useless word bzr revid: pso@tinyerp.com-20110103125749-46y9zqq6irlb8t16 --- addons/account/report/account_partner_ledger.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index 4086dd1a605..e2c4dd03a94 100755 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -572,7 +572,7 @@ - test[[ p.ref ]] - [[ p.name ]] + [[ p.ref ]] - [[ p.name ]] [[ formatLang((sum_debit_partner(p))) ]] From 11296198e08e66f9c1032d12700ec923682589d9 Mon Sep 17 00:00:00 2001 From: pso Date: Fri, 12 Mar 2010 10:39:36 +0530 Subject: [PATCH 10/12] [FIX] account: Removed domain from company analysis lp bug: https://launchpad.net/bugs/694876 fixed bzr revid: pso@tinyerp.com-20100312050936-iksyq3kjpu8gdlkt --- addons/account/board_account_view.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml index ab3fd342f02..673cdfab8e1 100755 --- a/addons/account/board_account_view.xml +++ b/addons/account/board_account_view.xml @@ -27,7 +27,6 @@ tree,graph {'group_by':['user_type'], 'group_by_no_leaf':1} - [('period_id','in','current_year')] Treasury From 4363de12dda2bcdd8aec1a2b2b8f7f774568ca01 Mon Sep 17 00:00:00 2001 From: pso Date: Fri, 12 Feb 2010 11:47:51 +0530 Subject: [PATCH 11/12] [FIX] account: Put domain for company analysis and improved read_group lp bug: https://launchpad.net/bugs/694876 fixed bzr revid: pso@tinyerp.com-20100212061751-7wd3qzvtjit8tra3 --- addons/account/board_account_view.xml | 1 + .../account/report/account_entries_report.py | 28 ++++++++----------- .../report/account_entries_report_view.xml | 4 +-- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml index 673cdfab8e1..dd424e17ceb 100755 --- a/addons/account/board_account_view.xml +++ b/addons/account/board_account_view.xml @@ -27,6 +27,7 @@ tree,graph {'group_by':['user_type'], 'group_by_no_leaf':1} + [('year','=',time.strftime('%Y'))] Treasury diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py index e80cb290889..7d419410458 100755 --- a/addons/account/report/account_entries_report.py +++ b/addons/account/report/account_entries_report.py @@ -94,25 +94,19 @@ class account_entries_report(osv.osv): return super(account_entries_report, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order, context=context, count=count) - def read_group(self, cr, uid, domain, *args, **kwargs): - todel=[] + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): fiscalyear_obj = self.pool.get('account.fiscalyear') period_obj = self.pool.get('account.period') - for arg in domain: - if arg[0] == 'period_id' and arg[2] == 'current_period': - current_period = period_obj.find(cr, uid)[0] - domain.append(['period_id','in',[current_period]]) - todel.append(arg) - break - elif arg[0] == 'period_id' and arg[2] == 'current_year': - current_year = fiscalyear_obj.find(cr, uid) - ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] - domain.append(['period_id','in',ids]) - todel.append(arg) - for a in [['period_id','in','current_year'], ['period_id','in','current_period']]: - if a in domain: - domain.remove(a) - return super(account_entries_report, self).read_group(cr, uid, domain, *args, **kwargs) + if context.get('period', False) == 'current_period': + current_period = period_obj.find(cr, uid)[0] + domain.append(['period_id','in',[current_period]]) + elif context.get('year', False) == 'current_year': + current_year = fiscalyear_obj.find(cr, uid) + ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] + domain.append(['period_id','in',ids]) + else: + domain = domain + return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby) def init(self, cr): tools.drop_view_if_exists(cr, 'account_entries_report') diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index 8eefe75838f..da78476d96a 100755 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -70,11 +70,11 @@ From 957771e7ff9a689ec84c6b7d3a81257425c3118a Mon Sep 17 00:00:00 2001 From: pso Date: Wed, 5 Jan 2011 12:13:21 +0530 Subject: [PATCH 12/12] [FIX] account: Put context as a dict bzr revid: pso@tinyerp.com-20110105064321-zzzsuvaradz6qmxs --- addons/account/report/account_entries_report.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py index 7d419410458..266b4a056d7 100755 --- a/addons/account/report/account_entries_report.py +++ b/addons/account/report/account_entries_report.py @@ -95,6 +95,8 @@ class account_entries_report(osv.osv): context=context, count=count) def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): + if context is None: + context = {} fiscalyear_obj = self.pool.get('account.fiscalyear') period_obj = self.pool.get('account.period') if context.get('period', False) == 'current_period':