Merge lp:~xmo-deactivatedaccount/openobject-addons/fix-tax-code-report into lp:openobject-addons/5.0

Proposed by Xavier (Open ERP)
Status: Merged
Merged at revision: 2448
Proposed branch: lp:~xmo-deactivatedaccount/openobject-addons/fix-tax-code-report
Merge into: lp:openobject-addons/5.0
Diff against target: 74 lines (+29/-25)
1 file modified
account/report/account_tax_code.py (+29/-25)
To merge this branch: bzr merge lp:~xmo-deactivatedaccount/openobject-addons/fix-tax-code-report
Reviewer Review Type Date Requested Status
Husen Daudi (community) Approve
Review via email: mp+14993@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Fixe un bug dans account/report/account_tax_code.py et clarifie un peu le code.

Revision history for this message
Husen Daudi (husendaudi) wrote :

Merged in revision : 2448 <email address hidden>
Thanks for contribution.

review: Approve
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Welcome home Xavier :)

Xavier Morel wrote:
> Xavier Morel has proposed merging lp:~xmo/openobject-addons/fix-tax-code-report into lp:openobject-addons/5.0.
>
> Requested reviews:
> OpenERP Quality Team (openerp)
>
>
> Fixe un bug dans account/report/account_tax_code.py et clarifie un peu le code.
>

--
Fabien Pinckaers
CEO Tiny - OpenERP Editor
Chaussée de Namur 40
B-1367 Grand-Rosière
Belgium
Phone: +32.81.81.37.00
Fax: +32.81.73.35.01
Web: http://openerp.com

Great Achievements Start With Tiny Investments
  -- Marty, 2005

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account/report/account_tax_code.py'
--- account/report/account_tax_code.py 2009-10-09 11:49:00 +0000
+++ account/report/account_tax_code.py 2009-11-18 13:35:28 +0000
@@ -1,4 +1,5 @@
1# -*- encoding: utf-8 -*-1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
2##############################################################################3##############################################################################
3#4#
4# OpenERP, Open Source Management Solution 5# OpenERP, Open Source Management Solution
@@ -26,6 +27,25 @@
26from report import report_sxw27from report import report_sxw
27import re28import re
2829
30def _get_country(record):
31 if record.partner_id \
32 and record.partner_id.address \
33 and record.partner_id.address[0].country_id:
34 return record.partner_id.address[0].country_id.code
35 else:
36 return ''
37
38def _record_to_report_line(record):
39 return {'date': record.date,
40 'ref': record.ref,
41 'acode': record.account_id.code,
42 'name': record.name,
43 'debit': record.debit,
44 'credit': record.credit,
45 'pname': record.partner_id and record.partner_id.name or '',
46 'country': _get_country(record)
47 }
48
29class account_tax_code_report(rml_parse.rml_parse):49class account_tax_code_report(rml_parse.rml_parse):
30 #_name = 'report.account.tax.code.entries'50 #_name = 'report.account.tax.code.entries'
31 51
@@ -36,30 +56,14 @@
36 'get_line':self.get_line,56 'get_line':self.get_line,
37 })57 })
38 58
39 def get_line(self,obj):59 def get_line(self, obj):
40 res = {}60 line_ids = self.pool.get('account.move.line').search(self.cr, self.uid, [('tax_code_id','=',obj.id)])
41 result = []61 if not line_ids: return []
42 line_ids = self.pool.get('account.move.line').search(self.cr,self.uid,[('tax_code_id','=',obj.id)])62
43 if line_ids:63 return map(_record_to_report_line,
44 move_line_objs = self.pool.get('account.move.line').browse(self.cr,self.uid,line_ids)64 self.pool.get('account.move.line')\
45 for line in move_line_objs:65 .browse(self.cr, self.uid, line_ids))
46 res['date'] = line.date66
47 res['ref'] = line.ref
48 res['acode'] = line.account_id.code
49 res['pname'] = ''
50 res['country'] = ''
51
52 if line.partner_id:
53 res['pname'] = line.partner_id.name
54 if line.partner_id.address and line.partner_id.address[0].country_id:
55 res['country'] = line.partner_id.address[0].country_id.code
56 res['name'] = line.name
57 res['debit'] = line.debit
58 res['credit'] = line.credit
59 result.append(res)
60
61 return result
62
63report_sxw.report_sxw('report.account.tax.code.entries', 'account.tax.code',67report_sxw.report_sxw('report.account.tax.code.entries', 'account.tax.code',
64 'addons/account/report/account_tax_code.rml', parser=account_tax_code_report, header=False)68 'addons/account/report/account_tax_code.rml', parser=account_tax_code_report, header=False)
6569