From 6fa8f5e3ad8c6466ce07c1ab5e439b6df267de13 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 27 Sep 2010 17:54:52 +0200 Subject: [PATCH 01/51] [ADD] adding test file bzr revid: qdp-launchpad@tinyerp.com-20100927155452-1lm26dw35d5yqu7g --- addons/test.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 addons/test.txt diff --git a/addons/test.txt b/addons/test.txt new file mode 100644 index 00000000000..e69de29bb2d From 1e61d62f33df989b279b9e1453fdb253c63d5f64 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 27 Sep 2010 17:55:47 +0200 Subject: [PATCH 02/51] testing the buildbot engine bzr revid: qdp-launchpad@tinyerp.com-20100927155547-ec68n3nnb0010hk1 --- addons/test.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/test.txt b/addons/test.txt index e69de29bb2d..493021b1c9e 100644 --- a/addons/test.txt +++ b/addons/test.txt @@ -0,0 +1 @@ +this is a test file From 53a328b986598ed378cae439c26033ba331d4021 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 27 Sep 2010 17:56:07 +0200 Subject: [PATCH 03/51] testing the buildbot engine bzr revid: qdp-launchpad@tinyerp.com-20100927155607-v2q1apkb8yqocgz8 --- addons/test.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/test.txt b/addons/test.txt index 493021b1c9e..c4a0981cf7d 100644 --- a/addons/test.txt +++ b/addons/test.txt @@ -1 +1,4 @@ this is a test file + + +the purpose is to test the buidlbot engine From 25e74162e091bd98e3bb840fb6a8df4b4cde24ce Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 27 Sep 2010 17:56:31 +0200 Subject: [PATCH 04/51] testing the buildbot engine bzr revid: qdp-launchpad@tinyerp.com-20100927155631-07yq93k3n193yj85 --- addons/test.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/test.txt b/addons/test.txt index c4a0981cf7d..b7f66d31488 100644 --- a/addons/test.txt +++ b/addons/test.txt @@ -1,4 +1,5 @@ -this is a test file - +this is a test file: the purpose is to test the buidlbot engine + +how to do? From 6a851d7b865762a5ed636195ffdf01d5b90118a5 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Mon, 27 Sep 2010 17:57:23 +0200 Subject: [PATCH 05/51] testing the buildbot engine bzr revid: qdp-launchpad@tinyerp.com-20100927155723-vrh5jeawwx9x12qi --- addons/test.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/test.txt b/addons/test.txt index b7f66d31488..619a10f6ffc 100644 --- a/addons/test.txt +++ b/addons/test.txt @@ -1,5 +1,6 @@ this is a test file: - +------------------- the purpose is to test the buidlbot engine how to do? +we simply gonna make several commit in a local branch, and also several commits in the main branch, then merge and see what happens From 02c132144ee3691a2f4ba151ebdc0e2dd1559cef Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 29 Sep 2010 10:36:15 +0530 Subject: [PATCH 06/51] [IMP] account_voucher: Rename files bzr revid: psi@tinyerp.co.in-20100929050615-ydfx82fccrw7n8n1 --- addons/account_voucher/__init__.py | 2 +- addons/account_voucher/__openerp__.py | 12 ++++++------ .../{voucher.py => account_voucher.py} | 0 ...ucher_report.xml => account_voucher_report.xml} | 6 +++--- ...r_sequence.xml => account_voucher_sequence.xml} | 0 .../{voucher_view.xml => account_voucher_view.xml} | 0 ...ucher_wizard.xml => account_voucher_wizard.xml} | 0 ...r_workflow.xml => account_voucher_workflow.xml} | 0 addons/account_voucher/report/__init__.py | 8 ++++---- .../{report_voucher.py => account_voucher.py} | 2 +- .../{report_voucher.rml => account_voucher.rml} | 0 ...t_voucher_print.py => account_voucher_print.py} | 14 +++++++------- ...voucher_print.rml => account_voucher_print.rml} | 0 13 files changed, 22 insertions(+), 22 deletions(-) rename addons/account_voucher/{voucher.py => account_voucher.py} (100%) rename addons/account_voucher/{voucher_report.xml => account_voucher_report.xml} (80%) rename addons/account_voucher/{voucher_sequence.xml => account_voucher_sequence.xml} (100%) rename addons/account_voucher/{voucher_view.xml => account_voucher_view.xml} (100%) rename addons/account_voucher/{voucher_wizard.xml => account_voucher_wizard.xml} (100%) rename addons/account_voucher/{voucher_workflow.xml => account_voucher_workflow.xml} (100%) rename addons/account_voucher/report/{report_voucher.py => account_voucher.py} (97%) rename addons/account_voucher/report/{report_voucher.rml => account_voucher.rml} (100%) rename addons/account_voucher/report/{report_voucher_print.py => account_voucher_print.py} (97%) rename addons/account_voucher/report/{report_voucher_print.rml => account_voucher_print.rml} (100%) diff --git a/addons/account_voucher/__init__.py b/addons/account_voucher/__init__.py index 27aee55f2d7..41f33976c53 100644 --- a/addons/account_voucher/__init__.py +++ b/addons/account_voucher/__init__.py @@ -19,7 +19,7 @@ # ############################################################################## -import voucher +import account_voucher import report import wizard diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index 3a846791c23..59495eddc5f 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -38,22 +38,22 @@ "update_xml" : [ "security/ir.model.access.csv", - "voucher_sequence.xml", - "voucher_workflow.xml", - "voucher_report.xml", + "account_voucher_sequence.xml", + "account_voucher_workflow.xml", + "account_voucher_report.xml", "wizard/account_voucher_unreconcile_view.xml", "wizard/account_statement_from_invoice_view.xml", - "voucher_view.xml", + "account_voucher_view.xml", "voucher_payment_receipt_view.xml", "voucher_sales_purchase_view.xml", - "voucher_wizard.xml", + "account_voucher_wizard.xml", "security/account_voucher_security.xml" ], "test" : [ # "test/account_voucher.yml", "test/sales_receipt.yml", "test/sales_payment.yml", - "test/account_voucher_report.yml" + "test/account_voucher_report.yml" ], 'certificate': '0037580727101', "active": False, diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/account_voucher.py similarity index 100% rename from addons/account_voucher/voucher.py rename to addons/account_voucher/account_voucher.py diff --git a/addons/account_voucher/voucher_report.xml b/addons/account_voucher/account_voucher_report.xml similarity index 80% rename from addons/account_voucher/voucher_report.xml rename to addons/account_voucher/account_voucher_report.xml index 04bcb5254ba..db1b4279620 100644 --- a/addons/account_voucher/voucher_report.xml +++ b/addons/account_voucher/account_voucher_report.xml @@ -5,17 +5,17 @@ string="Voucher" model="account.voucher" name="voucher.cash_receipt.drcr" - rml="account_voucher/report/report_voucher.rml" + rml="account_voucher/report/account_voucher.rml" groups="base.group_extended" auto="False" header = "False" menu="True"/> - + diff --git a/addons/account_voucher/voucher_sequence.xml b/addons/account_voucher/account_voucher_sequence.xml similarity index 100% rename from addons/account_voucher/voucher_sequence.xml rename to addons/account_voucher/account_voucher_sequence.xml diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/account_voucher_view.xml similarity index 100% rename from addons/account_voucher/voucher_view.xml rename to addons/account_voucher/account_voucher_view.xml diff --git a/addons/account_voucher/voucher_wizard.xml b/addons/account_voucher/account_voucher_wizard.xml similarity index 100% rename from addons/account_voucher/voucher_wizard.xml rename to addons/account_voucher/account_voucher_wizard.xml diff --git a/addons/account_voucher/voucher_workflow.xml b/addons/account_voucher/account_voucher_workflow.xml similarity index 100% rename from addons/account_voucher/voucher_workflow.xml rename to addons/account_voucher/account_voucher_workflow.xml diff --git a/addons/account_voucher/report/__init__.py b/addons/account_voucher/report/__init__.py index eb69b63d856..b451c21b6a0 100644 --- a/addons/account_voucher/report/__init__.py +++ b/addons/account_voucher/report/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,9 +15,9 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## -import report_voucher -import report_voucher_print +import account_voucher +import account_voucher_print diff --git a/addons/account_voucher/report/report_voucher.py b/addons/account_voucher/report/account_voucher.py similarity index 97% rename from addons/account_voucher/report/report_voucher.py rename to addons/account_voucher/report/account_voucher.py index d83c319d1ba..7655f294bf9 100644 --- a/addons/account_voucher/report/report_voucher.py +++ b/addons/account_voucher/report/account_voucher.py @@ -67,6 +67,6 @@ class report_voucher(report_sxw.rml_parse): report_sxw.report_sxw( 'report.voucher.cash_receipt.drcr', 'account.voucher', - 'addons/account_voucher/report/report_voucher.rml', + 'addons/account_voucher/report/account_voucher.rml', parser=report_voucher,header="external" ) diff --git a/addons/account_voucher/report/report_voucher.rml b/addons/account_voucher/report/account_voucher.rml similarity index 100% rename from addons/account_voucher/report/report_voucher.rml rename to addons/account_voucher/report/account_voucher.rml diff --git a/addons/account_voucher/report/report_voucher_print.py b/addons/account_voucher/report/account_voucher_print.py similarity index 97% rename from addons/account_voucher/report/report_voucher_print.py rename to addons/account_voucher/report/account_voucher_print.py index 6f405bbe975..0da644c6e4f 100644 --- a/addons/account_voucher/report/report_voucher_print.py +++ b/addons/account_voucher/report/account_voucher_print.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -37,7 +37,7 @@ class report_voucher_print(report_sxw.rml_parse): def convert(self, amount, cur): amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur); return amt_en - + def get_lines(self,voucher): result = [] if voucher.type in ('payment','receipt'): @@ -67,13 +67,13 @@ class report_voucher_print(report_sxw.rml_parse): res['amount'] = amount result.append(res) return result - + def get_title(self, type): title = '' if type: title = type[0].swapcase() + type[1:] + " Voucher" return title - + def get_on_account(self, voucher): name = "" if voucher.type == 'receipt': @@ -85,10 +85,10 @@ class report_voucher_print(report_sxw.rml_parse): elif voucher.type == 'purchase': name = "Purchase from "+str(voucher.partner_id.name) return name - + report_sxw.report_sxw( 'report.voucher.print', 'account.voucher', - 'addons/account_voucher/report/report_voucher_print.rml', + 'addons/account_voucher/report/account_voucher_print.rml', parser=report_voucher_print,header="external" ) diff --git a/addons/account_voucher/report/report_voucher_print.rml b/addons/account_voucher/report/account_voucher_print.rml similarity index 100% rename from addons/account_voucher/report/report_voucher_print.rml rename to addons/account_voucher/report/account_voucher_print.rml From 16260dfd842854928a02809e547b22eecb4718a4 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 10:43:36 +0530 Subject: [PATCH 07/51] [IMP] Account voucher: Bank statment line for view with payment and amount reconcile field bzr revid: mra@mra-laptop-20100929051336-z1eortc920sl928h --- .../account_voucher/account_voucher_view.xml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index d007d20acab..35c3543524b 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -193,9 +193,8 @@ - - - account.bank.statement.voucher.form.inherit + + account.bank.statement.voucher.tree.inherit account.bank.statement form @@ -207,5 +206,19 @@ + + account.bank.statement.voucher.form.inherit + account.bank.statement + form + + + + + + + + + + From 19899f3e4d45d2768592d97c48c4d781eaefdf10 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 10:59:52 +0530 Subject: [PATCH 08/51] [REF] bzr revid: mra@mra-laptop-20100929052952-v7czdq5dq6gfac03 --- addons/account_voucher/account_voucher.py | 115 +++++++++++----------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index f0a4db96910..191d3f80b2e 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -48,7 +48,7 @@ account_move_line() class account_voucher(osv.osv): def _get_type(self, cr, uid, ids, context={}): return context.get('type', False) - + def _get_period(self, cr, uid, context={}): if context.get('period_id', False): return context.get('period_id') @@ -61,7 +61,7 @@ class account_voucher(osv.osv): return context.get('journal_id') if not context.get('journal_id', False) and context.get('search_default_journal_id', False): return context.get('search_default_journal_id') - + ttype = context.get('type', 'bank') if ttype in ('payment', 'receipt'): ttype = 'bank' @@ -77,7 +77,7 @@ class account_voucher(osv.osv): if not res: return False journal_id = res[0] - + if not journal_id: return False journal = journal_pool.browse(cr, uid, journal_id) @@ -187,33 +187,33 @@ class account_voucher(osv.osv): 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c), 'tax_id': _get_tax, } - + def compute_tax(self, cr, uid, ids, context={}): tax_pool = self.pool.get('account.tax') partner_pool = self.pool.get('res.partner') position_pool = self.pool.get('account.fiscal.position') voucher_line_pool = self.pool.get('account.voucher.line') voucher_pool = self.pool.get('account.voucher') - + for voucher in voucher_pool.browse(cr, uid, ids, context): voucher_amount = 0.0 for line in voucher.line_ids: voucher_amount += line.untax_amount or line.amount line.amount = line.untax_amount or line.amount voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount}) - + if not voucher.tax_id: self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0}) continue - + tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)] partner = partner_pool.browse(cr, uid, voucher.partner_id.id) or False taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax) tax = tax_pool.browse(cr, uid, taxes) - + total = voucher_amount total_tax = 0.0 - + if not tax[0].price_include: for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]): total_tax += tax_line.get('amount') @@ -223,17 +223,17 @@ class account_voucher(osv.osv): for line in voucher.line_ids: line_total = 0.0 line_tax = 0.0 - + for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]): line_tax += tax_line.get('amount') line_total += tax_line.get('price_unit') total_tax += line_tax untax_amount = line.untax_amount or line.amount voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount}) - + self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax}) return True - + def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context={}): tax_pool = self.pool.get('account.tax') partner_pool = self.pool.get('res.partner') @@ -246,16 +246,16 @@ class account_voucher(osv.osv): voucher_total_tax = 0.0 voucher_total = 0.0 voucher_line_ids = [] - + total = 0.0 total_tax = 0.0 - + for line in line_ids: line_amount = 0.0 line_amount = line[2].get('amount') voucher_line_ids += [line[1]] voucher_total += line_amount - + total = voucher_total total_tax = 0.0 if tax_id: @@ -264,12 +264,12 @@ class account_voucher(osv.osv): partner = partner_pool.browse(cr, uid, partner_id) or False taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax) tax = tax_pool.browse(cr, uid, taxes) - + if not tax[0].price_include: for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]): total_tax += tax_line.get('amount') total += total_tax - + res.update({ 'amount':total or voucher_total, 'tax_amount':total_tax @@ -277,7 +277,7 @@ class account_voucher(osv.osv): return { 'value':res } - + def onchange_term_id(self, cr, uid, ids, term_id, amount): term_pool = self.pool.get('account.payment.term') terms = False @@ -291,24 +291,24 @@ class account_voucher(osv.osv): 'date_due':due_date }) return {'value':default} - + def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context={}): """price Returns a dict that contains new values and context - + @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context arguments, like lang, time zone - + @return: Returns a dict which contains new values, and context """ default = { 'value':{}, } - + if not partner_id or not journal_id: return default - + partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') @@ -328,32 +328,32 @@ class account_voucher(osv.osv): default['value']['account_id'] = account_id default['value']['type'] = ttype or tr_type - + vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context) default['value'].update(vals.get('value')) - + return default - + def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, context={}): """price Returns a dict that contains new values and context - + @param partner_id: latest value from user input for field partner_id @param args: other arguments @param context: context arguments, like lang, time zone - + @return: Returns a dict which contains new values, and context """ if not journal_id: return {} - + currency_pool = self.pool.get('res.currency') move_pool = self.pool.get('account.move') line_pool = self.pool.get('account.voucher.line') move_line_pool = self.pool.get('account.move.line') partner_pool = self.pool.get('res.partner') journal_pool = self.pool.get('account.journal') - + vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context) vals = vals.get('value') currency_id = vals.get('currency_id', currency_id) @@ -383,7 +383,7 @@ class account_voucher(osv.osv): default['value']['account_id'] = account_id if journal.type not in ('cash', 'bank'): return default - + total_credit = 0.0 total_debit = 0.0 account_type = 'receivable' @@ -396,18 +396,18 @@ class account_voucher(osv.osv): ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) ids.reverse() moves = move_line_pool.browse(cr, uid, ids) - + company_currency = journal.company_id.currency_id.id if company_currency != currency_id and ttype == 'payment': total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit) elif company_currency != currency_id and ttype == 'receipt': total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit) - + for line in moves: if line.credit and line.reconcile_partial_id and ttype == 'receipt': continue if line.debit and line.reconcile_partial_id and ttype == 'payment': - continue + continue total_credit += line.credit or 0.0 total_debit += line.debit or 0.0 @@ -416,7 +416,7 @@ class account_voucher(osv.osv): continue if line.debit and line.reconcile_partial_id and ttype == 'payment': continue - + orignal_amount = line.credit or line.debit or 0.0 rs = { 'name':line.move_id.name, @@ -442,11 +442,11 @@ class account_voucher(osv.osv): default['value']['line_cr_ids'].append(rs) else: default['value']['line_dr_ids'].append(rs) - + if ttype == 'payment' and len(default['value']['line_cr_ids']) > 0: default['value']['pre_line'] = 1 elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0: - default['value']['pre_line'] = 1 + default['value']['pre_line'] = 1 return default def onchange_date(self, cr, user, ids, date, context={}): @@ -475,7 +475,7 @@ class account_voucher(osv.osv): tax_id = False if account_id and account_id.tax_ids: tax_id = account_id.tax_ids[0].id - + vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context) vals['value'].update({'tax_id':tax_id}) currency_id = journal.company_id.currency_id.id @@ -499,7 +499,7 @@ class account_voucher(osv.osv): reconcile_pool = self.pool.get('account.move.reconcile') move_pool = self.pool.get('account.move') voucher_line_pool = self.pool.get('account.voucher.line') - + for voucher in self.browse(cr, uid, ids): recs = [] for line in voucher.move_ids: @@ -509,7 +509,7 @@ class account_voucher(osv.osv): recs += [line.reconcile_partial_id.id] reconcile_pool.unlink(cr, uid, recs) - + if voucher.move_id: move_pool.button_cancel(cr, uid, [voucher.move_id.id]) move_pool.unlink(cr, uid, [voucher.move_id.id]) @@ -547,7 +547,7 @@ class account_voucher(osv.osv): return {'value':res} def action_move_line_create(self, cr, uid, ids, context=None): - + def _get_payment_term_lines(term_id, amount): term_pool = self.pool.get('account.payment.term') if term_id and amount: @@ -564,7 +564,7 @@ class account_voucher(osv.osv): for inv in self.browse(cr, uid, ids): if inv.move_id: continue - if inv.number: + if inv.number: name = inv.number elif inv.journal_id.sequence_id: name = self.pool.get('ir.sequence').get_id(cr, uid, inv.journal_id.sequence_id.id) @@ -580,12 +580,12 @@ class account_voucher(osv.osv): 'period_id': inv.period_id and inv.period_id.id or False } move_id = move_pool.create(cr, uid, move) - + #create the first line manually company_currency = inv.journal_id.company_id.currency_id.id debit = 0.0 credit = 0.0 - # TODO: is there any other alternative then the voucher type ?? + # TODO: is there any other alternative then the voucher type ?? # -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt if inv.type in ('purchase', 'payment'): credit = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount) @@ -597,7 +597,7 @@ class account_voucher(osv.osv): if credit < 0: debit = -credit credit = 0.0 - + move_line = { 'name':inv.name or '/', 'debit':debit, @@ -627,7 +627,7 @@ class account_voucher(osv.osv): if not line.amount: continue amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount) - + move_line = { 'journal_id':inv.journal_id.id, 'period_id':inv.period_id.id, @@ -649,7 +649,7 @@ class account_voucher(osv.osv): line.type = 'cr' else: line.type = 'dr' - + if (line.type=='dr'): line_total += amount move_line['debit'] = amount @@ -716,7 +716,7 @@ class account_voucher_line(osv.osv): _name = 'account.voucher.line' _description = 'Voucher Lines' _order = "move_line_id" - + def _compute_balance(self, cr, uid, ids, name, args, context=None): currency_pool = self.pool.get('res.currency') rs_data = {} @@ -725,16 +725,16 @@ class account_voucher_line(osv.osv): company_currency = line.voucher_id.journal_id.company_id.currency_id.id voucher_currency = line.voucher_id.currency_id.id move_line = line.move_line_id or False - + if not move_line: res['amount_original'] = 0.0 res['amount_unreconciled'] = 0.0 - + elif move_line and move_line.credit > 0: res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit) else: res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.debit) - + if move_line: res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.amount_unreconciled) rs_data[line.id] = res @@ -767,7 +767,7 @@ class account_voucher_line(osv.osv): @param move_line_id: latest value from user input for field move_line_id @param args: other arguments @param context: context arguments, like lang, time zone - + @return: Returns a dict which contains new values, and context """ res = {} @@ -793,9 +793,9 @@ class account_voucher_line(osv.osv): def default_get(self, cr, user, fields_list, context=None): """ Returns default values for fields - @param fields_list: list of fields, for which default values are required to be read + @param fields_list: list of fields, for which default values are required to be read @param context: context arguments, like lang, time zone - + @return: Returns a dict that contains default values for fields """ journal_id = context.get('journal_id', False) @@ -835,12 +835,13 @@ class account_bank_statement(osv.osv): _inherit = 'account.bank.statement' def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None): + voucher_obj = self.pool.get('account.voucher') + wf_service = netsvc.LocalService("workflow") st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line_id, context=context) if st_line.voucher_id: - self.pool.get('account.voucher').write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context) - wf_service = netsvc.LocalService("workflow") + voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context) wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr) - return self.pool.get('account.move.line').write(cr, uid, [x.id for x in st_line.voucher_id.move_ids], {'statement_id': st_line.statement_id.id}, context=context) + return self.pool.get('account.move.line').write(cr, uid, [x.id for x in st_line.voucher_id.move_ids], {'statement_id': st_line.statement_id.id}, context=context) return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context) account_bank_statement() From 94351657af8e935d407b1ab174bae2a768c564f7 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 29 Sep 2010 11:49:47 +0530 Subject: [PATCH 09/51] [IMP] account_followup: Rename Files bzr revid: psi@tinyerp.co.in-20100929061947-2y0sy2fhlu7wndj1 --- addons/account_followup/account_followup_view.xml | 2 +- addons/account_followup/report/__init__.py | 2 +- .../{report_followup_print.py => account_followup_print.py} | 2 +- .../{report_followp_print.rml => account_followup_print.rml} | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename addons/account_followup/report/{report_followup_print.py => account_followup_print.py} (98%) rename addons/account_followup/report/{report_followp_print.rml => account_followup_print.rml} (100%) diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml index 93cfa1a58eb..bbc3a8400a4 100644 --- a/addons/account_followup/account_followup_view.xml +++ b/addons/account_followup/account_followup_view.xml @@ -87,7 +87,7 @@ - + account.move.line.partner.tree diff --git a/addons/account_followup/report/__init__.py b/addons/account_followup/report/__init__.py index 5d57773762a..f1b753b1e16 100644 --- a/addons/account_followup/report/__init__.py +++ b/addons/account_followup/report/__init__.py @@ -19,7 +19,7 @@ # ############################################################################## -import report_followup_print +import account_followup_print import account_followup_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_followup/report/report_followup_print.py b/addons/account_followup/report/account_followup_print.py similarity index 98% rename from addons/account_followup/report/report_followup_print.py rename to addons/account_followup/report/account_followup_print.py index 2359c31b502..4d1cd131619 100644 --- a/addons/account_followup/report/report_followup_print.py +++ b/addons/account_followup/report/account_followup_print.py @@ -92,7 +92,7 @@ class report_rappel(report_sxw.rml_parse): return text report_sxw.report_sxw('report.account_followup.followup.print', - 'res.partner', 'addons/account_followup/report/report_followp_print.rml', + 'res.partner', 'addons/account_followup/report/account_followup_print.rml', parser=report_rappel) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_followup/report/report_followp_print.rml b/addons/account_followup/report/account_followup_print.rml similarity index 100% rename from addons/account_followup/report/report_followp_print.rml rename to addons/account_followup/report/account_followup_print.rml From 72bf1b7909d22256b5b9768fdb6891ba84e64ebb Mon Sep 17 00:00:00 2001 From: "ARA(OpenERP)" <> Date: Wed, 29 Sep 2010 13:28:36 +0530 Subject: [PATCH 10/51] [IMP] Account voucher: Name get of voucher should return amount with two digits bzr revid: mra@mra-laptop-20100929075836-df6miqdr722w0gs9 --- addons/account_voucher/account_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 191d3f80b2e..4230ec539fd 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -109,7 +109,7 @@ class account_voucher(osv.osv): def name_get(self, cr, uid, ids, context=None): if not len(ids): return [] - return [(r['id'], (str(r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')] + return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')] def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): res = super(account_voucher,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) From 8386fa5580c1af8a5070e0fce854dac2280e8158 Mon Sep 17 00:00:00 2001 From: "VTH(OpenERP)" <> Date: Wed, 29 Sep 2010 13:33:34 +0530 Subject: [PATCH 11/51] [FIX] Account: Cash statement close cash box button got error bzr revid: mra@mra-laptop-20100929080334-bya8koews12nn3ho --- addons/account/account_bank_statement.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 647d80e61be..521c672f410 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -222,11 +222,11 @@ class account_bank_statement(osv.osv): account_move_line_obj = self.pool.get('account.move.line') account_analytic_line_obj = self.pool.get('account.analytic.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') - - st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context) + st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id.id, context) st = st_line.statement_id context.update({'date': st_line.date}) + move_id = account_move_obj.create(cr, uid, { 'journal_id': st.journal_id.id, 'period_id': st.period_id.id, From 58792fb6bec8fe3433d7d51f73adaf43bd6ea12c Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 13:53:32 +0530 Subject: [PATCH 12/51] [IMP] Account: Bank and cash statement search view separated (add domain on journal_id field of search view) bzr revid: mra@mra-laptop-20100929082332-4d0m83o35sivx8l1 --- addons/account/account_view.xml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index ee81636b63b..f2c95fbdf6c 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -433,7 +433,7 @@ - account.bank.statement.select + account.cash.statement.select account.bank.statement search @@ -444,7 +444,7 @@ - + @@ -489,7 +489,7 @@ - + @@ -600,6 +600,7 @@ tree,form,graph [('journal_id.type', '=', 'bank')] {'journal_type':'bank'} + @@ -620,6 +621,7 @@ form tree,form,graph [('journal_id.type', '=', 'bank')] + {'journal_type':'bank'} @@ -1506,6 +1508,7 @@ account.bank.statement form form,tree + From 1ebc0a6c073e4fce6879b5cfe42a0489554f74d0 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 14:19:19 +0530 Subject: [PATCH 13/51] [REM] Account: Cash statment remove button_Cancel method already available with bank statements bzr revid: mra@mra-laptop-20100929084919-jjhai4rqjuuldbx5 --- addons/account/account_bank_statement.py | 2 +- addons/account/account_cash_statement.py | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 521c672f410..ba930c7e01e 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -501,4 +501,4 @@ class account_bank_statement_line(osv.osv): account_bank_statement_line() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index aebff216c3b..ed987de7e37 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -247,7 +247,7 @@ class account_cash_statement(osv.osv): open_jrnl = self.search(cr, uid, sql) if open_jrnl: raise osv.except_osv('Error', _('You can not have two open register for the same journal')) - + if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash': open_close = self._get_cash_open_close_box_lines(cr, uid, context) vals.update({ @@ -370,16 +370,6 @@ class account_cash_statement(osv.osv): super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context) return self.write(cr, uid, ids, {'closing_date':time.strftime("%Y-%m-%d %H:%M:%S")}, context=context) - - def button_cancel(self, cr, uid, ids, context={}): - done = [] - for st in self.browse(cr, uid, ids, context): - ids = [] - for line in st.line_ids: - ids += [x.id for x in line.move_ids] - self.pool.get('account.move').unlink(cr, uid, ids, context) - done.append(st.id) - self.write(cr, uid, done, {'state':'draft'}, context=context) - return True - account_cash_statement() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 3750db76b595c7d880580965769a0fe56a91923e Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 15:11:19 +0530 Subject: [PATCH 14/51] [FIX] Account voucher: Amount reconciled field on bank statement line (Voucher amount already converted to currecny amount if its multicurrency) bzr revid: mra@mra-laptop-20100929094119-g6agj50f6ghhos8w --- addons/account_voucher/account_voucher.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 4230ec539fd..fc46d7ec39e 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -852,17 +852,18 @@ class account_bank_statement_line(osv.osv): def _amount_reconciled(self, cursor, user, ids, name, args, context=None): if not ids: return {} + res_currency_obj = self.pool.get('res.currency') res = {} company_currency_id = False - for line in self.browse(cursor, user, ids, context=context): - if not company_currency_id: - company_currency_id = line.company_id.id +# if not company_currency_id: +# company_currency_id = line.company_id.id if line.voucher_id: - res[line.id] = res_currency_obj.compute(cursor, user, - company_currency_id, line.statement_id.currency.id, - line.voucher_id.amount, context=context) + res[line.id] = line.voucher_id.amount# +# res_currency_obj.compute(cursor, user, +# company_currency_id, line.statement_id.currency.id, +# line.voucher_id.amount, context=context) else: res[line.id] = 0.0 return res From c4cc8c3bba3b2ef808dcdab3fa65f84c0ad2a4f7 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 16:55:46 +0530 Subject: [PATCH 15/51] [FIX] Account voucher: Voucher lines got wrong value when using invoice with payment terms bzr revid: mra@mra-laptop-20100929112546-7wubehkdze6u88mi --- addons/account_voucher/account_voucher.py | 6 +++++- .../wizard/account_statement_from_invoice.py | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index fc46d7ec39e..d5d15a6e6fa 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -393,7 +393,11 @@ class account_voucher(osv.osv): else: total_credit = price or 0.0 account_type = 'receivable' - ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) + + if not context.get('move_line_ids', False): + ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context) + else: + ids = context['move_line_ids'] ids.reverse() moves = move_line_pool.browse(cr, uid, ids) diff --git a/addons/account_voucher/wizard/account_statement_from_invoice.py b/addons/account_voucher/wizard/account_statement_from_invoice.py index eb88ae5222c..926647afae1 100644 --- a/addons/account_voucher/wizard/account_statement_from_invoice.py +++ b/addons/account_voucher/wizard/account_statement_from_invoice.py @@ -71,9 +71,9 @@ class account_statement_from_invoice_lines(osv.osv_memory): elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id): amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id, statement.currency.id, amount, context=ctx) - + voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt') , - 'name': line.name, + 'name': line.name, 'partner_id': line.partner_id.id, 'journal_id': statement.journal_id.id, 'account_id': line.account_id.id, @@ -83,7 +83,8 @@ class account_statement_from_invoice_lines(osv.osv_memory): 'amount':abs(amount), 'period_id':statement.period_id.id} voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt')) + context.update({'move_line_ids': [line.id]}) + result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context) voucher_line_dict = False if result['value']['line_ids']: for line_dict in result['value']['line_ids']: From 5bdccf5b03565021d43453b63155bdbb526a7f2f Mon Sep 17 00:00:00 2001 From: mtr Date: Wed, 29 Sep 2010 17:03:49 +0530 Subject: [PATCH 16/51] [IMP] sale:-added date_confirm field in the copy function of sale order bzr revid: mtr@mtr-20100929113349-dle521fk9y4g93b7 --- addons/sale/sale.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index b6606a61215..7c29671bf2e 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -21,12 +21,12 @@ from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta +import time + from osv import fields, osv from tools.translate import _ import decimal_precision as dp import netsvc -import time - class sale_shop(osv.osv): _name = "sale.shop" @@ -62,6 +62,7 @@ class sale_order(osv.osv): 'shipped': False, 'invoice_ids': [], 'picking_ids': [], + 'date_confirm':False, 'name': self.pool.get('ir.sequence').get(cr, uid, 'sale.order'), }) return super(sale_order, self).copy(cr, uid, id, default, context=context) From 33d62323f1b4cbc0ab99f9176c3a83157e97aa8d Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 29 Sep 2010 18:21:08 +0530 Subject: [PATCH 17/51] [IMP] account_budget: Code cleaning [FIX] account_payment, account_coda, l10n_ch: lines got wrong value when using invoice with payment terms bzr revid: psi@tinyerp.co.in-20100929125108-pyb29e9hujuk03rw --- addons/account_budget/__openerp__.py | 5 +- addons/account_budget/crossovered_budget.py | 91 ++++---- .../report/analytic_account_budget_report.py | 155 ++++++------- addons/account_budget/report/budget_report.py | 10 +- .../report/crossovered_budget_report.py | 215 ++++++++---------- .../wizard/account_budget_analytic.py | 8 +- .../account_budget_crossovered_report.py | 9 +- ...count_budget_crossovered_summary_report.py | 11 +- .../wizard/account_budget_report.py | 9 +- .../wizard/account_budget_spread.py | 2 +- .../wizard/account_coda_import.py | 10 +- .../account_payment_populate_statement.py | 3 +- addons/l10n_ch/wizard/bvr_import.py | 3 +- 13 files changed, 251 insertions(+), 280 deletions(-) diff --git a/addons/account_budget/__openerp__.py b/addons/account_budget/__openerp__.py index 4fd24da70e9..b023e7e1124 100644 --- a/addons/account_budget/__openerp__.py +++ b/addons/account_budget/__openerp__.py @@ -26,9 +26,8 @@ 'category': 'Generic Modules/Accounting', 'description': """This module allows accountants to manage analytic and crossovered budgets. -Once the Master Budgets and the Budgets are defined (in Financial -Management/Budgets/), the Project Managers can set the planned amount on each -Analytic Account. +Once the Master Budgets and the Budgets are defined (in Accounting/Budgets/), +the Project Managers can set the planned amount on each Analytic Account. The accountant has the possibility to see the total of amount planned for each Budget and Master Budget in order to ensure the total planned is not diff --git a/addons/account_budget/crossovered_budget.py b/addons/account_budget/crossovered_budget.py index 6c7eb6639ec..af67b669d34 100644 --- a/addons/account_budget/crossovered_budget.py +++ b/addons/account_budget/crossovered_budget.py @@ -49,12 +49,13 @@ class account_budget_post(osv.osv): def spread(self, cr, uid, ids, fiscalyear_id=False, amount=0.0): dobj = self.pool.get('account.budget.post.dotation') + obj_fiscalyear = self.pool.get('account.fiscalyear') for o in self.browse(cr, uid, ids): # delete dotations for this post dobj.unlink(cr, uid, dobj.search(cr, uid, [('post_id','=',o.id)])) # create one dotation per period in the fiscal year, and spread the total amount/quantity over those dotations - fy = self.pool.get('account.fiscalyear').browse(cr, uid, [fiscalyear_id])[0] + fy = obj_fiscalyear.browse(cr, uid, [fiscalyear_id])[0] num = len(fy.period_ids) for p in fy.period_ids: dobj.create(cr, uid, {'post_id': o.id, 'period_id': p.id, 'amount': amount/num}) @@ -64,26 +65,27 @@ account_budget_post() class account_budget_post_dotation(osv.osv): def _tot_planned(self, cr, uid, ids, name, args, context): + obj_budget_lines = self.pool.get('crossovered.budget.lines') res = {} for line in self.browse(cr, uid, ids): if line.period_id: - obj_period=self.pool.get('account.period').browse(cr, uid, line.period_id.id) + obj_period = self.pool.get('account.period').browse(cr, uid, line.period_id.id) - total_days=strToDate(obj_period.date_stop) - strToDate(obj_period.date_start) - budget_id=line.post_id and line.post_id.id or False - query="select id from crossovered_budget_lines where \ - general_budget_id= %s AND (date_from >=%s and date_from <= %s ) \ - OR (date_to >=%s and date_to <= %s) OR (date_from < %s and date_to > %s)" - cr.execute(query,(budget_id,obj_period.date_start,obj_period.date_stop,obj_period.date_start,obj_period.date_stop,obj_period.date_start,obj_period.date_stop,)) - res1=cr.fetchall() - tot_planned=0.00 + total_days = strToDate(obj_period.date_stop) - strToDate(obj_period.date_start) + budget_id = line.post_id and line.post_id.id or False + query="SELECT id FROM crossovered_budget_lines WHERE \ + general_budget_id= %s AND (date_from >=%s AND date_from <= %s ) \ + OR (date_to >=%s AND date_to <= %s) OR (date_from < %s AND date_to > %s)" + cr.execute(query, (budget_id, obj_period.date_start, obj_period.date_stop, obj_period.date_start, obj_period.date_stop, obj_period.date_start, obj_period.date_stop,)) + res1 = cr.fetchall() + tot_planned = 0.00 for record in res1: - obj_lines = self.pool.get('crossovered.budget.lines').browse(cr, uid, record[0]) - count_days = min(strToDate(obj_period.date_stop),strToDate(obj_lines.date_to)) - max(strToDate(obj_period.date_start), strToDate(obj_lines.date_from)) - days_in_period = count_days.days +1 + obj_lines = obj_budget_lines.browse(cr, uid, record[0]) + count_days = min(strToDate(obj_period.date_stop), strToDate(obj_lines.date_to)) - max(strToDate(obj_period.date_start), strToDate(obj_lines.date_from)) + days_in_period = count_days.days + 1 count_days = strToDate(obj_lines.date_to) - strToDate(obj_lines.date_from) - total_days_of_rec = count_days.days +1 - tot_planned += obj_lines.planned_amount/total_days_of_rec* days_in_period + total_days_of_rec = count_days.days + 1 + tot_planned += obj_lines.planned_amount / total_days_of_rec * days_in_period res[line.id] = tot_planned else: res[line.id] = 0.00 @@ -96,7 +98,7 @@ class account_budget_post_dotation(osv.osv): 'post_id': fields.many2one('account.budget.post', 'Item', select=True), 'period_id': fields.many2one('account.period', 'Period'), 'amount': fields.float('Amount', digits=(16,2)), - 'tot_planned':fields.function(_tot_planned, method=True, string='Total Planned Amount', type='float', store=True), + 'tot_planned': fields.function(_tot_planned, method=True, string='Total Planned Amount', type='float', store=True), } account_budget_post_dotation() @@ -119,38 +121,38 @@ class crossovered_budget(osv.osv): _defaults = { 'state': 'draft', - 'creating_user_id': lambda self,cr,uid,context: uid, - 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c) + 'creating_user_id': lambda self, cr, uid, context: uid, + 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c) } def budget_confirm(self, cr, uid, ids, *args): self.write(cr, uid, ids, { - 'state':'confirm' + 'state': 'confirm' }) return True def budget_draft(self, cr, uid, ids, *args): self.write(cr, uid, ids, { - 'state':'draft' + 'state': 'draft' }) return True def budget_validate(self, cr, uid, ids, *args): self.write(cr, uid, ids, { - 'state':'validate', + 'state': 'validate', 'validating_user_id': uid, }) return True def budget_cancel(self, cr, uid, ids, *args): self.write(cr, uid, ids, { - 'state':'cancel' + 'state': 'cancel' }) return True def budget_done(self, cr, uid, ids, *args): self.write(cr, uid, ids, { - 'state':'done' + 'state': 'done' }) return True @@ -158,7 +160,7 @@ crossovered_budget() class crossovered_budget_lines(osv.osv): - def _prac_amt(self, cr, uid, ids,context={}): + def _prac_amt(self, cr, uid, ids, context={}): res = {} for line in self.browse(cr, uid, ids): acc_ids = [x.id for x in line.general_budget_id.account_ids] @@ -170,8 +172,8 @@ class crossovered_budget_lines(osv.osv): date_from = context['wizard_date_from'] if context.has_key('wizard_date_to'): date_to = context['wizard_date_to'] - cr.execute("select sum(amount) from account_analytic_line where account_id=%s and (date " - "between to_date(%s,'yyyy-mm-dd') and to_date(%s,'yyyy-mm-dd')) and " + cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE account_id=%s AND (date " + "between to_date(%s,'yyyy-mm-dd') AND to_date(%s,'yyyy-mm-dd')) AND " "general_account_id=ANY(%s)", (line.analytic_account_id.id, date_from, date_to,acc_ids,)) result = cr.fetchone()[0] if result is None: @@ -182,13 +184,13 @@ class crossovered_budget_lines(osv.osv): def _prac(self, cr, uid, ids, name, args, context): res={} for line in self.browse(cr, uid, ids): - res[line.id]=self._prac_amt(cr, uid, [line.id], context=context)[line.id] + res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id] return res - def _theo_amt(self, cr, uid, ids,context={}): + def _theo_amt(self, cr, uid, ids, context={}): res = {} for line in self.browse(cr, uid, ids): - today=datetime.datetime.today() + today = datetime.datetime.today() date_to = today.strftime("%Y-%m-%d") date_from = line.date_from if context.has_key('wizard_date_from'): @@ -197,38 +199,37 @@ class crossovered_budget_lines(osv.osv): date_to = context['wizard_date_to'] if line.paid_date: - if strToDate(line.date_to)<=strToDate(line.paid_date): - theo_amt=0.00 + if strToDate(line.date_to) <= strToDate(line.paid_date): + theo_amt = 0.00 else: - theo_amt=line.planned_amount + theo_amt = line.planned_amount else: - total=strToDate(line.date_to) - strToDate(line.date_from) + total = strToDate(line.date_to) - strToDate(line.date_from) elapsed = min(strToDate(line.date_to),strToDate(date_to)) - max(strToDate(line.date_from),strToDate(date_from)) if strToDate(date_to) < strToDate(line.date_from): elapsed = strToDate(date_to) - strToDate(date_to) if total.days: - theo_amt = float(elapsed.days/float(total.days))*line.planned_amount + theo_amt = float(elapsed.days / float(total.days)) * line.planned_amount else: theo_amt = line.planned_amount - res[line.id]=theo_amt + res[line.id] = theo_amt return res def _theo(self, cr, uid, ids, name, args, context): - res={} + res = {} for line in self.browse(cr, uid, ids): - res[line.id]=self._theo_amt(cr, uid, [line.id], context=context)[line.id] - + res[line.id] = self._theo_amt(cr, uid, [line.id], context=context)[line.id] return res def _perc(self, cr, uid, ids, name, args, context): res = {} for line in self.browse(cr, uid, ids): - if line.theoritical_amount<>0.00: - res[line.id]=float(line.practical_amount or 0.0 / line.theoritical_amount)*100 + if line.theoritical_amount <> 0.00: + res[line.id] = float(line.practical_amount or 0.0 / line.theoritical_amount) * 100 else: - res[line.id]=0.00 + res[line.id] = 0.00 return res _name = "crossovered.budget.lines" @@ -240,10 +241,10 @@ class crossovered_budget_lines(osv.osv): 'date_from': fields.date('Start Date', required=True), 'date_to': fields.date('End Date', required=True), 'paid_date': fields.date('Paid Date'), - 'planned_amount':fields.float('Planned Amount', required=True, digits=(16,2)), - 'practical_amount':fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)), - 'theoritical_amount':fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)), - 'percentage':fields.function(_perc, method=True, string='Percentage', type='float'), + 'planned_amount': fields.float('Planned Amount', required=True, digits=(16,2)), + 'practical_amount': fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)), + 'theoritical_amount': fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)), + 'percentage': fields.function(_perc, method=True, string='Percentage', type='float'), 'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True) } diff --git a/addons/account_budget/report/analytic_account_budget_report.py b/addons/account_budget/report/analytic_account_budget_report.py index c724968a06d..aa5d39f8d49 100644 --- a/addons/account_budget/report/analytic_account_budget_report.py +++ b/addons/account_budget/report/analytic_account_budget_report.py @@ -33,47 +33,43 @@ class analytic_account_budget_report(report_sxw.rml_parse): 'funct_total': self.funct_total, 'time': time, }) - self.context=context - - def funct(self,object,form,ids={}, done=None, level=1): + self.context = context + def funct(self, object, form, ids={}, done=None, level=1): if not ids: ids = self.ids if not done: - done={} + done = {} global tot - tot={ + tot = { 'theo':0.00, 'pln':0.00, 'prac':0.00, 'perc':0.00 } - result=[] + result = [] accounts = self.pool.get('account.analytic.account').browse(self.cr, self.uid, [object.id], self.context.copy()) + c_b_lines_obj = self.pool.get('crossovered.budget.lines') + obj_c_budget = self.pool.get('crossovered.budget') - c_b_lines_obj=self.pool.get('crossovered.budget.lines') for account_id in accounts: - res={} - b_line_ids=[] - + res = {} + b_line_ids = [] for line in account_id.crossovered_budget_line: b_line_ids.append(line.id) - if not b_line_ids: return [] + d_from = form['date_from'] + d_to = form['date_to'] - d_from=form['date_from'] - d_to=form['date_to'] + self.cr.execute('SELECT DISTINCT(crossovered_budget_id) FROM crossovered_budget_lines WHERE id =ANY(%s)',(b_line_ids,)) + budget_ids = self.cr.fetchall() - self.cr.execute('select distinct(crossovered_budget_id) from crossovered_budget_lines where id =ANY(%s)',(b_line_ids,)) - budget_ids=self.cr.fetchall() - - context={'wizard_date_from':d_from,'wizard_date_to':d_to} - for i in range(0,len(budget_ids)): - - budget_name=self.pool.get('crossovered.budget').browse(self.cr, self.uid,[budget_ids[i][0]]) - res={ + context = {'wizard_date_from':d_from,'wizard_date_to':d_to} + for i in range(0, len(budget_ids)): + budget_name = obj_c_budget.browse(self.cr, self.uid, [budget_ids[i][0]]) + res= { 'b_id':'-1', 'a_id':'-1', 'name':budget_name[0].name, @@ -85,48 +81,42 @@ class analytic_account_budget_report(report_sxw.rml_parse): } result.append(res) - line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids),('crossovered_budget_id','=',budget_ids[i][0])]) - line_id =c_b_lines_obj.browse(self.cr,self.uid,line_ids) - tot_theo=tot_pln=tot_prac=tot_perc=0 + line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids), ('crossovered_budget_id','=',budget_ids[i][0])]) + line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids) + tot_theo = tot_pln = tot_prac = tot_perc = 0 - done_budget=[] + done_budget = [] for line in line_id: - if line.id in b_line_ids: - theo=pract=0.00 - theo=c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id],context)[line.id] - pract=c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id],context)[line.id] - + theo = pract = 0.00 + theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id] + pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id] if line.general_budget_id.id in done_budget: - for record in result: - if record['b_id']==line.general_budget_id.id and record['a_id']==line.analytic_account_id.id: - - record['theo'] +=theo - record['pln'] +=line.planned_amount - record['prac'] +=pract - record['perc'] +=line.percentage - tot_theo +=theo - tot_pln +=line.planned_amount - tot_prac +=pract - tot_perc +=line.percentage + if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id: + record['theo'] += theo + record['pln'] += line.planned_amount + record['prac'] += pract + record['perc'] += line.percentage + tot_theo += theo + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += line.percentage else: - - res1={ - 'b_id':line.general_budget_id.id, - 'a_id':line.analytic_account_id.id, - 'name':line.general_budget_id.name, - 'status':2, - 'theo':theo, - 'pln':line.planned_amount, - 'prac':pract, - 'perc':line.percentage + res1 = { + 'b_id': line.general_budget_id.id, + 'a_id': line.analytic_account_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': theo, + 'pln': line.planned_amount, + 'prac': pract, + 'perc': line.percentage } - tot_theo += theo - tot_pln +=line.planned_amount - tot_prac +=pract - tot_perc +=line.percentage + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += line.percentage result.append(res1) done_budget.append(line.general_budget_id.id) else: @@ -134,50 +124,45 @@ class analytic_account_budget_report(report_sxw.rml_parse): continue else: res1={ - 'b_id':line.general_budget_id.id, - 'a_id':line.analytic_account_id.id, - 'name':line.general_budget_id.name, - 'status':2, - 'theo':0.00, - 'pln':0.00, - 'prac':0.00, - 'perc':0.00 + 'b_id': line.general_budget_id.id, + 'a_id': line.analytic_account_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 } - result.append(res1) done_budget.append(line.general_budget_id.id) - - if tot_theo==0.00: - tot_perc=0.00 + if tot_theo == 0.00: + tot_perc = 0.00 else: - tot_perc=float(tot_prac /tot_theo)*100 + tot_perc = float(tot_prac / tot_theo) * 100 - result[-(len(done_budget) +1)]['theo']=tot_theo + result[-(len(done_budget) +1)]['theo'] = tot_theo tot['theo'] +=tot_theo - result[-(len(done_budget) +1)]['pln']=tot_pln + result[-(len(done_budget) +1)]['pln'] = tot_pln tot['pln'] +=tot_pln - result[-(len(done_budget) +1)]['prac']=tot_prac + result[-(len(done_budget) +1)]['prac'] = tot_prac tot['prac'] +=tot_prac - result[-(len(done_budget) +1)]['perc']=tot_perc - - if tot['theo']==0.00: - tot['perc'] =0.00 + result[-(len(done_budget) +1)]['perc'] = tot_perc + if tot['theo'] == 0.00: + tot['perc'] = 0.00 else: - tot['perc']=float(tot['prac'] /tot['theo'])*100 - + tot['perc'] = float(tot['prac'] / tot['theo']) * 100 return result def funct_total(self,form): - result=[] - res={} - res={ - 'tot_theo':tot['theo'], - 'tot_pln':tot['pln'], - 'tot_prac':tot['prac'], - 'tot_perc':tot['perc'] + result = [] + res = {} + res = { + 'tot_theo': tot['theo'], + 'tot_pln': tot['pln'], + 'tot_prac': tot['prac'], + 'tot_perc': tot['perc'] } result.append(res) - return result report_sxw.report_sxw('report.account.analytic.account.budget', 'account.analytic.account', 'addons/account_budget/report/analytic_account_budget_report.rml',parser=analytic_account_budget_report,header='internal') diff --git a/addons/account_budget/report/budget_report.py b/addons/account_budget/report/budget_report.py index 171984e9851..7db3925fd4d 100644 --- a/addons/account_budget/report/budget_report.py +++ b/addons/account_budget/report/budget_report.py @@ -38,17 +38,19 @@ class budget_report(report_sxw.rml_parse): def post_total(self, post_obj, date1, date2): def str2date(date_str): return datetime.date.fromtimestamp(time.mktime(time.strptime(date_str, '%Y-%m-%d'))) + def interval(d1str, d2str): return (str2date(d2str) - str2date(d1str) + datetime.timedelta(days=1)).days + prev = reduce(lambda x,d: x + d.amount, post_obj.dotation_ids, 0.0) period_days = interval(date1, date2) for d in post_obj.dotation_ids: i = interval(d.period_id.date_start, d.period_id.date_stop) total_days = reduce(lambda x,d: x+interval(d.period_id.date_start, d.period_id.date_stop), post_obj.dotation_ids, 0) achievements = reduce(lambda x,l: x+l['achievements'], self.lines(post_obj, date1, date2), 0.0) - prev_1=1.00 - if total_days<>0.00: - prev_1=prev * period_days / total_days + prev_1 = 1.00 + if total_days <> 0.00: + prev_1 = prev * period_days / total_days return [{'prev': prev, 'prev_period': prev_1, 'achievements': achievements}] def budget_total(self, post_obj, date1, date2): @@ -66,7 +68,7 @@ class budget_report(report_sxw.rml_parse): res.append({'name': a.name, 'code': a.code, 'achievements': achievements}) return res -report_sxw.report_sxw('report.account.budget', 'account.budget.post', 'addons/account_budget/report/budget_report.rml',parser=budget_report, header="internal") +report_sxw.report_sxw('report.account.budget', 'account.budget.post', 'addons/account_budget/report/budget_report.rml', parser=budget_report, header="internal") # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_budget/report/crossovered_budget_report.py b/addons/account_budget/report/crossovered_budget_report.py index 464e0c1acf9..8a3b745e32a 100644 --- a/addons/account_budget/report/crossovered_budget_report.py +++ b/addons/account_budget/report/crossovered_budget_report.py @@ -20,48 +20,46 @@ ############################################################################## import time +import datetime + import pooler from report import report_sxw -import datetime import operator import osv class budget_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(budget_report, self).__init__(cr, uid, name, context=context) - self.localcontext.update( { + self.localcontext.update({ 'funct': self.funct, 'funct_total': self.funct_total, 'time': time, }) - self.context=context + self.context = context def funct(self, object, form, ids={}, done=None, level=1): - if not ids: ids = self.ids if not done: - done={} - + done = {} global tot - tot={ + tot = { 'theo':0.00, 'pln':0.00, 'prac':0.00, 'perc':0.00 } - result=[] + result = [] budgets = self.pool.get('crossovered.budget').browse(self.cr, self.uid, [object.id], self.context.copy()) - - c_b_lines_obj=self.pool.get('crossovered.budget.lines') + c_b_lines_obj = self.pool.get('crossovered.budget.lines') + acc_analytic_obj = self.pool.get('account.analytic.account') for budget_id in budgets: - - res={} - budget_lines=[] - budget_ids=[] - d_from=form['date_from'] - d_to=form['date_to'] + res = {} + budget_lines = [] + budget_ids = [] + d_from = form['date_from'] + d_to = form['date_to'] for line in budget_id.crossovered_budget_line: budget_ids.append(line.id) @@ -69,78 +67,69 @@ class budget_report(report_sxw.rml_parse): if not budget_ids: return [] - self.cr.execute('select distinct(analytic_account_id) from crossovered_budget_lines where id =ANY(%s)',(budget_ids,)) - an_ids=self.cr.fetchall() - - context={'wizard_date_from':d_from,'wizard_date_to':d_to} - for i in range(0,len(an_ids)): - - analytic_name=self.pool.get('account.analytic.account').browse(self.cr, self.uid, [an_ids[i][0]]) + self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,)) + an_ids = self.cr.fetchall() + context = {'wizard_date_from': d_from, 'wizard_date_to': d_to} + for i in range(0, len(an_ids)): + analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]]) res={ - 'b_id':'-1', - 'a_id':'-1', - 'name':analytic_name[0].name, - 'status':1, - 'theo':0.00, - 'pln':0.00, - 'prac':0.00, - 'perc':0.00 + 'b_id': '-1', + 'a_id': '-1', + 'name': analytic_name[0].name, + 'status': 1, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 } result.append(res) - line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids),('analytic_account_id','=',an_ids[i][0])]) - + line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])]) line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids) - tot_theo=tot_pln=tot_prac=tot_perc=0.00 + tot_theo = tot_pln = tot_prac = tot_perc = 0.00 - done_budget=[] + done_budget = [] for line in line_id: - if line.id in budget_ids: - theo=pract=0.00 - theo=c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id],context)[line.id] - pract=c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id],context)[line.id] - + theo = pract = 0.00 + theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id] + pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id] if line.general_budget_id.id in done_budget: - for record in result: - if record['b_id']==line.general_budget_id.id and record['a_id']==line.analytic_account_id.id: - - record['theo'] +=theo - record['pln'] +=line.planned_amount - record['prac'] +=pract - if record['theo']<>0.00: - perc=(record['prac']/record['theo'])*100 + if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id: + record['theo'] += theo + record['pln'] += line.planned_amount + record['prac'] += pract + if record['theo'] <> 0.00: + perc = (record['prac'] / record['theo']) * 100 else: - perc=0.00 - record['perc'] =perc + perc = 0.00 + record['perc'] = perc tot_theo += theo - tot_pln +=line.planned_amount - tot_prac +=pract - tot_perc +=perc - + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += perc else: - - if theo<>0.00: - perc=(pract/theo)*100 + if theo <> 0.00: + perc = (pract / theo) * 100 else: - perc=0.00 - res1={ - 'a_id':line.analytic_account_id.id, - 'b_id':line.general_budget_id.id, - 'name':line.general_budget_id.name, - 'status':2, - 'theo':theo, - 'pln':line.planned_amount, - 'prac':pract, - 'perc':perc, + perc = 0.00 + res1 = { + 'a_id': line.analytic_account_id.id, + 'b_id': line.general_budget_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': theo, + 'pln': line.planned_amount, + 'prac': pract, + 'perc': perc, } tot_theo += theo - tot_pln +=line.planned_amount - tot_prac +=pract - tot_perc +=perc - if form['report']=='analytic-full': + tot_pln += line.planned_amount + tot_prac += pract + tot_perc += perc + if form['report'] == 'analytic-full': result.append(res1) done_budget.append(line.general_budget_id.id) else: @@ -149,61 +138,57 @@ class budget_report(report_sxw.rml_parse): continue else: res1={ - 'a_id':line.analytic_account_id.id, - 'b_id':line.general_budget_id.id, - 'name':line.general_budget_id.name, - 'status':2, - 'theo':0.00, - 'pln':0.00, - 'prac':0.00, - 'perc':0.00 - } - - if form['report']=='analytic-full': + 'a_id': line.analytic_account_id.id, + 'b_id': line.general_budget_id.id, + 'name': line.general_budget_id.name, + 'status': 2, + 'theo': 0.00, + 'pln': 0.00, + 'prac': 0.00, + 'perc': 0.00 + } + if form['report'] == 'analytic-full': result.append(res1) done_budget.append(line.general_budget_id.id) - - if tot_theo==0.00: - tot_perc=0.00 + if tot_theo == 0.00: + tot_perc = 0.00 else: - tot_perc=float(tot_prac /tot_theo)*100 - - if form['report']=='analytic-full': - - result[-(len(done_budget) +1)]['theo']=tot_theo - tot['theo'] +=tot_theo - result[-(len(done_budget) +1)]['pln']=tot_pln - tot['pln'] +=tot_pln - result[-(len(done_budget) +1)]['prac']=tot_prac - tot['prac'] +=tot_prac - result[-(len(done_budget) +1)]['perc']=tot_perc + tot_perc = float(tot_prac / tot_theo) * 100 + if form['report'] == 'analytic-full': + result[-(len(done_budget) +1)]['theo'] = tot_theo + tot['theo'] += tot_theo + result[-(len(done_budget) +1)]['pln'] = tot_pln + tot['pln'] += tot_pln + result[-(len(done_budget) +1)]['prac'] = tot_prac + tot['prac'] += tot_prac + result[-(len(done_budget) +1)]['perc'] = tot_perc else: - result[-1]['theo']=tot_theo - tot['theo'] +=tot_theo - result[-1]['pln']=tot_pln - tot['pln'] +=tot_pln - result[-1]['prac']=tot_prac - tot['prac'] +=tot_prac - result[-1]['perc']=tot_perc - if tot['theo']==0.00: - tot['perc'] =0.00 + result[-1]['theo'] = tot_theo + tot['theo'] += tot_theo + result[-1]['pln'] = tot_pln + tot['pln'] += tot_pln + result[-1]['prac'] = tot_prac + tot['prac'] += tot_prac + result[-1]['perc'] = tot_perc + if tot['theo'] == 0.00: + tot['perc'] = 0.00 else: - tot['perc']=float(tot['prac'] /tot['theo'])*100 + tot['perc'] = float(tot['prac'] / tot['theo']) * 100 return result def funct_total(self, form): - result=[] - res={} - - res={ - 'tot_theo':tot['theo'], - 'tot_pln':tot['pln'], - 'tot_prac':tot['prac'], - 'tot_perc':tot['perc'] + result = [] + res = {} + res = { + 'tot_theo': tot['theo'], + 'tot_pln': tot['pln'], + 'tot_prac': tot['prac'], + 'tot_perc': tot['perc'] } result.append(res) - return result + report_sxw.report_sxw('report.crossovered.budget.report', 'crossovered.budget', 'addons/account_budget/report/crossovered_budget_report.rml',parser=budget_report,header='internal') + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_budget/wizard/account_budget_analytic.py b/addons/account_budget/wizard/account_budget_analytic.py index 70ce1a5156b..be3e8a45099 100644 --- a/addons/account_budget/wizard/account_budget_analytic.py +++ b/addons/account_budget/wizard/account_budget_analytic.py @@ -29,11 +29,11 @@ class account_budget_analytic(osv.osv_memory): _columns = { 'date_from': fields.date('Start of period', required=True), 'date_to': fields.date('End of period', required=True), - } + } _defaults= { 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d'), - } + } def check_report(self, cr, uid, ids, context=None): datas = {} @@ -44,12 +44,12 @@ class account_budget_analytic(osv.osv_memory): 'ids': context.get('active_ids',[]), 'model': 'account.analytic.account', 'form': data - } + } return { 'type': 'ir.actions.report.xml', 'report_name': 'account.analytic.account.budget', 'datas': datas, - } + } account_budget_analytic() diff --git a/addons/account_budget/wizard/account_budget_crossovered_report.py b/addons/account_budget/wizard/account_budget_crossovered_report.py index 2427044e681..e1207c5cba8 100644 --- a/addons/account_budget/wizard/account_budget_crossovered_report.py +++ b/addons/account_budget/wizard/account_budget_crossovered_report.py @@ -18,7 +18,6 @@ # along with this program. If not, see . # ############################################################################## - import time from osv import fields, osv @@ -30,11 +29,11 @@ class account_budget_crossvered_report(osv.osv_memory): _columns = { 'date_from': fields.date('Start of period', required=True), 'date_to': fields.date('End of period', required=True), - } + } _defaults= { 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d'), - } + } def check_report(self, cr, uid, ids, context=None): datas = {} @@ -45,13 +44,13 @@ class account_budget_crossvered_report(osv.osv_memory): 'ids': context.get('active_ids',[]), 'model': 'crossovered.budget', 'form': data - } + } datas['form']['report']='analytic-full' return { 'type': 'ir.actions.report.xml', 'report_name': 'crossovered.budget.report', 'datas': datas, - } + } account_budget_crossvered_report() diff --git a/addons/account_budget/wizard/account_budget_crossovered_summary_report.py b/addons/account_budget/wizard/account_budget_crossovered_summary_report.py index 9581546ca10..e0f955787e7 100644 --- a/addons/account_budget/wizard/account_budget_crossovered_summary_report.py +++ b/addons/account_budget/wizard/account_budget_crossovered_summary_report.py @@ -31,11 +31,11 @@ class account_budget_crossvered_summary_report(osv.osv_memory): _columns = { 'date_from': fields.date('Start of period', required=True), 'date_to': fields.date('End of period', required=True), - } + } _defaults= { 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d'), - } + } def check_report(self, cr, uid, ids, context=None): datas = {} @@ -46,14 +46,13 @@ class account_budget_crossvered_summary_report(osv.osv_memory): 'ids': context.get('active_ids',[]), 'model': 'crossovered.budge', 'form': data - } - datas['form']['report']='analytic-one' + } + datas['form']['report'] = 'analytic-one' return { 'type': 'ir.actions.report.xml', 'report_name': 'crossovered.budget.report', 'datas': datas, - } - return {} + } account_budget_crossvered_summary_report() diff --git a/addons/account_budget/wizard/account_budget_report.py b/addons/account_budget/wizard/account_budget_report.py index 58ba9ad8191..20432ff64e4 100644 --- a/addons/account_budget/wizard/account_budget_report.py +++ b/addons/account_budget/wizard/account_budget_report.py @@ -18,7 +18,6 @@ # along with this program. If not, see . # ############################################################################## - import time from osv import fields, osv @@ -31,11 +30,11 @@ class account_budget_report(osv.osv_memory): _columns = { 'date1': fields.date('Start of period', required=True), 'date2': fields.date('End of period', required=True), - } + } _defaults= { 'date1': time.strftime('%Y-01-01'), 'date2': time.strftime('%Y-%m-%d'), - } + } def check_report(self, cr, uid, ids, context=None): datas = {} @@ -46,7 +45,7 @@ class account_budget_report(osv.osv_memory): 'ids': context.get('active_ids',[]), 'model': 'account.budget.post', 'form': data - } + } data_model = self.pool.get(datas['model']).browse(cr, uid, context['active_id']) if not data_model.dotation_ids: @@ -55,7 +54,7 @@ class account_budget_report(osv.osv_memory): 'type': 'ir.actions.report.xml', 'report_name': 'account.budget', 'datas': datas, - } + } account_budget_report() diff --git a/addons/account_budget/wizard/account_budget_spread.py b/addons/account_budget/wizard/account_budget_spread.py index 31e059f754b..de854a3966c 100644 --- a/addons/account_budget/wizard/account_budget_spread.py +++ b/addons/account_budget/wizard/account_budget_spread.py @@ -29,7 +29,7 @@ class account_budget_spread(osv.osv_memory): _columns = { 'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True), 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')), - } + } def check_spread(self, cr, uid, ids, context=None): if context is None: diff --git a/addons/account_coda/wizard/account_coda_import.py b/addons/account_coda/wizard/account_coda_import.py index 8a88f4a255d..e68de12b038 100644 --- a/addons/account_coda/wizard/account_coda_import.py +++ b/addons/account_coda/wizard/account_coda_import.py @@ -224,24 +224,24 @@ class account_coda_import(osv.osv_memory): 'period_id':statement.get('period_id',False) or period,# statement.period_id.id } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt')) + context.update({'move_line_ids': [line['id']]}) + result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context) voucher_line_dict = False if result['value']['line_ids']: for line_dict in result['value']['line_ids']: move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context) if line.move_id.id == move_line.move_id.id: voucher_line_dict = line_dict - + if voucher_line_dict: voucher_line_dict.update({'voucher_id':voucher_id}) voucher_line_obj.create(cr, uid, voucher_line_dict, context=context) - + # reconcile_id = statement_reconcile_obj.create(cr, uid, { # 'line_ids': [(6, 0, rec_id)] # }, context=context) # - + mv = self.pool.get('account.move.line').browse(cr, uid, rec_id[0], context=context) if mv.partner_id: line['partner_id'] = mv.partner_id.id diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 0e7ea32e8d3..84911f512c4 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -91,7 +91,8 @@ class account_payment_populate_statement(osv.osv_memory): 'period_id': statement.period_id.id } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment') + context.update({'move_line_ids': [line.id]}) + result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context) voucher_line_dict = False if result['value']['line_ids']: for line_dict in result['value']['line_ids']: diff --git a/addons/l10n_ch/wizard/bvr_import.py b/addons/l10n_ch/wizard/bvr_import.py index 611b5720a96..ea3fe9fac38 100644 --- a/addons/l10n_ch/wizard/bvr_import.py +++ b/addons/l10n_ch/wizard/bvr_import.py @@ -214,7 +214,8 @@ def _import(obj, cursor, user, data, context=None): 'period_id': statement.period_id.id } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment') + context.update({'move_line_ids': [line.id]}) + result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context) voucher_line_dict = False if result['value']['line_ids']: for line_dict in result['value']['line_ids']: From c6f9cd4f3e24df447fd92364bf21194b379a2cea Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 18:33:51 +0530 Subject: [PATCH 18/51] [FIX] Account coda, payment, l10n_ch: minor fix bzr revid: mra@mra-laptop-20100929130351-orsxkn5kcw07yf2s --- addons/account_coda/wizard/account_coda_import.py | 2 +- .../wizard/account_payment_populate_statement.py | 2 +- addons/l10n_ch/wizard/bvr_import.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_coda/wizard/account_coda_import.py b/addons/account_coda/wizard/account_coda_import.py index e68de12b038..a577e47be74 100644 --- a/addons/account_coda/wizard/account_coda_import.py +++ b/addons/account_coda/wizard/account_coda_import.py @@ -224,7 +224,7 @@ class account_coda_import(osv.osv_memory): 'period_id':statement.get('period_id',False) or period,# statement.period_id.id } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - context.update({'move_line_ids': [line['id']]}) + context.update({'move_line_ids': rec_id}) result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context) voucher_line_dict = False if result['value']['line_ids']: diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 84911f512c4..d223c58316f 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -91,7 +91,7 @@ class account_payment_populate_statement(osv.osv_memory): 'period_id': statement.period_id.id } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - context.update({'move_line_ids': [line.id]}) + context.update({'move_line_ids': [line.move_line_id.id]}) result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context) voucher_line_dict = False if result['value']['line_ids']: diff --git a/addons/l10n_ch/wizard/bvr_import.py b/addons/l10n_ch/wizard/bvr_import.py index ea3fe9fac38..9d055bcfb5f 100644 --- a/addons/l10n_ch/wizard/bvr_import.py +++ b/addons/l10n_ch/wizard/bvr_import.py @@ -214,7 +214,7 @@ def _import(obj, cursor, user, data, context=None): 'period_id': statement.period_id.id } voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context) - context.update({'move_line_ids': [line.id]}) + context.update({'move_line_ids': line_ids}) result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context) voucher_line_dict = False if result['value']['line_ids']: From 94b5911bb858274ea42179eec9601bf0e7fc69bd Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 29 Sep 2010 19:03:06 +0530 Subject: [PATCH 19/51] [REF] Account: Add cancel button on opening of journal items wizard bzr revid: mra@mra-laptop-20100929133306-npsap8whxdwpvl5k --- addons/account/wizard/account_move_journal.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index 8b9cf48d48c..8422ece3fcb 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -73,7 +73,7 @@ class account_move_journal(osv.osv_memory): period_pool = self.pool.get('account.period') journal_pool = self.pool.get('account.journal') - + journal_id = self._get_journal(cr, uid, context) period_id = self._get_period(cr, uid, context) @@ -97,15 +97,16 @@ class account_move_journal(osv.osv_memory):