From ed483d1ed7ce38dbba21df4c2f93d824e33af89f Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 26 May 2009 16:07:15 +0200 Subject: [PATCH 01/17] [FIX] Change the version 5.0.1 bzr revid: stephane@tinyerp.com-20090526140715-c0l3rmzg11c96fyu --- bin/PKG-INFO | 2 +- bin/addons/base/i18n/ar_AR.po | 2 +- bin/addons/base/i18n/base.pot | 2 +- bin/addons/base/i18n/bg_BG.po | 2 +- bin/addons/base/i18n/bs_BS.po | 2 +- bin/addons/base/i18n/ca_ES.po | 2 +- bin/addons/base/i18n/cs_CS.po | 2 +- bin/addons/base/i18n/cs_CZ.po | 2 +- bin/addons/base/i18n/de_DE.po | 2 +- bin/addons/base/i18n/es_AR.po | 2 +- bin/addons/base/i18n/es_ES.po | 2 +- bin/addons/base/i18n/et_EE.po | 2 +- bin/addons/base/i18n/fr_FR.po | 2 +- bin/addons/base/i18n/hr_HR.po | 2 +- bin/addons/base/i18n/hu_HU.po | 2 +- bin/addons/base/i18n/it_IT.po | 2 +- bin/addons/base/i18n/lt_LT.po | 2 +- bin/addons/base/i18n/nl_BE.po | 2 +- bin/addons/base/i18n/nl_NL.po | 2 +- bin/addons/base/i18n/pl_PL.po | 2 +- bin/addons/base/i18n/pt_BR.po | 2 +- bin/addons/base/i18n/pt_PT.po | 2 +- bin/addons/base/i18n/ro_RO.po | 2 +- bin/addons/base/i18n/ru_RU.po | 2 +- bin/addons/base/i18n/sl_SL.po | 2 +- bin/addons/base/i18n/sv_SE.po | 2 +- bin/addons/base/i18n/sv_SV.po | 2 +- bin/addons/base/i18n/tr_TR.po | 2 +- bin/addons/base/i18n/uk_UK.po | 2 +- bin/addons/base/i18n/zh_CN.po | 2 +- bin/addons/base/i18n/zh_TW.po | 2 +- bin/release.py | 4 ++-- 32 files changed, 33 insertions(+), 33 deletions(-) diff --git a/bin/PKG-INFO b/bin/PKG-INFO index b9d6ca83997..9f04cc77abe 100644 --- a/bin/PKG-INFO +++ b/bin/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: OpenERP -Version: 5.0.0 +Version: 5.0.1 Author: Tiny.be Author-email: fp at tiny be Maintainer: Tiny.be diff --git a/bin/addons/base/i18n/ar_AR.po b/bin/addons/base/i18n/ar_AR.po index 4bf080bea59..1557c6b6606 100644 --- a/bin/addons/base/i18n/ar_AR.po +++ b/bin/addons/base/i18n/ar_AR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:14:30+0000\n" "PO-Revision-Date: 2009-05-20 10:14:30+0000\n" diff --git a/bin/addons/base/i18n/base.pot b/bin/addons/base/i18n/base.pot index d3d5be964db..4f7726b9e38 100644 --- a/bin/addons/base/i18n/base.pot +++ b/bin/addons/base/i18n/base.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:36:37+0000\n" "PO-Revision-Date: 2009-05-20 10:36:37+0000\n" diff --git a/bin/addons/base/i18n/bg_BG.po b/bin/addons/base/i18n/bg_BG.po index be64fd2d5f0..382f5784518 100644 --- a/bin/addons/base/i18n/bg_BG.po +++ b/bin/addons/base/i18n/bg_BG.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:15:53+0000\n" "PO-Revision-Date: 2009-05-20 10:15:53+0000\n" diff --git a/bin/addons/base/i18n/bs_BS.po b/bin/addons/base/i18n/bs_BS.po index 8c8ea8a9e60..52d7a57ae3d 100644 --- a/bin/addons/base/i18n/bs_BS.po +++ b/bin/addons/base/i18n/bs_BS.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:15:11+0000\n" "PO-Revision-Date: 2009-05-20 10:15:11+0000\n" diff --git a/bin/addons/base/i18n/ca_ES.po b/bin/addons/base/i18n/ca_ES.po index 41120287025..ba5c5259901 100644 --- a/bin/addons/base/i18n/ca_ES.po +++ b/bin/addons/base/i18n/ca_ES.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:16:35+0000\n" "PO-Revision-Date: 2009-05-20 10:16:35+0000\n" diff --git a/bin/addons/base/i18n/cs_CS.po b/bin/addons/base/i18n/cs_CS.po index 15eadbb5881..963d8471a41 100644 --- a/bin/addons/base/i18n/cs_CS.po +++ b/bin/addons/base/i18n/cs_CS.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:34:09+0000\n" "PO-Revision-Date: 2009-05-20 10:34:09+0000\n" diff --git a/bin/addons/base/i18n/cs_CZ.po b/bin/addons/base/i18n/cs_CZ.po index 9b81891ca78..dab02995876 100644 --- a/bin/addons/base/i18n/cs_CZ.po +++ b/bin/addons/base/i18n/cs_CZ.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:19:25+0000\n" "PO-Revision-Date: 2009-05-20 10:19:25+0000\n" diff --git a/bin/addons/base/i18n/de_DE.po b/bin/addons/base/i18n/de_DE.po index 2511ff7cc04..eb3a7ab0e08 100644 --- a/bin/addons/base/i18n/de_DE.po +++ b/bin/addons/base/i18n/de_DE.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:23:06+0000\n" "PO-Revision-Date: 2009-05-20 10:23:06+0000\n" diff --git a/bin/addons/base/i18n/es_AR.po b/bin/addons/base/i18n/es_AR.po index a187d474edb..01b3ebe4c36 100644 --- a/bin/addons/base/i18n/es_AR.po +++ b/bin/addons/base/i18n/es_AR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:30:53+0000\n" "PO-Revision-Date: 2009-05-20 10:30:53+0000\n" diff --git a/bin/addons/base/i18n/es_ES.po b/bin/addons/base/i18n/es_ES.po index c08e970d9d5..a7c92d84bdd 100644 --- a/bin/addons/base/i18n/es_ES.po +++ b/bin/addons/base/i18n/es_ES.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:31:42+0000\n" "PO-Revision-Date: 2009-05-20 10:31:42+0000\n" diff --git a/bin/addons/base/i18n/et_EE.po b/bin/addons/base/i18n/et_EE.po index e402d50cbae..bfd19821685 100644 --- a/bin/addons/base/i18n/et_EE.po +++ b/bin/addons/base/i18n/et_EE.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:21:36+0000\n" "PO-Revision-Date: 2009-05-20 10:21:36+0000\n" diff --git a/bin/addons/base/i18n/fr_FR.po b/bin/addons/base/i18n/fr_FR.po index fe3f3398cd8..f5785f957e4 100644 --- a/bin/addons/base/i18n/fr_FR.po +++ b/bin/addons/base/i18n/fr_FR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:22:20+0000\n" "PO-Revision-Date: 2009-05-20 10:22:20+0000\n" diff --git a/bin/addons/base/i18n/hr_HR.po b/bin/addons/base/i18n/hr_HR.po index d8810e5ab12..a5cd3b0c4a8 100644 --- a/bin/addons/base/i18n/hr_HR.po +++ b/bin/addons/base/i18n/hr_HR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:18:42+0000\n" "PO-Revision-Date: 2009-05-20 10:18:42+0000\n" diff --git a/bin/addons/base/i18n/hu_HU.po b/bin/addons/base/i18n/hu_HU.po index 60dc449db9e..426b0a3f0c0 100644 --- a/bin/addons/base/i18n/hu_HU.po +++ b/bin/addons/base/i18n/hu_HU.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:23:52+0000\n" "PO-Revision-Date: 2009-05-20 10:23:52+0000\n" diff --git a/bin/addons/base/i18n/it_IT.po b/bin/addons/base/i18n/it_IT.po index 78c01d4c90e..165030615e0 100644 --- a/bin/addons/base/i18n/it_IT.po +++ b/bin/addons/base/i18n/it_IT.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:24:37+0000\n" "PO-Revision-Date: 2009-05-20 10:24:37+0000\n" diff --git a/bin/addons/base/i18n/lt_LT.po b/bin/addons/base/i18n/lt_LT.po index 960513f2f73..263afc35808 100644 --- a/bin/addons/base/i18n/lt_LT.po +++ b/bin/addons/base/i18n/lt_LT.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:25:25+0000\n" "PO-Revision-Date: 2009-05-20 10:25:25+0000\n" diff --git a/bin/addons/base/i18n/nl_BE.po b/bin/addons/base/i18n/nl_BE.po index fbc12082b1d..64df8addc85 100644 --- a/bin/addons/base/i18n/nl_BE.po +++ b/bin/addons/base/i18n/nl_BE.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:20:08+0000\n" "PO-Revision-Date: 2009-05-20 10:20:08+0000\n" diff --git a/bin/addons/base/i18n/nl_NL.po b/bin/addons/base/i18n/nl_NL.po index 12b9a893835..8e720300cc2 100644 --- a/bin/addons/base/i18n/nl_NL.po +++ b/bin/addons/base/i18n/nl_NL.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:20:52+0000\n" "PO-Revision-Date: 2009-05-20 10:20:52+0000\n" diff --git a/bin/addons/base/i18n/pl_PL.po b/bin/addons/base/i18n/pl_PL.po index bd92ed85aae..6acd1433eae 100644 --- a/bin/addons/base/i18n/pl_PL.po +++ b/bin/addons/base/i18n/pl_PL.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:26:10+0000\n" "PO-Revision-Date: 2009-05-20 10:26:10+0000\n" diff --git a/bin/addons/base/i18n/pt_BR.po b/bin/addons/base/i18n/pt_BR.po index 73fd5905037..2331bd26217 100644 --- a/bin/addons/base/i18n/pt_BR.po +++ b/bin/addons/base/i18n/pt_BR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:26:56+0000\n" "PO-Revision-Date: 2009-05-20 10:26:56+0000\n" diff --git a/bin/addons/base/i18n/pt_PT.po b/bin/addons/base/i18n/pt_PT.po index 77557d188e9..388f871c14f 100644 --- a/bin/addons/base/i18n/pt_PT.po +++ b/bin/addons/base/i18n/pt_PT.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:27:41+0000\n" "PO-Revision-Date: 2009-05-20 10:27:41+0000\n" diff --git a/bin/addons/base/i18n/ro_RO.po b/bin/addons/base/i18n/ro_RO.po index 3e6c6b89ae5..8c57d09695f 100644 --- a/bin/addons/base/i18n/ro_RO.po +++ b/bin/addons/base/i18n/ro_RO.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:28:28+0000\n" "PO-Revision-Date: 2009-05-20 10:28:28+0000\n" diff --git a/bin/addons/base/i18n/ru_RU.po b/bin/addons/base/i18n/ru_RU.po index 20986829368..3330bf4356c 100644 --- a/bin/addons/base/i18n/ru_RU.po +++ b/bin/addons/base/i18n/ru_RU.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:29:15+0000\n" "PO-Revision-Date: 2009-05-20 10:29:15+0000\n" diff --git a/bin/addons/base/i18n/sl_SL.po b/bin/addons/base/i18n/sl_SL.po index 3b66dbefa3b..fe456a3fe6a 100644 --- a/bin/addons/base/i18n/sl_SL.po +++ b/bin/addons/base/i18n/sl_SL.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:30:05+0000\n" "PO-Revision-Date: 2009-05-20 10:30:05+0000\n" diff --git a/bin/addons/base/i18n/sv_SE.po b/bin/addons/base/i18n/sv_SE.po index a30d28e3c29..d174f6a42c1 100644 --- a/bin/addons/base/i18n/sv_SE.po +++ b/bin/addons/base/i18n/sv_SE.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:32:30+0000\n" "PO-Revision-Date: 2009-05-20 10:32:30+0000\n" diff --git a/bin/addons/base/i18n/sv_SV.po b/bin/addons/base/i18n/sv_SV.po index 33a34b32462..9435156d673 100644 --- a/bin/addons/base/i18n/sv_SV.po +++ b/bin/addons/base/i18n/sv_SV.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:34:58+0000\n" "PO-Revision-Date: 2009-05-20 10:34:58+0000\n" diff --git a/bin/addons/base/i18n/tr_TR.po b/bin/addons/base/i18n/tr_TR.po index c4e248cc982..f8e12ed8c6c 100644 --- a/bin/addons/base/i18n/tr_TR.po +++ b/bin/addons/base/i18n/tr_TR.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:33:21+0000\n" "PO-Revision-Date: 2009-05-20 10:33:21+0000\n" diff --git a/bin/addons/base/i18n/uk_UK.po b/bin/addons/base/i18n/uk_UK.po index 504256f8dd9..c6fc7ace1ab 100644 --- a/bin/addons/base/i18n/uk_UK.po +++ b/bin/addons/base/i18n/uk_UK.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:35:47+0000\n" "PO-Revision-Date: 2009-05-20 10:35:47+0000\n" diff --git a/bin/addons/base/i18n/zh_CN.po b/bin/addons/base/i18n/zh_CN.po index 86000e1a508..82878f36b01 100644 --- a/bin/addons/base/i18n/zh_CN.po +++ b/bin/addons/base/i18n/zh_CN.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:17:16+0000\n" "PO-Revision-Date: 2009-05-20 10:17:16+0000\n" diff --git a/bin/addons/base/i18n/zh_TW.po b/bin/addons/base/i18n/zh_TW.po index 193a47cb491..13b2f7a0873 100644 --- a/bin/addons/base/i18n/zh_TW.po +++ b/bin/addons/base/i18n/zh_TW.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" +"Project-Id-Version: OpenERP Server 5.0.1\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-05-19 14:18:00+0000\n" "PO-Revision-Date: 2009-05-20 10:18:00+0000\n" diff --git a/bin/release.py b/bin/release.py index 5d0e607a544..7c6c1380d6c 100644 --- a/bin/release.py +++ b/bin/release.py @@ -22,8 +22,8 @@ ############################################################################## name = 'openerp-server' -version = '5.0.0' -release = '3' +version = '5.0.1' +release = '0' major_version = '5.0' description = 'OpenERP Server' long_desc = '''\ From b18b81344ffa3c4a5c61fe8c6bfda877a9606e7a Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 27 May 2009 13:03:36 +0200 Subject: [PATCH 02/17] [FIX] expression: correct the generated sql in case of _inherits bzr revid: christophe@tinyerp.com-20090527110336-t8t5ombxj6p3slqw --- bin/osv/expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 7aa3b6aae57..52abe2eaf2c 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -251,7 +251,7 @@ class expression(object): query = '(%s.%s %s (%s))' % (table._table, left, operator, instr) if check_nulls: - query = '(%s OR %s IS NULL)' % (query, left) + query = '(%s OR %s.%s IS NULL)' % (query, table._table, left) else: params = [] From 5869cfa032026430cf271524e4d72b0819b07cee Mon Sep 17 00:00:00 2001 From: "vra (Tiny)" Date: Thu, 28 May 2009 11:26:33 +0530 Subject: [PATCH 03/17] Modified account reports:rml with few require changes in some report py file also added one more rml third_party_ledger_other.rml compatible with new report architecture. bzr revid: vinusoft85@gmail.com-20090528055633-hipi24dpns8li6bl --- addons/account/account_invoice_view.xml | 2 +- addons/account/account_report.xml | 1 + addons/account/report/account_balance.rml | 70 ++--- addons/account/report/account_journal.rml | 83 ++---- addons/account/report/account_tax_code.py | 29 +- addons/account/report/account_tax_code.rml | 116 +++----- addons/account/report/central_journal.rml | 102 ++----- addons/account/report/general_journal.rml | 71 ++--- addons/account/report/invoice.rml | 267 ++++-------------- addons/account/report/partner_balance.rml | 159 ++++------- addons/account/report/tax_report.py | 10 +- addons/account/report/tax_report.rml | 81 ++---- addons/account/report/third_party_ledger.py | 4 + addons/account/report/third_party_ledger.rml | 113 ++------ .../report/third_party_ledger_other.rml | 177 ++++++++++++ .../wizard/wizard_third_party_ledger.py | 17 +- 16 files changed, 539 insertions(+), 763 deletions(-) create mode 100644 addons/account/report/third_party_ledger_other.rml diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index b48d4ab1606..aa2eaa40d1a 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -63,7 +63,7 @@ - + diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index 3fe2e12a138..83b186bddd1 100644 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -3,6 +3,7 @@ + diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 250c51840d9..f74fc8d21b4 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -59,10 +59,18 @@ - - - - + + + + + + + + + + + + @@ -91,14 +99,14 @@ - + - - + + @@ -146,7 +154,7 @@ - [[ get_fiscalyear(data['form']) or removeParentNode('para') ]]: + [[ get_fiscalyear(data['form']) or removeParentNode('para') ]]: [[ get_periods(data['form']) or removeParentNode('para') ]] @@ -155,44 +163,20 @@ - + - - Code - - - Account - - - Debit - - - Credit - - - Balance - + Code + Account + Debit + Credit + Balance - [[ repeatIn(lines(data['form']), 'a') ]][[ a['code'] or removeParentNode('tr') ]] - - - [[ (a['level']<3 and setTag('tr','tr',{'style':'TrLevel'+str(a['level']), 'paraStyle':('Level'+str(a['level']))})) or removeParentNode('font') ]] - [[ (a['level']>2 and setTag('tr','tr',{'style':'TrLevel', 'paraStyle':('Level')})) or removeParentNode('font') ]] - [[ '...'*(a['level']) ]][[ a['name'] ]] - - - [[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['debit']) ]] - [[ a['type']<>'view' and removeParentNode('font') ]] [[formatLang(a['debit']) ]] - - - [[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['credit']) ]] - [[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['credit']) ]] - - - [[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['balance']) ]] - [[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['balance']) ]] - + [[ repeatIn(lines(data['form']), 'a') ]][[ a['level']>2 and setTag('para','para',{'fontName':"Helvetica"}) ]][[ a['code'] or removeParentNode('tr') ]] + [[ a['level']>2 and setTag('para','para',{'fontName':"Helvetica"}) ]][[ '..'*(a['level']-1) ]][[ a['name'] ]] + [[ a['level']>2 and setTag('para','para',{'fontName':"Helvetica"}) ]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['debit']) ]][[ a['type']<>'view' and removeParentNode('font') ]] [[formatLang(a['debit']) ]] + [[ a['level']>2 and setTag('para','para',{'fontName':"Helvetica"}) ]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['credit']) ]][[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['credit']) ]] + [[ a['level']>2 and setTag('para','para',{'fontName':"Helvetica"}) ]][[ a['type']=='view' and removeParentNode('font') ]][[ formatLang(a['balance']) ]][[ a['type']<>'view' and removeParentNode('font') ]] [[ formatLang(a['balance']) ]] diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index 9e782e5bce3..2c8036ca82f 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -120,70 +120,31 @@ [[ repeatIn(objects, 'o') ]] - - Date - - - Voucher No - - - A/c No. - - - Third party - - - Entry label - - - Debit - - - Credit - + Date + Voucher No + A/c No. + Third party + Entry label + Debit + Credit - - [[o.period_id.name ]] - - - [[ o.journal_id.code ]] - - - - - [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]] - - - [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]] - + [[o.period_id.name ]] + [[ o.journal_id.code ]] + + + + [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]] + [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]] - - - [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]] - [[ formatLang(line.date,date=True) ]] - - - [[ line.ref ]] - - - [[ line.account_id.code ]] - - - [[ line.partner_id and line.partner_id.name ]] - - - [[ line.name ]] - - - [[ formatLang(line.debit) ]] - - - [[ formatLang(line.credit) ]] - - - - + + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] + [[ line.ref ]] + [[ line.account_id.code ]] + [[ line.partner_id and line.partner_id.name ]] + [[ line.name ]] + [[ formatLang(line.debit) ]] + [[ formatLang(line.credit) ]] diff --git a/addons/account/report/account_tax_code.py b/addons/account/report/account_tax_code.py index 972646c96cf..21126c57146 100644 --- a/addons/account/report/account_tax_code.py +++ b/addons/account/report/account_tax_code.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -28,12 +28,37 @@ import re class account_tax_code_report(rml_parse.rml_parse): #_name = 'report.account.tax.code.entries' + def __init__(self, cr, uid, name, context): super(account_tax_code_report, self).__init__(cr, uid, name, context) self.localcontext.update({ 'time': time, + 'get_line':self.get_line, }) - + + def get_line(self,obj): + res ={} + result=[] + line_ids = self.pool.get('account.move.line').search(self.cr,self.uid,[('tax_code_id','=',obj.id)]) + if line_ids: + b_objs = self.pool.get('account.move.line').browse(self.cr,self.uid,line_ids) + for line in b_objs: + res['date'] = line.date + res['ref'] = line.ref + res['acode'] = line.account_id.code + if line.partner_id: + res['pname'] = line.partner_id.name + res['country'] = '' + if line.partner_id.address: + if line.partner_id.address[0].country_id: + res['country'] = line.partner_id.address[0].country_id.code + else: + res['pname'] = '' + res['name'] = line.name + res['debit'] = line.debit + res['credit'] = line.credit + result.append(res) + return result report_sxw.report_sxw('report.account.tax.code.entries', 'account.tax.code', 'addons/account/report/account_tax_code.rml', parser=account_tax_code_report, header=False) diff --git a/addons/account/report/account_tax_code.rml b/addons/account/report/account_tax_code.rml index 72bbf56c9e9..e1dd6bdade9 100644 --- a/addons/account/report/account_tax_code.rml +++ b/addons/account/report/account_tax_code.rml @@ -41,7 +41,21 @@ - + + + + + + + + + + + + + + + @@ -69,6 +83,7 @@ + @@ -90,81 +105,44 @@ - - - + + + + + [[ o.name ]] + +
- - Date - - - Voucher Nb - - - Account Number - - - Third party (Country) - - - Entry label - - - Debit - - - Credit - - - - - - [[ repeatIn(objects, 'o') ]] - [[ repeatIn(o.line_ids, 'line') ]] - - - - [[ formatLang(line.date,date=True) ]] - - - [[ line.ref ]] - - - [[ line.account_id.code ]] - - - [[ line.partner_id and line.partner_id.name ]]([[ line.partner_id and line.partner_id.address and line.partner_id.address[0].country_id.code or removeParentNode('font') ]] ) - - - [[ line.name ]] - - - [[ formatLang(line.debit) ]] - - - [[ formatLang(line.credit) ]] - - - - + Date + Voucher Nb + Account Number + Third party (Country) + Entry label + Debit + Credit + + [[ repeatIn(get_line(o),'line') ]][[ not line and removeParentNode('tr') ]][[ formatLang(line['date'],date=True) ]] + [[ line['ref'] ]] + [[ line['acode'] ]] + [[ line['pname'] ]]([[ line['country'] ]] ) + [[ line['name'] ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit']) ]] +
diff --git a/addons/account/report/central_journal.rml b/addons/account/report/central_journal.rml index d8f78bce8cb..1fe5b8be0f8 100644 --- a/addons/account/report/central_journal.rml +++ b/addons/account/report/central_journal.rml @@ -80,6 +80,7 @@ + @@ -103,79 +104,50 @@ - + - + - + [[ repeatIn(objects, 'o') ]] - - - - - - - Central Journal - - - - - + + Central Journal + - + - - Journal Code - - - Journal Name - - - Printing Date - + Journal Code + Journal Name + Printing Date - - [[ o.journal_id.code or '' ]] - - - [[ o.journal_id.name ]] - - - [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] - + [[ o.journal_id.code or '' ]] + [[ o.journal_id.name ]] + [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time = True) ]] - + - - Account Num. - - - Account Name - - - Debit - - - Credit - + Account Num. + Account Name + Debit + Credit @@ -183,20 +155,10 @@ - - Total: - - - - - - - - [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] - - - [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] - + Total: + + [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] + [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] @@ -206,25 +168,17 @@ [[ repeatIn(lines(o.period_id.id,o.journal_id.id),'line') ]] - - [[ line['code'] ]] - - - [[ line['name'] ]] - - - [[ formatLang(line['debit']) ]] - - - [[ formatLang(line['credit'])]] - + [[ line['code'] ]] + [[ line['name'] ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit'])]] - + diff --git a/addons/account/report/general_journal.rml b/addons/account/report/general_journal.rml index 5a9ccff4213..6c62d82eb88 100644 --- a/addons/account/report/general_journal.rml +++ b/addons/account/report/general_journal.rml @@ -52,6 +52,7 @@ + @@ -84,13 +85,10 @@ - + - - - - + @@ -110,10 +108,10 @@ - + - + Printing Date : @@ -123,60 +121,27 @@ - + - - - - + - - Code - - - Journal Name - - - Period - - - Debit Trans. - - - Credit Trans. - + Code + Journal Name + Period + Debit Trans. + Credit Trans. - - - - - Total: - - - - - - - - - - - - - [[ formatLang(sum_debit()) ]] - - - [[ formatLang( sum_credit()) ]] - + Total: + + + [[ formatLang(sum_debit()) ]] + [[ formatLang( sum_credit()) ]] - - -
[[ repeatIn( periods(objects), 'o') ]] @@ -228,7 +193,7 @@
- +
diff --git a/addons/account/report/invoice.rml b/addons/account/report/invoice.rml index f3acb1c3a54..48ce2043177 100644 --- a/addons/account/report/invoice.rml +++ b/addons/account/report/invoice.rml @@ -206,6 +206,7 @@ + @@ -235,11 +236,7 @@ [[ setLang(o.partner_id.lang) ]] - - - - - + [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] [[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]] @@ -248,7 +245,7 @@ [[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]] [[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]] [[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]] - + Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]] @@ -264,131 +261,61 @@ Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] [[ o.number ]] - + - - Document - - - Invoice Date - - - Partner Ref. - + Document + Invoice Date + Partner Ref. - - [[ o.name ]] - - - [[ formatLang(o.date_invoice,date=True) ]] - - - [[ o.address_invoice_id.partner_id.ref or '' ]] - + [[ o.name ]] + [[ formatLang(o.date_invoice,date=True) ]] + [[ o.address_invoice_id.partner_id.ref or '' ]] - + + + + - - Description - - - Taxes - - - Quantity - - - Unit Price - - - Disc. (%) - - - Price - + Description + Taxes + Quantity + Unit Price + Disc. (%) + Price
[[ repeatIn(o.invoice_line,'l') ]] - - [[ l.name ]] - - - [[ ', '.join([ lt.description or '' for lt in l.invoice_line_tax_id ]) ]] - - - [[ formatLang(l.quantity)]] - - - [[ (l.uos_id and l.uos_id.name) or '' ]] - - - [[ formatLang(l.price_unit) ]] - - - [[ formatLang(l.discount) ]] - - - [[ formatLang(l.price_subtotal) ]] - - - [[ o.currency_id.code ]] - + [[ l.name ]] + [[ ', '.join([ lt.description or '' for lt in l.invoice_line_tax_id ]) ]] + [[ formatLang(l.quantity)]] + [[ (l.uos_id and l.uos_id.name) or '' ]] + [[ formatLang(l.price_unit) ]] + [[ formatLang(l.discount) ]] + [[ formatLang(l.price_subtotal) ]] + [[ o.currency_id.code ]] - - [[ format(l.note or removeParentNode('tr')) ]] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + [[ format(l.note or removeParentNode('tr')) ]] + + + + + + +
@@ -397,63 +324,31 @@ - - - - - - - - - - + + - - Net Total: - - - [[ formatLang(o.amount_untaxed) ]] - - - [[ o.currency_id.code ]] - + Net Total: + [[ formatLang(o.amount_untaxed) ]] + [[ o.currency_id.code ]] - - - - - Taxes: - - - [[ formatLang(o.amount_tax) ]] - - - [[ o.currency_id.code ]] - + Taxes: + [[ formatLang(o.amount_tax) ]] + [[ o.currency_id.code ]] - - - - - Total: - - - [[ formatLang(o.amount_total) ]] - - - [[ o.currency_id.code ]] - + Total: + [[ formatLang(o.amount_total) ]] + [[ o.currency_id.code ]] @@ -462,25 +357,13 @@ - - - - - Tax - - - Base - - - Amount - + Tax + Base + Amount - - - @@ -488,15 +371,9 @@ [[ repeatIn(o.tax_line,'t') ]] - - [[ t.name ]] - - - [[ formatLang(t.base) ]] - - - [[ t.tax_code_id.notprintable and removeParentNode('blockTable') or '' ]][[ formatLang(t.amount) ]] - + [[ t.name ]] + [[ formatLang(t.base) ]] + [[ t.tax_code_id.notprintable and removeParentNode('blockTable') or '' ]][[ formatLang(t.amount) ]] @@ -505,21 +382,9 @@ - - - - - - - - - - - - - - - + + + @@ -527,23 +392,13 @@ - - - - - - - - - - + + - - [[ format(o.comment or removeParentNode('blockTable')) ]] - + [[ format(o.comment or removeParentNode('blockTable')) ]] @@ -551,9 +406,7 @@ - - [[ format((o.payment_term and o.payment_term.note) or removeParentNode('blockTable')) ]] - + [[ format((o.payment_term and o.payment_term.note) or removeParentNode('blockTable')) ]] diff --git a/addons/account/report/partner_balance.rml b/addons/account/report/partner_balance.rml index a096b5a2412..86dc57d2d7d 100644 --- a/addons/account/report/partner_balance.rml +++ b/addons/account/report/partner_balance.rml @@ -57,11 +57,33 @@
- - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -88,21 +110,16 @@ - - - - - - - - + + + - - - + + + @@ -110,7 +127,7 @@ - + @@ -289,95 +306,41 @@ fontName="Times-Italic" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0" /> - + - - [[ setTag('tr','tr',{'style':'Line1'}) ]] Code - - - Partner name - - - Débit - - - Crédit - - - Balance - - - In dispute - + Code + (Account/Partner) Name + Debit + Credit + Balance + In dispute - - [[ setTag('tr','tr',{'style':'Line2'}) ]] Grand total - - - - - - [[ formatLang(sum_debit(data)) ]] - - - [[ formatLang(sum_credit(data)) ]] - - - [[ formatLang((solde_debit(data)-solde_credit(data))) ]] - - - [[ formatLang(sum_litige(data)) ]] - + Grand total + + [[ formatLang(sum_debit(data)) ]] + [[ formatLang(sum_credit(data)) ]] + [[ formatLang((solde_debit(data)-solde_credit(data))) ]] + [[ formatLang(sum_litige(data)) ]] - - - [[ repeatIn(lines(data), 'a') ]][[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]] [[ a['ref'] ]] [[ a['type']==3 and a['code'] ]] - - - [[ a['type']==3 and ( setTag('tr','tr',{'style':'TrLevel0'})) ]] [[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]] [[ a['type']==1 and ( setTag('blockTable','blockTable',{'style':'LineLevel1'})) ]] [[ a['name'] ]] - - - - [[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ formatLang(a['debit']) ]] - [[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ formatLang(a['debit']) ]] - - - - - [[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ formatLang(a['credit']) ]] - [[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ formatLang(a['credit']) ]] - - - - - [[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ formatLang(a['balance']) ]] - [[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ formatLang(a['balance']) ]] - - - - - [[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ formatLang(a['enlitige'] or 0.00) ]] - [[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ formatLang(a['enlitige'] or 0.00) ]] - - + Balance + + [[ formatLang(solde_debit(data)) ]] + [[ formatLang(solde_credit(data)) ]] + + + + + [[ repeatIn(lines(data), 'a') ]][[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]][[ a['ref'] ]] [[ a['type']==3 and a['code'] ]] + [[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]][[ a['name'] ]] + [[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]][[ formatLang(a['debit']) ]] + [[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]][[ formatLang(a['credit']) ]] + [[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]][[ formatLang(a['balance']) ]] + [[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]][[ formatLang(a['enlitige'] or 0.00) ]] diff --git a/addons/account/report/tax_report.py b/addons/account/report/tax_report.py index d82f9ab99bd..abbef9ab238 100644 --- a/addons/account/report/tax_report.py +++ b/addons/account/report/tax_report.py @@ -57,8 +57,8 @@ class tax_report(rml_parse.rml_parse): return new else: return self.comma_me(new) - def _get_lines(self, based_on,period_list,company_id=False, parent=False, level=0): - res = self._get_codes(based_on,parent,level,period_list) + def _get_lines(self, based_on,period_list,company_id, parent=False, level=0): + res = self._get_codes(based_on,company_id,parent,level,period_list) if period_list[0][2] : res = self._add_codes(based_on,res,period_list) @@ -157,15 +157,15 @@ class tax_report(rml_parse.rml_parse): i+=1 return res - def _get_codes(self, based_on, parent=False, level=0,period_list=[]): + def _get_codes(self,based_on, company_id, parent=False, level=0,period_list=[]): tc = self.pool.get('account.tax.code') - ids = tc.search(self.cr, self.uid, [('parent_id','=',parent)]) + ids = tc.search(self.cr, self.uid, [('parent_id','=',parent),('company_id','=',company_id)]) res = [] for code in tc.browse(self.cr, self.uid, ids, {'based_on': based_on}): res.append(('.'*2*level,code)) - res += self._get_codes(based_on, code.id, level+1) + res += self._get_codes(based_on, company_id, code.id, level+1) return res def _add_codes(self,based_on, account_list=[],period_list=[]): diff --git a/addons/account/report/tax_report.rml b/addons/account/report/tax_report.rml index 9cdba22c43f..eecf76f7551 100644 --- a/addons/account/report/tax_report.rml +++ b/addons/account/report/tax_report.rml @@ -54,10 +54,10 @@ - - - - + + + + @@ -88,7 +88,7 @@ - + @@ -116,61 +116,20 @@ - - - - - - - - Code - - - Debit - - - Credit - - - Tax Amount - - - - - - - [[ repeatIn(get_lines(data['form']['based_on'],data['form']['periods'],data['form']['company_id']), 'o') ]] - - [[ '...'*len(o['level']) ]] - [[o['type']==1 and ( setTag('para','para',{'fontName':'Helvetica-Bold'}))]] - - [[ o['code'] ]] [[ o['name'] ]] - - - - - - [[ len(o['level'])>3 and removeParentNode('font') ]][[ formatLang(o['debit']) ]] - [[ len(o['level'])<4 and removeParentNode('font') ]][[ formatLang(o['debit']) ]] - - - - [[ len(o['level'])>3 and removeParentNode('font') ]][[ formatLang(o['credit'])]] - [[ len(o['level'])<4 and removeParentNode('font') ]][[ formatLang(o['credit'])]] - - - - - [[ len(o['level'])>3 and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] - [[ len(o['level'])<4 and removeParentNode('font') ]][[ formatLang(o['tax_amount']) ]] - - - - - - - - - + + + + Tax Name + Debit + Credit + Tax Amount + + + [[ repeatIn(get_lines(data['form']['based_on'],data['form']['periods'],data['form']['company_id']), 'o') ]][[ '...'*len(o['level']) ]] [[o['type']==1 and ( setTag('para','para',{'fontName':'Helvetica-Bold'}))]][[ o['code'] ]] [[ o['name'] ]] + [[ len(o['level'])<3 and setTag('para','para',{'fontName':"Helvetica-Bold"}) ]][[ formatLang(o['debit']) ]] + [[ len(o['level'])<3 and setTag('para','para',{'fontName':"Helvetica-Bold"}) ]][[ formatLang(o['credit'])]] + [[ len(o['level'])<3 and setTag('para','para',{'fontName':"Helvetica-Bold"}) ]][[ formatLang(o['tax_amount']) ]] + + diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py index 3004beddd7e..9828fdfbd63 100644 --- a/addons/account/report/third_party_ledger.py +++ b/addons/account/report/third_party_ledger.py @@ -447,4 +447,8 @@ report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner', 'addons/account/report/third_party_ledger.rml',parser=third_party_ledger, header=False) +report_sxw.report_sxw('report.account.third_party_ledger_other', 'res.partner', + 'addons/account/report/third_party_ledger_other.rml',parser=third_party_ledger, + header=False) + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/third_party_ledger.rml b/addons/account/report/third_party_ledger.rml index 91a9b67d7ca..82d14a6ef94 100644 --- a/addons/account/report/third_party_ledger.rml +++ b/addons/account/report/third_party_ledger.rml @@ -124,117 +124,54 @@ - - - [[ data['form']['page_split'] == True or removeParentNode('para') ]] - [[ repeatIn(objects, 'p') ]] [[ setLang(p.partner_id.lang) ]] - - + [[ repeatIn(objects, 'p') ]] [[ setLang(p.partner_id.lang) ]] - - - Date - - - JNRL - - - Ref. - - - Entry label - - - Debit - - - Credit - - - Balance - - - + Date + JNRL + Ref. + Entry label + Debit + Credit + Balance - + - - Balance brought forward - - - [[ formatLang((sum_debit(data))) ]] - - - [[ formatLang((sum_credit(data))) ]] - - - [[ formatLang((sum_debit(data) - sum_credit(data))) ]] - + Balance brought forward + [[ formatLang((sum_debit(data))) ]] + [[ formatLang((sum_credit(data))) ]] + [[ formatLang((sum_debit(data) - sum_credit(data))) ]] - - [[ data['form']['page_split'] == False or removeParentNode('para') ]] - [[ repeatIn(objects, 'p') ]] - - - [[ p.ref ]] - [[ p.name ]] - - - - - - [[ formatLang((sum_debit_partner(p,data))) ]] - - - [[ formatLang((sum_credit_partner(p,data))) ]] - - - [[ formatLang((sum_debit_partner(p,data) - sum_credit_partner(p,data))) ]] - + [[ p.ref ]] - [[ p.name ]] + + [[ formatLang((sum_debit_partner(p,data))) ]] + [[ formatLang((sum_credit_partner(p,data))) ]] + [[ formatLang((sum_debit_partner(p,data) - sum_credit_partner(p,data))) ]] - - [[ repeatIn(lines(p,data), 'line') ]][[ formatLang(line['date'],date=True) ]] - - - [[ line['code'] ]] - - - [[ line['ref'] ]] / [[ line['name'] ]] - - - - - - [[ formatLang((line['debit'])) ]] - - - [[ formatLang((line['credit'])) ]] - - - [[ formatLang((line['progress'])) ]] - + [[ repeatIn(lines(p,data), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['code'] ]] + [[ line['ref'] ]] / [[ line['name'] ]] + + [[ formatLang((line['debit'])) ]] + [[ formatLang((line['credit'])) ]] + [[ formatLang((line['progress'])) ]] - - - - - \ No newline at end of file diff --git a/addons/account/report/third_party_ledger_other.rml b/addons/account/report/third_party_ledger_other.rml new file mode 100644 index 00000000000..36a208d1206 --- /dev/null +++ b/addons/account/report/third_party_ledger_other.rml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Date + JNRL + Ref. + Entry label + Debit + Credit + Balance + + + + + + Balance brought forward + [[ formatLang((sum_debit(data))) ]] + [[ formatLang((sum_credit(data))) ]] + [[ formatLang((sum_debit(data) - sum_credit(data))) ]] + + + + + + + [[ repeatIn(objects, 'p') ]] + + + [[ p.ref ]] - [[ p.name ]] + + [[ formatLang((sum_debit_partner(p,data))) ]] + [[ formatLang((sum_credit_partner(p,data))) ]] + [[ formatLang((sum_debit_partner(p,data) - sum_credit_partner(p,data))) ]] + + + + + [[ repeatIn(lines(p,data), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['code'] ]] + [[ line['ref'] ]] / [[ line['name'] ]] + + [[ formatLang((line['debit'])) ]] + [[ formatLang((line['credit'])) ]] + [[ formatLang((line['progress'])) ]] + + + + + + + \ No newline at end of file diff --git a/addons/account/wizard/wizard_third_party_ledger.py b/addons/account/wizard/wizard_third_party_ledger.py index 8d7a46868ed..be83d6d615f 100755 --- a/addons/account/wizard/wizard_third_party_ledger.py +++ b/addons/account/wizard/wizard_third_party_ledger.py @@ -105,6 +105,12 @@ class wizard_report(wizard.interface): data['form']['soldeinit'] = True return data['form'] + def _check(self, cr, uid, data, context): + if data['form']['page_split']==True: + return 'report' + else: + return 'report_other' + def _check_date(self, cr, uid, data, context): sql = """ @@ -134,12 +140,21 @@ class wizard_report(wizard.interface): states = { 'init': { 'actions': [_get_defaults], - 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]} + 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('checkreport','Print','gtk-print')]} + }, + 'checkreport': { + 'actions': [], + 'result': {'type':'choice','next_state':_check} }, 'report': { 'actions': [_check_state], 'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'} + }, + 'report_other': { + 'actions': [_check_state], + 'result': {'type':'print', 'report':'account.third_party_ledger_other', 'state':'end'} } + } wizard_report('account.third_party_ledger.report') From 091d2ade166cad146402d4a6862c739544d2f82d Mon Sep 17 00:00:00 2001 From: "vra (Tiny)" Date: Thu, 28 May 2009 18:39:46 +0530 Subject: [PATCH 04/17] Done changes in invoice layout view module reports with account invoice report. bzr revid: vinusoft85@gmail.com-20090528130946-vf733jy1d76kw6f7 --- addons/account/report/invoice.rml | 24 +- .../report/report_account_invoice_layout.rml | 403 ++++++++---------- .../report/special_message_invoice.rml | 396 ++++++++--------- 3 files changed, 366 insertions(+), 457 deletions(-) diff --git a/addons/account/report/invoice.rml b/addons/account/report/invoice.rml index 48ce2043177..876b6bc4813 100644 --- a/addons/account/report/invoice.rml +++ b/addons/account/report/invoice.rml @@ -206,7 +206,7 @@ - + @@ -245,9 +245,7 @@ [[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]] [[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]] [[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]] - - - + Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]] Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]] VAT : [[ o.partner_id.vat or removeParentNode('para') ]] @@ -261,9 +259,7 @@ Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] [[ o.number ]] - - - + Document @@ -278,19 +274,15 @@ [[ o.address_invoice_id.partner_id.ref or '' ]] - - - - - - - + + + Description Taxes Quantity - Unit Price - Disc. (%) + Unit Price + Disc.(%) Price diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.rml b/addons/account_invoice_layout/report/report_account_invoice_layout.rml index f9166f00104..5fabe670f81 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.rml +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.rml @@ -17,16 +17,20 @@ - - - - - - + + + + + + + + + + @@ -35,89 +39,88 @@ - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects,'o') ]] [[ setLang(o.partner_id.lang) ]] - - - - - - - -[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] -[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]] -[[ o.address_invoice_id.street ]] -[[ o.address_invoice_id.street2 or '' ]] -[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]] -[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]] -[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]] - - - -Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]] -Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]] -VAT : [[ o.partner_id.vat or removeParentNode('para') ]] - - + + + + [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] + [[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]] + [[ o.address_invoice_id.street ]] + [[ o.address_invoice_id.street2 or '' ]] + [[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]] + [[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]] + [[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]] + + Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]] + Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]] + VAT : [[ o.partner_id.vat or removeParentNode('para') ]] + + - - + + Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]] PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma') or removeParentNode('para')) and '' ]] @@ -125,190 +128,142 @@ Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]] Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] - -Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] -[[ o.number ]] +Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]][[ o.number ]] + + - - +Document:[[ o.name ]] + +Invoice Date: [[ formatLang(o.date_invoice,date=True) ]] +Customer Ref:[[ o.address_invoice_id.partner_id.ref or '/' ]] + + - -Document:[[ o.name ]] - - -Invoice Date: [[ formatLang(o.date_invoice,date=True) ]] - - -Customer Ref: [[ o.address_invoice_id.partner_id.ref or '/' ]] - - - - - - - + - -Description - - -Taxes - - -Quantity - - -Unit Price - - -Disc. (%) - - -Price - +Description +Taxes +Quantity +Unit Price +Disc. (%) +Price
[[ repeatIn(invoice_lines(o), 'a') ]] - + - - [[ a['type']=='text' and removeParentNode('blockTable')]] - - - [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['name'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['tax_types'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['quantity'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['uos'] ]] - - - - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['price_unit'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['discount'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['price_subtotal'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['currency'] ]] - + [[ a['type']=='text' and removeParentNode('blockTable')]] + [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['name'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['tax_types'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['quantity'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['uos'] ]] + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_unit'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['discount'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_subtotal'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['currency'] ]] + + + + [[ format(a['note'] or removeParentNode('tr')) ]] + + + + + + + + - - [[ a['type']=='text' and a['name'] or removeParentNode('blockTable') ]] - - - [[ a['type']=='text' and '' or removeParentNode('blockTable') ]] - - - - - - - [[ a['note']=='' and removeParentNode('blockTable') ]][[ repeatIn(( a['note'] and a['note'].splitlines()) or [], 'note') ]] - - - [[ note or removeParentNode('blockTable') ]] - + [[ a['type']=='text' and a['name'] or removeParentNode('blockTable') ]] + [[ a['type']=='text' and '' or removeParentNode('blockTable') ]] [[ a['type']!='break' and removeParentNode('pageBreak')]] - + - - Description [[ a['type']!='break' and removeParentNode('blockTable')]] - - - Taxes - - - Quantity - - - Unit Price - - - Disc. (%) - - - Price - + Description [[ a['type']!='break' and removeParentNode('blockTable')]] + Taxes + Quantity + Unit Price + Disc. (%) + Price
- - + + + + + + + + + + + + + + + + + + + + Total (Excl. taxes): + [[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]] + + + Taxes: + [[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] + + + Total (Incl. taxes): + [[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]] + + + + + + - - -Tax - - -Base - - -Amount - - - - -[[ repeatIn(o.tax_line,'t') ]] [[ t.name ]] - - -[[ '%.2f' % t.base ]] - - -[[ '%.2f' % t.amount]] - - + + Tax + Base + Amount + + + [[ repeatIn(o.tax_line,'t') ]][[ t.name ]] + [[ '%.2f' % t.base ]] + [[ '%.2f' % t.amount]] + - - - -Total (excl. taxes): - - -[[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]] + + + + + + + + + + + + - - -Taxes: - - -[[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] - - - - -Total (incl. taxes): + + + - - -[[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]] - - - - - - - [[ format(o.comment) or '' ]] [[ format(o.payment_term and o.payment_term.note) or '' ]]
diff --git a/addons/account_invoice_layout/report/special_message_invoice.rml b/addons/account_invoice_layout/report/special_message_invoice.rml index 4878163a1b8..16deca9e70c 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.rml +++ b/addons/account_invoice_layout/report/special_message_invoice.rml @@ -17,16 +17,20 @@ - - - - - - + + + + + + + + + + @@ -35,87 +39,89 @@ - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(objects,'o') ]] [[ setLang(o.partner_id.lang) ]] - - - - - - - -[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] -[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]] -[[ o.address_invoice_id.street ]] -[[ o.address_invoice_id.street2 or '' ]] -[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]] -[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]] -[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]] - - - -Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]] -Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]] -VAT : [[ o.partner_id.vat or removeParentNode('para') ]] - - + + + + [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]] + [[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]] + [[ o.address_invoice_id.street ]] + [[ o.address_invoice_id.street2 or '' ]] + [[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]] + [[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]] + [[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]] + + + + Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]] + Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]] + VAT : [[ o.partner_id.vat or removeParentNode('para') ]] + + - + Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]] @@ -124,189 +130,145 @@ Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]] Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]] - -Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] -[[ o.number ]] - - +Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]][[ o.number ]] + - -Document:[[o.name]] - - -Invoice Date: [[ formatLang(o.date_invoice,date=True) ]] - - -Customer Ref: [[ o.address_invoice_id.partner_id.ref or '/' ]] - - - - - - -Description - - -Taxes - - -Quantity - - -Unit Price - - -Disc. (%) - - -Price - - +Document:[[o.name]] + +Invoice Date: [[ formatLang(o.date_invoice,date=True) ]] +Customer Ref: [[ o.address_invoice_id.partner_id.ref or '/' ]] + + + + Description + Taxes + Quantity + Unit Price + Disc. (%) + Price +
[[ repeatIn(invoice_lines(o), 'a') ]] - + - - [[ a['type']=='text' and removeParentNode('blockTable')]] - - - [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['name'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['tax_types'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['quantity'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['uos'] ]] - - - - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['price_unit'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['discount'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['price_subtotal'] ]] - - - [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['currency'] ]] - + [[ a['type']=='text' and removeParentNode('blockTable')]] + [[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['name'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['tax_types'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['quantity'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['uos'] ]] + + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_unit'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['discount'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['price_subtotal'] ]] + [[ a['type']=='subtotal' and ( setTag('para','para',{'fontName':'Helvetica-bold'})) ]][[ a['currency'] ]] + + + + [[ format(a['note'] or '') ]] + + + + + + + + - - [[ a['type']=='text' and a['name'] or removeParentNode('blockTable') ]] - - - [[ a['type']=='text' and '' or removeParentNode('blockTable') ]] - - - - - - - [[ a['note']=='' and removeParentNode('blockTable') ]][[ repeatIn(( a['note'] and a['note'].splitlines()) or [], 'note') ]] - - - [[ note or removeParentNode('blockTable') ]] - + [[ a['type']=='text' and a['name'] or removeParentNode('blockTable') ]] + [[ a['type']=='text' and '' or removeParentNode('blockTable') ]] [[ a['type']!='break' and removeParentNode('pageBreak')]] - + - - Description [[ a['type']!='break' and removeParentNode('blockTable')]] - - - Taxes - - - Quantity - - - Unit Price - - - Disc. (%) - - - Price - + Description [[ a['type']!='break' and removeParentNode('blockTable')]] + Taxes + Quantity + Unit Price + Disc. (%) + Price
- - + - - - -Tax + + + + + + + + + + + + -Base - - -Amount - - - - -[[ repeatIn(o.tax_line,'t') ]] [[ t.name ]] - - -[[ '%.2f' % t.base ]] - - -[[ '%.2f' % t.amount]] + + + Total (Excl. taxes): + [[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]] + + + Taxes: + [[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] + + + Total (Incl. taxes): + [[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]] + + - - - + -Total (excl. taxes): + + + Tax + Base + Amount + + + [[ repeatIn(o.tax_line,'t') ]][[ t.name ]] + [[ '%.2f' % t.base ]] + [[ '%.2f' % t.amount]] + + -[[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]] + + + + + + + + + + + + - - -Taxes: - - -[[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]] - - - - -Total (incl. taxes): + + + - - -[[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]] - - - - - - - [[ format(o.comment) or '' ]] [[ format(o.payment_term and o.payment_term.note) or '' ]] + + +
[[ repeatIn((spcl_msg(data['form']) and spcl_msg(data['form']).splitlines()) or [], 'note') ]] [[ note or removeParentNode('para') ]] From 7a561ffcd85a478515dbc72af04fb70847991e16 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 28 May 2009 18:27:35 +0200 Subject: [PATCH 05/17] [IMP] email_send: when debuging, output to the logger bzr revid: christophe@tinyerp.com-20090528162735-9x5wvgjp05z1zwt9 --- bin/tools/misc.py | 51 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 951a2df5629..d8ad910f5fc 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -304,6 +304,7 @@ def reverse_enumerate(l): #---------------------------------------------------------- def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False, attach=None, tinycrm=False, ssl=False, debug=False, subtype='plain', x_headers=None): + """Send an email.""" import smtplib from email.MIMEText import MIMEText @@ -313,6 +314,7 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non from email.Utils import formatdate, COMMASPACE from email.Utils import formatdate, COMMASPACE from email import Encoders + import netsvc if x_headers is None: x_headers = {} @@ -368,29 +370,48 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename="%s"' % (fname,)) msg.attach(part) + + class WriteToLogger(object): + def __init__(self): + self.logger = netsvc.Logger() + + def write(self, s): + self.logger.notifyChannel('email_send', netsvc.LOG_DEBUG, s) + try: + oldstderr = smtplib.stderr s = smtplib.SMTP() + + try: + # in case of debug, the messages are printed to stderr. + if debug: + smtplib.stderr = WriteToLogger() - if debug: - s.debuglevel = 5 - s.connect(config['smtp_server'], config['smtp_port']) - if ssl: - s.ehlo() - s.starttls() - s.ehlo() + s.set_debuglevel(int(bool(debug))) # 0 or 1 + + s.connect(config['smtp_server'], config['smtp_port']) + if ssl: + s.ehlo() + s.starttls() + s.ehlo() - if config['smtp_user'] or config['smtp_password']: - s.login(config['smtp_user'], config['smtp_password']) + if config['smtp_user'] or config['smtp_password']: + s.login(config['smtp_user'], config['smtp_password']) + + s.sendmail(email_from, + flatten([email_to, email_cc, email_bcc]), + msg.as_string() + ) + + finally: + s.quit() + if debug: + smtplib.stderr = oldstderr - s.sendmail(email_from, - flatten([email_to, email_cc, email_bcc]), - msg.as_string() - ) - s.quit() except Exception, e: - import netsvc netsvc.Logger().notifyChannel('email_send', netsvc.LOG_ERROR, e) return False + return True #---------------------------------------------------------- From 0fdb1f7a02e148501bf77100a13f6c91c71d6ab6 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 29 May 2009 02:23:58 +0200 Subject: [PATCH 06/17] bugfix_xml_view_schema_gantt bzr revid: fp@tinyerp.com-20090529002358-9ycrzw34oipo6emh --- bin/addons/base/rng/view.rng | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/addons/base/rng/view.rng b/bin/addons/base/rng/view.rng index d87a4cd8ffa..f720fa76d12 100644 --- a/bin/addons/base/rng/view.rng +++ b/bin/addons/base/rng/view.rng @@ -88,6 +88,7 @@ + From 1fe8ed7828b45c91ef3f46cfd09b94ec98ec48c1 Mon Sep 17 00:00:00 2001 From: "vra (Tiny)" Date: Fri, 29 May 2009 10:54:32 +0530 Subject: [PATCH 07/17] Fix account-code duplication error in membership module. bzr revid: vinusoft85@gmail.com-20090529052432-b8dnw74s7eyxjwk7 --- addons/membership/membership_demo.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/membership/membership_demo.xml b/addons/membership/membership_demo.xml index dba3e44abc3..35b04539ce3 100644 --- a/addons/membership/membership_demo.xml +++ b/addons/membership/membership_demo.xml @@ -26,7 +26,7 @@ membership - 0 + Membership-0 @@ -36,7 +36,7 @@ membership account - 1254 + Membership-1254 From 946f31968454eadcca1fa3482d8ab81791e3a932 Mon Sep 17 00:00:00 2001 From: "vra (Tiny)" Date: Fri, 29 May 2009 11:40:25 +0530 Subject: [PATCH 08/17] Fix the wizard of general ledger problem of account module. bzr revid: vinusoft85@gmail.com-20090529061025-st1250svxh76oyqs --- .../account/wizard/wizard_general_ledger_report.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index 47191fa1d2b..c03171f8e61 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -120,10 +120,10 @@ def _check_state(self, cr, uid, data, context): if data['form']['state'] == 'bydate': _check_date(self, cr, uid, data, context) - data['form']['fiscalyear'] = 0 - else : - - data['form']['fiscalyear'] = 1 +# data['form']['fiscalyear'] = 0 +# else : +# +# data['form']['fiscalyear'] = 1 return data['form'] @@ -138,8 +138,8 @@ class wizard_report(wizard.interface): fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear') data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid) - periods_obj=pooler.get_pool(cr.dbname).get('account.period') - data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) + #periods_obj=pooler.get_pool(cr.dbname).get('account.period') + #data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])]) data['form']['sortbydate'] = 'sort_date' data['form']['display_account']='bal_all' data['form']['landscape']=True From 6ce374e1f675c7fb6cad1d795f2ea1c8ac99c775 Mon Sep 17 00:00:00 2001 From: "vra (Tiny)" Date: Fri, 29 May 2009 15:17:17 +0530 Subject: [PATCH 09/17] Solve the problem of soldeinit field of wizard. bzr revid: vinusoft85@gmail.com-20090529094717-emgztdcih993amj2 --- addons/account/report/general_ledger_landscape.py | 12 ++++++------ .../account/wizard/wizard_general_ledger_report.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index 7c224a24dca..33eb1ec67ba 100644 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -322,8 +322,8 @@ class general_ledger_landscape(rml_parse.rml_parse): ## Add solde init to the result # sum_debit = self.cr.fetchone()[0] or 0.0 - if form['soldeinit']: - sum_debit += account.init_debit + #if form['soldeinit']: + sum_debit += account.init_debit # ## return sum_debit @@ -336,8 +336,8 @@ class general_ledger_landscape(rml_parse.rml_parse): ## Add solde init to the result # sum_credit = self.cr.fetchone()[0] or 0.0 - if form['soldeinit']: - sum_credit += account.init_credit + #if form['soldeinit']: + sum_credit += account.init_credit # ## @@ -348,8 +348,8 @@ class general_ledger_landscape(rml_parse.rml_parse): "FROM account_move_line l "\ "WHERE l.account_id = %s AND %s"%(account.id,self.query)) sum_solde = self.cr.fetchone()[0] or 0.0 - if form['soldeinit']: - sum_solde += account.init_debit - account.init_credit + #if form['soldeinit'] != 0: + sum_solde += account.init_debit - account.init_credit return sum_solde diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index c03171f8e61..afd8a272a66 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -84,7 +84,7 @@ period_fields = { 'sortbydate':{'string':"Sort by:",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Movement')]}, 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}, 'landscape':{'string':"Landscape Mode",'type':'boolean'}, - 'soldeinit':{'string':"Include initial balances",'type':'boolean'}, + # 'soldeinit':{'string':"Include initial balances",'type':'boolean'}, 'amount_currency':{'string':"With Currency",'type':'boolean'}, 'date_from': {'string':" Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')}, 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, From d444fffbc8c8d6c0cb79457631c46d53c5793d2b Mon Sep 17 00:00:00 2001 From: "vra (Tiny)" Date: Fri, 29 May 2009 15:47:45 +0530 Subject: [PATCH 10/17] Solve general ledger report problem. bzr revid: vinusoft85@gmail.com-20090529101745-hxij4fjodfc1uuh0 --- addons/account/report/general_ledger.py | 192 ++++++------------ addons/account/report/general_ledger.rml | 6 +- .../report/general_ledger_landscape.py | 109 +++------- .../report/general_ledger_landscape.rml | 11 +- 4 files changed, 93 insertions(+), 225 deletions(-) diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index f9c2f30c0e1..43e63dd592f 100644 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -110,96 +110,8 @@ class general_ledger(rml_parse.rml_parse): result[account_line.id] = concat + '...' break rup_id+=1 - - #print str(result) return result - def get_children_accounts(self, account, form): - self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, - [('parent_id', 'child_of', self.ids)]) - res = [] - ctx = self.context.copy() - ## We will make the test for period or date - ## We will now make the test - # - if form.has_key('fiscalyear'): - ctx['fiscalyear'] = form['fiscalyear'] - ctx['periods'] = form['periods'][0][2] - else: - ctx['date_from'] = form['date_from'] - ctx['date_to'] = form['date_to'] - # - # - self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) - if account and account.child_consol_ids: # add ids of consolidated childs also of selected account - ctx['consolidate_childs'] = True - ctx['account_id'] = account.id - ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])],context=ctx) - - for child_id in ids_acc: - child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) - - sold_account = self._sum_solde_account(child_account,form) - - self.sold_accounts[child_account.id] = sold_account - - if form['display_account'] == 'bal_mouvement': - if child_account.type != 'view' \ - and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], - context=ctx)) <> 0 : - res.append(child_account) - #print "Type de vue :" + form['display_account'] - elif form['display_account'] == 'bal_solde': - if child_account.type != 'view' \ - and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], - context=ctx)) <> 0 : - if ( sold_account <> 0.0): - res.append(child_account) - else: - if child_account.type != 'view' \ - and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','>=',child_account.id)], - context=ctx)) <> 0 : - res.append(child_account) - - ## - - - ## We will now compute solde initiaux - - if not len(res): - return[account] - else: - for move in res: - - SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'" - self.cr.execute(SOLDEINIT) - resultat = self.cr.dictfetchall() - - if resultat[0] : - - if resultat[0]['sum_debit'] == None: - sum_debit = 0 - else: - - sum_debit = resultat[0]['sum_debit'] - if resultat[0]['sum_credit'] == None: - sum_credit = 0 - else: - sum_credit = resultat[0]['sum_credit'] - - move.init_credit = sum_credit - move.init_debit = sum_debit - - else: - move.init_credit = 0 - move.init_debit = 0 - - ## - return res - def get_min_date(self,form): ## Get max born from account_fiscal year @@ -256,6 +168,7 @@ class general_ledger(rml_parse.rml_parse): else : borne_max = date_max elif form['state'] == 'none': + sql = """ SELECT min(date) as start_date,max(date) as stop_date FROM account_move_line """ self.cr.execute(sql) @@ -270,6 +183,54 @@ class general_ledger(rml_parse.rml_parse): + + def get_children_accounts(self, acc_l, form): + self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, + [('parent_id', 'child_of', self.ids)]) + done_l = [] + res = [] + ctx = self.context.copy() + ## We will make the test for period or date + ## We will now make the test + # + if form.has_key('fiscalyear'): + ctx['fiscalyear'] = form['fiscalyear'] + ctx['periods'] = form['periods'][0][2] + else: + ctx['date_from'] = form['date_from'] + ctx['date_to'] = form['date_to'] + ## + + # + self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) + ids_acc = [] + for acc in acc_l: + if acc and acc.child_consol_ids: # add ids of consolidated childs also of selected account + ctx['consolidate_childs'] = True + ctx['account_id'] = acc.id + ids_acc += self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [acc.id])], context=ctx) + for child_id in ids_acc: + if child_id not in done_l: + done_l.append(child_id) + else: + continue + child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) + sold_account = self._sum_solde_account(child_account,form) + self.sold_accounts[child_account.id] = sold_account + accounts = self.pool.get('account.account').read(self.cr, self.uid, child_id,['debit','credit','balance']) + if form['display_account'] == 'bal_mouvement': + if accounts['credit'] > 0 or accounts['debit'] > 0 or accounts['balance'] > 0 : + #if child_account not in res: + res.append(child_account) + elif form['display_account'] == 'bal_solde': + if accounts['balance'] != 0: + if ( sold_account <> 0.0): + res.append(child_account) + + else: + res.append(child_account) + return res + def lines(self, account, form): inv_types = { 'out_invoice': 'CI: ', @@ -277,13 +238,11 @@ class general_ledger(rml_parse.rml_parse): 'out_refund': 'OR: ', 'in_refund': 'SR: ', } - ### We will now compute solde initaux if form['sortbydate'] == 'sort_date': sorttag = 'l.date' else: sorttag = 'j.code' - sql = """ SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name , l.debit, l.credit, l.period_id FROM account_move_line as l @@ -298,7 +257,6 @@ class general_ledger(rml_parse.rml_parse): self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date'],)) res = self.cr.dictfetchall() - sum = 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') for l in res: @@ -313,7 +271,10 @@ class general_ledger(rml_parse.rml_parse): l['partner'] = line.partner_id.name else : l['partner'] = '' + + sum = l['debit'] - l ['credit'] + # c = time.strptime(l['date'],"%Y-%m-%d") # l['date'] = time.strftime("%d-%m-%Y",c) l['progress'] = sum @@ -326,48 +287,21 @@ class general_ledger(rml_parse.rml_parse): # if l['amount_currency'] != None: self.tot_currency = self.tot_currency + l['amount_currency'] + return res def _sum_debit_account(self, account, form): - - self.cr.execute("SELECT sum(debit) "\ - "FROM account_move_line l "\ - "WHERE l.account_id = %s AND %s "%(account.id, self.query)) - ## Add solde init to the result - # - sum_debit = self.cr.fetchone()[0] or 0.0 - if form['soldeinit']: - sum_debit += account.init_debit - # - ## - return sum_debit + accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['debit']) + return accounts['debit'] def _sum_credit_account(self, account, form): - - self.cr.execute("SELECT sum(credit) "\ - "FROM account_move_line l "\ - "WHERE l.account_id = %s AND %s "%(account.id,self.query)) - ## Add solde init to the result - # - sum_credit = self.cr.fetchone()[0] or 0.0 - if form['soldeinit']: - sum_credit += account.init_credit - # - ## - - return sum_credit + accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['credit']) + return accounts['credit'] def _sum_solde_account(self, account, form): - self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\ - "FROM account_move_line l "\ - "WHERE l.account_id = %s AND %s"%(account.id,self.query)) - sum_solde = self.cr.fetchone()[0] or 0.0 - if form['soldeinit']: - sum_solde += account.init_debit - account.init_credit - - return sum_solde - - + accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['balance']) + return accounts['balance'] + def _sum_debit(self, form): if not self.ids: return 0.0 @@ -377,7 +311,6 @@ class general_ledger(rml_parse.rml_parse): sum_debit = self.cr.fetchone()[0] or 0.0 return sum_debit - def _sum_credit(self, form): if not self.ids: return 0.0 @@ -395,9 +328,6 @@ class general_ledger(rml_parse.rml_parse): self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\ "FROM account_move_line l "\ "WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query) -# print ("SELECT (sum(debit) - sum(credit)) as Test "\ -# "FROM account_move_line l "\ -# "WHERE l.account_id in ("+','.join(map(str, child_ids))+") AND "+query+period_sql) sum_solde = self.cr.fetchone()[0] or 0.0 return sum_solde @@ -411,9 +341,7 @@ class general_ledger(rml_parse.rml_parse): else: self.account_currency = False - def _sum_currency_amount_account(self, account, form): - self._set_get_account_currency_code(account.id) 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() diff --git a/addons/account/report/general_ledger.rml b/addons/account/report/general_ledger.rml index ed2d3dae324..2c5bc28b4cb 100644 --- a/addons/account/report/general_ledger.rml +++ b/addons/account/report/general_ledger.rml @@ -90,7 +90,7 @@ - [[ repeatIn(objects, 'a') ]] + [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] Date @@ -104,7 +104,7 @@
- [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] + [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] @@ -155,7 +155,7 @@
- [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] + [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index 33eb1ec67ba..65b7efafb3b 100644 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -54,6 +54,8 @@ class general_ledger_landscape(rml_parse.rml_parse): def __init__(self, cr, uid, name, context): super(general_ledger_landscape, self).__init__(cr, uid, name, context) self.date_borne = {} + self.sum_debit = 0.00 + self.sum_credit = 0.00 self.query = "" self.child_ids = "" self.tot_currency = 0.0 @@ -178,11 +180,10 @@ class general_ledger_landscape(rml_parse.rml_parse): - def get_children_accounts(self, account, form): - + def get_children_accounts(self, acc_l, form): self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', self.ids)]) -# + done_l = [] res = [] ctx = self.context.copy() ## We will make the test for period or date @@ -198,61 +199,32 @@ class general_ledger_landscape(rml_parse.rml_parse): # self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) - if account and account.child_consol_ids: # add ids of consolidated childs also of selected account - ctx['consolidate_childs'] = True - ctx['account_id'] = account.id - ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])], context=ctx) + ids_acc = [] + for acc in acc_l: + if acc and acc.child_consol_ids: # add ids of consolidated childs also of selected account + ctx['consolidate_childs'] = True + ctx['account_id'] = acc.id + ids_acc += self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [acc.id])], context=ctx) for child_id in ids_acc: + if child_id not in done_l: + done_l.append(child_id) + else: + continue child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) sold_account = self._sum_solde_account(child_account,form) self.sold_accounts[child_account.id] = sold_account + accounts = self.pool.get('account.account').read(self.cr, self.uid, child_id,['debit','credit','balance']) if form['display_account'] == 'bal_mouvement': - if child_account.type != 'view' \ - and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], - context=ctx)) <> 0 : + if accounts['credit'] > 0 or accounts['debit'] > 0 or accounts['balance'] > 0 : + #if child_account not in res: res.append(child_account) elif form['display_account'] == 'bal_solde': - if child_account.type != 'view' \ - and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','=',child_account.id)], - context=ctx)) <> 0 : + if accounts['balance'] != 0: if ( sold_account <> 0.0): res.append(child_account) + else: - if child_account.type != 'view' \ - and len(self.pool.get('account.move.line').search(self.cr, self.uid, - [('account_id','>=',child_account.id)], - context=ctx)) <> 0 : - res.append(child_account) - ## - if not len(res): - - return [account] - else: - ## We will now compute solde initiaux - for move in res: - SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date < '" + self.borne_date['max_date'] + "'" + " AND l.date > '" + self.borne_date['min_date'] + "'" - self.cr.execute(SOLDEINIT) - resultat = self.cr.dictfetchall() - if resultat[0] : - if resultat[0]['sum_debit'] == None: - sum_debit = 0 - else: - sum_debit = resultat[0]['sum_debit'] - if resultat[0]['sum_credit'] == None: - sum_credit = 0 - else: - sum_credit = resultat[0]['sum_credit'] - - move.init_credit = sum_credit - move.init_debit = sum_debit - - else: - move.init_credit = 0 - move.init_debit = 0 - - + res.append(child_account) return res def lines(self, account, form): @@ -315,44 +287,17 @@ class general_ledger_landscape(rml_parse.rml_parse): return res def _sum_debit_account(self, account, form): - - self.cr.execute("SELECT sum(debit) "\ - "FROM account_move_line l "\ - "WHERE l.account_id = %s AND %s "%(account.id, self.query)) - ## Add solde init to the result - # - sum_debit = self.cr.fetchone()[0] or 0.0 - #if form['soldeinit']: - sum_debit += account.init_debit - # - ## - return sum_debit + accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['debit']) + return accounts['debit'] def _sum_credit_account(self, account, form): - - self.cr.execute("SELECT sum(credit) "\ - "FROM account_move_line l "\ - "WHERE l.account_id = %s AND %s "%(account.id,self.query)) - ## Add solde init to the result - # - sum_credit = self.cr.fetchone()[0] or 0.0 - #if form['soldeinit']: - sum_credit += account.init_credit - # - ## - - return sum_credit + accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['credit']) + return accounts['credit'] def _sum_solde_account(self, account, form): - self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\ - "FROM account_move_line l "\ - "WHERE l.account_id = %s AND %s"%(account.id,self.query)) - sum_solde = self.cr.fetchone()[0] or 0.0 - #if form['soldeinit'] != 0: - sum_solde += account.init_debit - account.init_credit - - return sum_solde - + accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['balance']) + return accounts['balance'] + def _sum_debit(self, form): if not self.ids: return 0.0 diff --git a/addons/account/report/general_ledger_landscape.rml b/addons/account/report/general_ledger_landscape.rml index 424c0e3a3f3..3f71ee1f1e6 100644 --- a/addons/account/report/general_ledger_landscape.rml +++ b/addons/account/report/general_ledger_landscape.rml @@ -82,9 +82,6 @@ - - [[ repeatIn(objects, 'a') ]] - [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] Date @@ -102,9 +99,7 @@
- - [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] - + [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] @@ -164,7 +159,7 @@
- [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] + [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] @@ -203,6 +198,6 @@ -
+
\ No newline at end of file From e9bf956c4483be436b0160f7287cdc9105f7c2b4 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 29 May 2009 16:53:59 +0530 Subject: [PATCH 11/17] Modifs bzr revid: jvo@tinyerp.com-20090529112359-nzzojxax22n1mh47 --- addons/account/report/account_balance.rml | 16 +++------------- addons/account/report/account_tax_code.py | 18 +++++++++--------- addons/account/report/tax_report.py | 2 +- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index f74fc8d21b4..fb8eb53c418 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -59,18 +59,8 @@ - - - - - - - - - - - - + + @@ -180,4 +170,4 @@
- \ No newline at end of file + diff --git a/addons/account/report/account_tax_code.py b/addons/account/report/account_tax_code.py index 21126c57146..773e9541d79 100644 --- a/addons/account/report/account_tax_code.py +++ b/addons/account/report/account_tax_code.py @@ -37,27 +37,27 @@ class account_tax_code_report(rml_parse.rml_parse): }) def get_line(self,obj): - res ={} - result=[] + res = {} + result = [] line_ids = self.pool.get('account.move.line').search(self.cr,self.uid,[('tax_code_id','=',obj.id)]) if line_ids: - b_objs = self.pool.get('account.move.line').browse(self.cr,self.uid,line_ids) - for line in b_objs: + move_line_objs = self.pool.get('account.move.line').browse(self.cr,self.uid,line_ids) + for line in move_line_objs: res['date'] = line.date res['ref'] = line.ref res['acode'] = line.account_id.code + res['pname'] = '' + res['country'] = '' + if line.partner_id: res['pname'] = line.partner_id.name - res['country'] = '' - if line.partner_id.address: - if line.partner_id.address[0].country_id: + if line.partner_id.address and line.partner_id.address[0].country_id: res['country'] = line.partner_id.address[0].country_id.code - else: - res['pname'] = '' res['name'] = line.name res['debit'] = line.debit res['credit'] = line.credit result.append(res) + return result report_sxw.report_sxw('report.account.tax.code.entries', 'account.tax.code', diff --git a/addons/account/report/tax_report.py b/addons/account/report/tax_report.py index abbef9ab238..79e59959d12 100644 --- a/addons/account/report/tax_report.py +++ b/addons/account/report/tax_report.py @@ -57,7 +57,7 @@ class tax_report(rml_parse.rml_parse): return new else: return self.comma_me(new) - def _get_lines(self, based_on,period_list,company_id, parent=False, level=0): + def _get_lines(self, based_on,period_list,company_id=False, parent=False, level=0): res = self._get_codes(based_on,company_id,parent,level,period_list) if period_list[0][2] : From d377f1c4231e7dbda79fae731f92e5ec655a852e Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 29 May 2009 17:05:52 +0530 Subject: [PATCH 12/17] Corrections bzr revid: jvo@tinyerp.com-20090529113552-2urvrx2b2zrvj36s --- addons/account/report/partner_balance.rml | 33 +++---------------- .../wizard/wizard_third_party_ledger.py | 2 +- 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/addons/account/report/partner_balance.rml b/addons/account/report/partner_balance.rml index 86dc57d2d7d..ff6e1214a1b 100644 --- a/addons/account/report/partner_balance.rml +++ b/addons/account/report/partner_balance.rml @@ -57,33 +57,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -344,4 +321,4 @@ - \ No newline at end of file + diff --git a/addons/account/wizard/wizard_third_party_ledger.py b/addons/account/wizard/wizard_third_party_ledger.py index be83d6d615f..5693b54da77 100755 --- a/addons/account/wizard/wizard_third_party_ledger.py +++ b/addons/account/wizard/wizard_third_party_ledger.py @@ -106,7 +106,7 @@ class wizard_report(wizard.interface): return data['form'] def _check(self, cr, uid, data, context): - if data['form']['page_split']==True: + if data['form']['page_split']: return 'report' else: return 'report_other' From ccfec2c1c838fe70272ce5f2057c8355b0c8b8d3 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 29 May 2009 17:18:46 +0530 Subject: [PATCH 13/17] Reverted general ledger changes bzr revid: jvo@tinyerp.com-20090529114846-u286bym234c88yxa --- addons/account/report/general_ledger.py | 192 ++++++++++++------ addons/account/report/general_ledger.rml | 6 +- .../report/general_ledger_landscape.py | 109 +++++++--- .../report/general_ledger_landscape.rml | 11 +- .../wizard/wizard_general_ledger_report.py | 2 +- 5 files changed, 226 insertions(+), 94 deletions(-) diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index 43e63dd592f..f9c2f30c0e1 100644 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -110,8 +110,96 @@ class general_ledger(rml_parse.rml_parse): result[account_line.id] = concat + '...' break rup_id+=1 + + #print str(result) return result + def get_children_accounts(self, account, form): + self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, + [('parent_id', 'child_of', self.ids)]) + res = [] + ctx = self.context.copy() + ## We will make the test for period or date + ## We will now make the test + # + if form.has_key('fiscalyear'): + ctx['fiscalyear'] = form['fiscalyear'] + ctx['periods'] = form['periods'][0][2] + else: + ctx['date_from'] = form['date_from'] + ctx['date_to'] = form['date_to'] + # + # + self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) + if account and account.child_consol_ids: # add ids of consolidated childs also of selected account + ctx['consolidate_childs'] = True + ctx['account_id'] = account.id + ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])],context=ctx) + + for child_id in ids_acc: + child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) + + sold_account = self._sum_solde_account(child_account,form) + + self.sold_accounts[child_account.id] = sold_account + + if form['display_account'] == 'bal_mouvement': + if child_account.type != 'view' \ + and len(self.pool.get('account.move.line').search(self.cr, self.uid, + [('account_id','=',child_account.id)], + context=ctx)) <> 0 : + res.append(child_account) + #print "Type de vue :" + form['display_account'] + elif form['display_account'] == 'bal_solde': + if child_account.type != 'view' \ + and len(self.pool.get('account.move.line').search(self.cr, self.uid, + [('account_id','=',child_account.id)], + context=ctx)) <> 0 : + if ( sold_account <> 0.0): + res.append(child_account) + else: + if child_account.type != 'view' \ + and len(self.pool.get('account.move.line').search(self.cr, self.uid, + [('account_id','>=',child_account.id)], + context=ctx)) <> 0 : + res.append(child_account) + + ## + + + ## We will now compute solde initiaux + + if not len(res): + return[account] + else: + for move in res: + + SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'" + self.cr.execute(SOLDEINIT) + resultat = self.cr.dictfetchall() + + if resultat[0] : + + if resultat[0]['sum_debit'] == None: + sum_debit = 0 + else: + + sum_debit = resultat[0]['sum_debit'] + if resultat[0]['sum_credit'] == None: + sum_credit = 0 + else: + sum_credit = resultat[0]['sum_credit'] + + move.init_credit = sum_credit + move.init_debit = sum_debit + + else: + move.init_credit = 0 + move.init_debit = 0 + + ## + return res + def get_min_date(self,form): ## Get max born from account_fiscal year @@ -168,7 +256,6 @@ class general_ledger(rml_parse.rml_parse): else : borne_max = date_max elif form['state'] == 'none': - sql = """ SELECT min(date) as start_date,max(date) as stop_date FROM account_move_line """ self.cr.execute(sql) @@ -183,54 +270,6 @@ class general_ledger(rml_parse.rml_parse): - - def get_children_accounts(self, acc_l, form): - self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, - [('parent_id', 'child_of', self.ids)]) - done_l = [] - res = [] - ctx = self.context.copy() - ## We will make the test for period or date - ## We will now make the test - # - if form.has_key('fiscalyear'): - ctx['fiscalyear'] = form['fiscalyear'] - ctx['periods'] = form['periods'][0][2] - else: - ctx['date_from'] = form['date_from'] - ctx['date_to'] = form['date_to'] - ## - - # - self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) - ids_acc = [] - for acc in acc_l: - if acc and acc.child_consol_ids: # add ids of consolidated childs also of selected account - ctx['consolidate_childs'] = True - ctx['account_id'] = acc.id - ids_acc += self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [acc.id])], context=ctx) - for child_id in ids_acc: - if child_id not in done_l: - done_l.append(child_id) - else: - continue - child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) - sold_account = self._sum_solde_account(child_account,form) - self.sold_accounts[child_account.id] = sold_account - accounts = self.pool.get('account.account').read(self.cr, self.uid, child_id,['debit','credit','balance']) - if form['display_account'] == 'bal_mouvement': - if accounts['credit'] > 0 or accounts['debit'] > 0 or accounts['balance'] > 0 : - #if child_account not in res: - res.append(child_account) - elif form['display_account'] == 'bal_solde': - if accounts['balance'] != 0: - if ( sold_account <> 0.0): - res.append(child_account) - - else: - res.append(child_account) - return res - def lines(self, account, form): inv_types = { 'out_invoice': 'CI: ', @@ -238,11 +277,13 @@ class general_ledger(rml_parse.rml_parse): 'out_refund': 'OR: ', 'in_refund': 'SR: ', } + ### We will now compute solde initaux if form['sortbydate'] == 'sort_date': sorttag = 'l.date' else: sorttag = 'j.code' + sql = """ SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name , l.debit, l.credit, l.period_id FROM account_move_line as l @@ -257,6 +298,7 @@ class general_ledger(rml_parse.rml_parse): self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date'],)) res = self.cr.dictfetchall() + sum = 0.0 account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') for l in res: @@ -271,10 +313,7 @@ class general_ledger(rml_parse.rml_parse): l['partner'] = line.partner_id.name else : l['partner'] = '' - - sum = l['debit'] - l ['credit'] - # c = time.strptime(l['date'],"%Y-%m-%d") # l['date'] = time.strftime("%d-%m-%Y",c) l['progress'] = sum @@ -287,21 +326,48 @@ class general_ledger(rml_parse.rml_parse): # if l['amount_currency'] != None: self.tot_currency = self.tot_currency + l['amount_currency'] - return res def _sum_debit_account(self, account, form): - accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['debit']) - return accounts['debit'] + + self.cr.execute("SELECT sum(debit) "\ + "FROM account_move_line l "\ + "WHERE l.account_id = %s AND %s "%(account.id, self.query)) + ## Add solde init to the result + # + sum_debit = self.cr.fetchone()[0] or 0.0 + if form['soldeinit']: + sum_debit += account.init_debit + # + ## + return sum_debit def _sum_credit_account(self, account, form): - accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['credit']) - return accounts['credit'] + + self.cr.execute("SELECT sum(credit) "\ + "FROM account_move_line l "\ + "WHERE l.account_id = %s AND %s "%(account.id,self.query)) + ## Add solde init to the result + # + sum_credit = self.cr.fetchone()[0] or 0.0 + if form['soldeinit']: + sum_credit += account.init_credit + # + ## + + return sum_credit def _sum_solde_account(self, account, form): - accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['balance']) - return accounts['balance'] - + self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\ + "FROM account_move_line l "\ + "WHERE l.account_id = %s AND %s"%(account.id,self.query)) + sum_solde = self.cr.fetchone()[0] or 0.0 + if form['soldeinit']: + sum_solde += account.init_debit - account.init_credit + + return sum_solde + + def _sum_debit(self, form): if not self.ids: return 0.0 @@ -311,6 +377,7 @@ class general_ledger(rml_parse.rml_parse): sum_debit = self.cr.fetchone()[0] or 0.0 return sum_debit + def _sum_credit(self, form): if not self.ids: return 0.0 @@ -328,6 +395,9 @@ class general_ledger(rml_parse.rml_parse): self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\ "FROM account_move_line l "\ "WHERE l.account_id in ("+','.join(map(str, self.child_ids))+") AND "+self.query) +# print ("SELECT (sum(debit) - sum(credit)) as Test "\ +# "FROM account_move_line l "\ +# "WHERE l.account_id in ("+','.join(map(str, child_ids))+") AND "+query+period_sql) sum_solde = self.cr.fetchone()[0] or 0.0 return sum_solde @@ -341,7 +411,9 @@ class general_ledger(rml_parse.rml_parse): else: self.account_currency = False + def _sum_currency_amount_account(self, account, form): + self._set_get_account_currency_code(account.id) 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() diff --git a/addons/account/report/general_ledger.rml b/addons/account/report/general_ledger.rml index 2c5bc28b4cb..ed2d3dae324 100644 --- a/addons/account/report/general_ledger.rml +++ b/addons/account/report/general_ledger.rml @@ -90,7 +90,7 @@ - + [[ repeatIn(objects, 'a') ]] [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] Date @@ -104,7 +104,7 @@
- [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] @@ -155,7 +155,7 @@
- [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index 65b7efafb3b..7c224a24dca 100644 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -54,8 +54,6 @@ class general_ledger_landscape(rml_parse.rml_parse): def __init__(self, cr, uid, name, context): super(general_ledger_landscape, self).__init__(cr, uid, name, context) self.date_borne = {} - self.sum_debit = 0.00 - self.sum_credit = 0.00 self.query = "" self.child_ids = "" self.tot_currency = 0.0 @@ -180,10 +178,11 @@ class general_ledger_landscape(rml_parse.rml_parse): - def get_children_accounts(self, acc_l, form): + def get_children_accounts(self, account, form): + self.child_ids = self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', self.ids)]) - done_l = [] +# res = [] ctx = self.context.copy() ## We will make the test for period or date @@ -199,32 +198,61 @@ class general_ledger_landscape(rml_parse.rml_parse): # self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) - ids_acc = [] - for acc in acc_l: - if acc and acc.child_consol_ids: # add ids of consolidated childs also of selected account - ctx['consolidate_childs'] = True - ctx['account_id'] = acc.id - ids_acc += self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [acc.id])], context=ctx) + if account and account.child_consol_ids: # add ids of consolidated childs also of selected account + ctx['consolidate_childs'] = True + ctx['account_id'] = account.id + ids_acc = self.pool.get('account.account').search(self.cr, self.uid,[('parent_id', 'child_of', [account.id])], context=ctx) for child_id in ids_acc: - if child_id not in done_l: - done_l.append(child_id) - else: - continue child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) sold_account = self._sum_solde_account(child_account,form) self.sold_accounts[child_account.id] = sold_account - accounts = self.pool.get('account.account').read(self.cr, self.uid, child_id,['debit','credit','balance']) if form['display_account'] == 'bal_mouvement': - if accounts['credit'] > 0 or accounts['debit'] > 0 or accounts['balance'] > 0 : - #if child_account not in res: + if child_account.type != 'view' \ + and len(self.pool.get('account.move.line').search(self.cr, self.uid, + [('account_id','=',child_account.id)], + context=ctx)) <> 0 : res.append(child_account) elif form['display_account'] == 'bal_solde': - if accounts['balance'] != 0: + if child_account.type != 'view' \ + and len(self.pool.get('account.move.line').search(self.cr, self.uid, + [('account_id','=',child_account.id)], + context=ctx)) <> 0 : if ( sold_account <> 0.0): res.append(child_account) - else: - res.append(child_account) + if child_account.type != 'view' \ + and len(self.pool.get('account.move.line').search(self.cr, self.uid, + [('account_id','>=',child_account.id)], + context=ctx)) <> 0 : + res.append(child_account) + ## + if not len(res): + + return [account] + else: + ## We will now compute solde initiaux + for move in res: + SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date < '" + self.borne_date['max_date'] + "'" + " AND l.date > '" + self.borne_date['min_date'] + "'" + self.cr.execute(SOLDEINIT) + resultat = self.cr.dictfetchall() + if resultat[0] : + if resultat[0]['sum_debit'] == None: + sum_debit = 0 + else: + sum_debit = resultat[0]['sum_debit'] + if resultat[0]['sum_credit'] == None: + sum_credit = 0 + else: + sum_credit = resultat[0]['sum_credit'] + + move.init_credit = sum_credit + move.init_debit = sum_debit + + else: + move.init_credit = 0 + move.init_debit = 0 + + return res def lines(self, account, form): @@ -287,17 +315,44 @@ class general_ledger_landscape(rml_parse.rml_parse): return res def _sum_debit_account(self, account, form): - accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['debit']) - return accounts['debit'] + + self.cr.execute("SELECT sum(debit) "\ + "FROM account_move_line l "\ + "WHERE l.account_id = %s AND %s "%(account.id, self.query)) + ## Add solde init to the result + # + sum_debit = self.cr.fetchone()[0] or 0.0 + if form['soldeinit']: + sum_debit += account.init_debit + # + ## + return sum_debit def _sum_credit_account(self, account, form): - accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['credit']) - return accounts['credit'] + + self.cr.execute("SELECT sum(credit) "\ + "FROM account_move_line l "\ + "WHERE l.account_id = %s AND %s "%(account.id,self.query)) + ## Add solde init to the result + # + sum_credit = self.cr.fetchone()[0] or 0.0 + if form['soldeinit']: + sum_credit += account.init_credit + # + ## + + return sum_credit def _sum_solde_account(self, account, form): - accounts = self.pool.get('account.account').read(self.cr, self.uid, account.id,['balance']) - return accounts['balance'] - + self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\ + "FROM account_move_line l "\ + "WHERE l.account_id = %s AND %s"%(account.id,self.query)) + sum_solde = self.cr.fetchone()[0] or 0.0 + if form['soldeinit']: + sum_solde += account.init_debit - account.init_credit + + return sum_solde + def _sum_debit(self, form): if not self.ids: return 0.0 diff --git a/addons/account/report/general_ledger_landscape.rml b/addons/account/report/general_ledger_landscape.rml index 3f71ee1f1e6..424c0e3a3f3 100644 --- a/addons/account/report/general_ledger_landscape.rml +++ b/addons/account/report/general_ledger_landscape.rml @@ -82,6 +82,9 @@ + + [[ repeatIn(objects, 'a') ]] + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] Date @@ -99,7 +102,9 @@
- [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] + + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] + [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]] @@ -159,7 +164,7 @@
- [[ repeatIn(get_children_accounts(objects,data['form']), 'o') ]] + [[ repeatIn(get_children_accounts(a,data['form']), 'o') ]] [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]] @@ -198,6 +203,6 @@ -
+
\ No newline at end of file diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index afd8a272a66..c03171f8e61 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -84,7 +84,7 @@ period_fields = { 'sortbydate':{'string':"Sort by:",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Movement')]}, 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}, 'landscape':{'string':"Landscape Mode",'type':'boolean'}, - # 'soldeinit':{'string':"Include initial balances",'type':'boolean'}, + 'soldeinit':{'string':"Include initial balances",'type':'boolean'}, 'amount_currency':{'string':"With Currency",'type':'boolean'}, 'date_from': {'string':" Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')}, 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, From 6072b3fa61fa479745574bb314359ba093dabd0c Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 30 May 2009 00:52:55 +0200 Subject: [PATCH 14/17] bugfix_improvement_planning_mrp bzr revid: fp@tinyerp.com-20090529225255-ipf3tu682mgtp3x0 --- addons/hr/hr.py | 78 ++++---- addons/mrp/mrp.py | 16 +- addons/mrp/mrp_view.xml | 2 +- addons/mrp_operations/mrp_operations.py | 189 ++++++++++++++---- addons/mrp_operations/mrp_operations_view.xml | 77 +++++-- 5 files changed, 271 insertions(+), 91 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 5489735db29..3fe64ea6bba 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -22,6 +22,7 @@ from mx import DateTime import time +import math from osv import fields, osv from tools.translate import _ @@ -34,50 +35,57 @@ class hr_timesheet_group(osv.osv): 'timesheet_id' : fields.one2many('hr.timesheet', 'tgroup_id', 'Working Time'), 'manager' : fields.many2one('res.users', 'Workgroup manager'), } - # - # TODO: improve; very slow ! - # bug if transition to another period - # + def interval_min_get(self, cr, uid, id, dt_from, hours): + if not id: + return [(dt_from-DateTime.RelativeDateTime(hours=int(hours)*3), dt_from)] + todo = hours + cycle = 0 + result = [] + maxrecur = 100 + current_hour = dt_from.hour + while (todo>0) and maxrecur: + cr.execute("select hour_from,hour_to from hr_timesheet where dayofweek='%s' and tgroup_id=%s order by hour_from desc", (dt_from.day_of_week,id)) + for (hour_from,hour_to) in cr.fetchall(): + if (hour_from0): + m = min(hour_to, current_hour) + if (m-hour_from)>todo: + hour_from = m-todo + d1 = DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_from)),int((hour_from%1) * 60)) + d2 = DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) + result.append((d1, d2)) + current_hour = hour_from + todo -= (m-hour_from) + dt_from -= DateTime.RelativeDateTime(days=1) + current_hour = 24 + maxrecur -= 1 + result.reverse() + return result + def interval_get(self, cr, uid, id, dt_from, hours, byday=True): if not id: return [(dt_from,dt_from+DateTime.RelativeDateTime(hours=int(hours)*3))] todo = hours cycle = 0 result = [] - while todo>0: + maxrecur = 100 + current_hour = dt_from.hour + while (todo>0) and maxrecur: cr.execute("select hour_from,hour_to from hr_timesheet where dayofweek='%s' and tgroup_id=%s order by hour_from", (dt_from.day_of_week,id)) for (hour_from,hour_to) in cr.fetchall(): - - import math - - hour_from = '%02d:%02d' % (math.floor(abs(hour_from)),round(abs(hour_from)%1+0.01,2) * 60) - hour_to = '%02d:%02d' % (math.floor(abs(hour_to)),round(abs(hour_to)%1+0.01,2) * 60) - - h1,m1 = map(int,hour_from.split(':')) - h2,m2 = map(int,hour_to.split(':')) - d1 = DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,h1,m1) - d2 = DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,h2,m2) - if dt_from7 and todo==hours: - return [(dt_from,dt_from+DateTime.RelativeDateTime(hours=hours*3))] - if byday: - i = 1 - while icurrent_hour) and (todo>0): + m = max(hour_from, current_hour) + if (hour_to-m)>todo: + hour_to = m+todo + d1 = DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) + d2 = DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) + result.append((d1, d2)) + current_hour = hour_to + todo -= (hour_to - m) + dt_from += DateTime.RelativeDateTime(days=1) + current_hour = 0 + maxrecur -= 1 return result + hr_timesheet_group() diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 726b7c0325f..b22d264f40c 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -380,6 +380,12 @@ class mrp_production(osv.osv): result[prod.id]['cycle_total'] += wc.cycle return result + def _production_date_end(self, cr, uid, ids, prop, unknow_none, context={}): + result = {} + for prod in self.browse(cr, uid, ids, context=context): + result[prod.id] = prod.date_planned + return result + def _production_date(self, cr, uid, ids, prop, unknow_none, context={}): result = {} for prod in self.browse(cr, uid, ids, context=context): @@ -408,7 +414,8 @@ class mrp_production(osv.osv): 'location_dest_id': fields.many2one('stock.location', 'Finished Products Location', required=True, help="Location where the system will stock the finished products."), - 'date_planned_date': fields.function(_production_date, method=True, type='date', string='Planned Date'), + 'date_planned_end': fields.function(_production_date_end, method=True, type='date', string='Scheduled End'), + 'date_planned_date': fields.function(_production_date, method=True, type='date', string='Scheduled Date'), 'date_planned': fields.datetime('Scheduled date', required=True, select=1), 'date_start': fields.datetime('Start Date'), 'date_finnished': fields.datetime('End Date'), @@ -456,7 +463,8 @@ class mrp_production(osv.osv): default.update({ 'name': self.pool.get('ir.sequence').get(cr, uid, 'mrp.production'), 'move_lines' : [], - 'move_created_ids': [] + 'move_created_ids': [], + 'state': 'draft' }) return super(mrp_production, self).copy(cr, uid, id, default, context) @@ -722,9 +730,9 @@ stock_move() class mrp_production_workcenter_line(osv.osv): _name = 'mrp.production.workcenter.line' - _description = 'Production workcenters used' + _description = 'Work Orders' _columns = { - 'name': fields.char('Name', size=64, required=True), + 'name': fields.char('Work Order', size=64, required=True), 'workcenter_id': fields.many2one('mrp.workcenter', 'Workcenter', required=True), 'cycle': fields.float('Nbr of cycle', digits=(16,2)), 'hour': fields.float('Nbr of hour', digits=(16,2)), diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index c2f8d94eaac..8a2509e9450 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -409,7 +409,7 @@ mrp.production gantt - + diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 94a265c6bfb..6a3ac22cbcd 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# dmr Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # # This program is free software: you can redistribute it and/or modify @@ -39,22 +39,44 @@ from tools.translate import _ # TODO: Work Center may be recursive ? # +class stock_move(osv.osv): + _inherit = 'stock.move' + _columns = { + 'move_dest_id_lines': fields.one2many('stock.move','move_dest_id', 'Children Moves') + } +stock_move() + class mrp_production_workcenter_line(osv.osv): + def _get_date_end(self, cr, uid, ids, field_name, arg, context): + res={} + for op in self.browse(cr, uid, ids, context=context): + d = DateTime.strptime(op.date_planned,'%Y-%m-%d %H:%M:%S') + i = self.pool.get('hr.timesheet.group').interval_get(cr, uid, op.workcenter_id.timesheet_id.id or False, d, op.hour or 0.0) + if i: + res[op.id] = i[-1][1].strftime('%Y-%m-%d %H:%M:%S') + else: + res[op.id] = op.date_planned + return res _inherit = 'mrp.production.workcenter.line' _columns = { 'state': fields.selection([('draft','Draft'),('startworking', 'In Progress'),('pause','Pause'),('cancel','Canceled'),('done','Finished')],'Status', readonly=True), - 'date_planned': fields.related('production_id', 'date_planned', type='datetime', string='Date Planned'), + 'date_planned': fields.datetime('Scheduled Date'), + 'date_planned_end': fields.function(_get_date_end, method=True, string='End Date', type='datetime'), 'date_start': fields.datetime('Start Date'), 'date_finnished': fields.datetime('End Date'), - 'delay': fields.char('Delay',size=128,help="This is delay between operation start and stop in this workcenter",readonly=True), - 'production_state':fields.related('production_id','state',type='char',string='Prod.State'), - 'product':fields.related('production_id','product_id',type='many2one',relation='product.product',string='Product'), - 'qty':fields.related('production_id','product_qty',type='float',string='Qty'), - 'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM'), + 'delay': fields.float('Working Hours',help="This is delay between operation start and stop in this workcenter",readonly=True), + 'production_state':fields.related('production_id','state', + type='selection', + selection=[('draft','Draft'),('picking_except', 'Packing Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Canceled'),('done','Done')], + string='Prod.State', readonly=True), + 'product':fields.related('production_id','product_id',type='many2one',relation='product.product',string='Product', + readonly=True), + 'qty':fields.related('production_id','product_qty',type='float',string='Qty',readonly=True), + 'uom':fields.related('production_id','product_uom',type='many2one',relation='product.uom',string='UOM',readonly=True), } _defaults = { 'state': lambda *a: 'draft', - 'delay': lambda *a: '0 Days 0 hrs and 0 mins' + 'delay': lambda *a: 0.0 } def modify_production_order_state(self,cr,uid,ids,action): @@ -82,17 +104,30 @@ class mrp_production_workcenter_line(osv.osv): wf_service.trg_validate(uid, 'mrp.production', oper_obj.production_id.id, 'button_produce_done', cr) return + def write(self, cr, uid, ids, vals, context={}, update=True): + result = super(mrp_production_workcenter_line, self).write(cr, uid, ids, vals, context=context) + if vals.get('date_planned', False) and update: + pids = {} + for prod in self.browse(cr, uid, ids, context=context): + if prod.production_id.date_start>vals['date_planned']: + pids[prod.production_id.id] = True + continue + if prod.production_id.date_finnishedold): + dt = dt_end + self.pool.get('mrp.production.workcenter.line').write(cr, uid, [wc.id], { + 'date_planned':dt.strftime('%Y-%m-%d %H:%M:%S') + }, context=context, update=False) + i = self.pool.get('hr.timesheet.group').interval_get( + cr, + uid, + wc.workcenter_id.timesheet_id and wc.workcenter_id.timesheet_id.id or False, + dt, + wc.hour or 0.0 + ) + old = wc.sequence + if i: + dt_end = max(dt_end, i[-1][1]) + super(mrp_production, self).write(cr, uid, [po.id], { + 'date_finnished': dt_end + }) + return dt_end + + def _move_pass(self, cr, uid, ids, context={}): + for po in self.browse(cr, uid, ids, context): + todo = po.move_lines + dt = DateTime.strptime(po.date_start,'%Y-%m-%d %H:%M:%S') + while todo: + l = todo.pop(0) + if l.state in ('done','cancel','draft'): + continue + todo += l.move_dest_id_lines + if l.production_id and (l.production_id.date_finnished>dt): + for wc in l.production_id.workcenter_lines: + i = self.pool.get('hr.timesheet.group').interval_min_get( + cr, + uid, + wc.workcenter_id.timesheet_id.id or False, + dt, wc.hour or 0.0 + ) + dt = i[0][0] + self.write(cr, uid, [l.production_id.id], {'date_start':dt.strftime('%Y-%m-%d %H:%M:%S')}) + continue + return True + + def _move_futur(self, cr, uid, ids, context={}): + for po in self.browse(cr, uid, ids, context): + for line in po.move_created_ids: + l = line + while l.move_dest_id: + l = l.move_dest_id + if l.state in ('done','cancel','draft'): + break + if l.production_id and (l.production_id.date_start=60: - m+=1 - s=0 - if m>=60: - h+=1 - m=0 - if h>=24: - days+=1 - h=0 - delay=str(days) +" Days "+ str(h) + " hrs and " + str(m)+ " mins" - return delay + a = datetime.datetime.strptime(time_lst[i-1],'%Y:%m:%d %H:%M:%S') + b = datetime.datetime.strptime(time_lst[i],'%Y:%m:%d %H:%M:%S') + diff += (b-a).days * 24 + diff += (b-a).seconds / (60*60) + return diff def check_operation(self,cr,uid,vals): code_ids=self.pool.get('mrp_operations.operation.code').search(cr,uid,[('id','=',vals['code_id'])]) @@ -300,8 +421,8 @@ class mrp_operations_operation(osv.osv): 'order_date': fields.function(_get_order_date,method=True,string='Order Date',type='date',store={'mrp.production':(_order_date_search_production,['date_planned'], 10)}), } _defaults={ - 'date_start': lambda *a:DateTime.now().strftime('%Y-%m-%d %H:%M:%S') - } + 'date_start': lambda *a:DateTime.now().strftime('%Y-%m-%d %H:%M:%S') + } mrp_operations_operation() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp_operations/mrp_operations_view.xml b/addons/mrp_operations/mrp_operations_view.xml index 6d0ac9bcee3..823d02b0cbb 100644 --- a/addons/mrp_operations/mrp_operations_view.xml +++ b/addons/mrp_operations/mrp_operations_view.xml @@ -10,6 +10,7 @@ + @@ -31,22 +32,52 @@
- - - - - - - - - -