Merge lp:~openerp-dev/openobject-addons/6.1-opw-576266-dhs into lp:openobject-addons/6.1

Proposed by Dhruti Shastri(OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 6895
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-576266-dhs
Merge into: lp:openobject-addons/6.1
Diff against target: 55 lines (+12/-6)
1 file modified
l10n_be/wizard/l10n_be_partner_vat_listing.py (+12/-6)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-576266-dhs
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+115536@code.launchpad.net

Description of the change

To reproduce the issue install Account and l10n_be module

After Installed Module go to : Accounting/Reporting/Legal
Reports/Belgium Statements/Annual Listing Of VAT-Subjected
Customers.

Open "Annual Listing Of VAT-Subjected Customers" wizard and
click on "Create XML" OR "Print" Button it is giving following
trace back.

When no phone is defined in the company and in Partner.
"/home/vpa/workspace/6.1/addons-6.1/l10n_be/wizard/l10n_be_partner_vat_listing.py",
line 190, in create_xml
phone = ads.phone.replace(' ','') or ''
AttributeError: 'bool' object has no attribute 'replace'

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Already Fixed on Trunk (means that it was already fixed and merged in Trunk). If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6895. By Dhruti Shastri(OpenERP)

[l10_be] : Wizard thorws error instead of User Friendly Warning (Case:576266)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_be/wizard/l10n_be_partner_vat_listing.py'
2--- l10n_be/wizard/l10n_be_partner_vat_listing.py 2012-02-15 13:18:16 +0000
3+++ l10n_be/wizard/l10n_be_partner_vat_listing.py 2012-07-18 11:59:30 +0000
4@@ -65,6 +65,8 @@
5
6 partners = []
7 partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context)
8+ if not partner_ids:
9+ raise osv.except_osv(_('Missing Partner Configuration'),_('Could not find VAT and Legal Statement Validation'))
10 cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount
11 FROM (SELECT l.partner_id, p.name, p.vat, SUM(CASE WHEN c.code ='49' THEN -l.tax_amount ELSE l.tax_amount END) as turnover
12 FROM account_move_line l
13@@ -188,7 +190,7 @@
14 addr = obj_partner.address_get(cr, uid, [obj_cmpny.partner_id.id], ['invoice'])
15 if addr.get('invoice',False):
16 ads = obj_addr.browse(cr, uid, [addr['invoice']], context=context)[0]
17- phone = ads.phone.replace(' ','') or ''
18+ phone = ads.phone.replace(' ','') if ads.phone else ''
19 email = ads.email or ''
20 name = ads.name or ''
21 city = obj_addr.get_city(cr, uid, ads.id)
22@@ -246,17 +248,19 @@
23 <VATNumber>%(SenderId)s</VATNumber>
24 <Name>%(comp_name)s</Name>
25 <Street>%(street)s</Street>
26- <PostCode>%(zip)s</PostCode>
27- <City>%(city)s</City>
28- <CountryCode>%(country)s</CountryCode>
29- <EmailAddress>%(email)s</EmailAddress>
30- <Phone>%(phone)s</Phone>
31+ <PostCode>%(zip)s</PostCode>
32+ <City>%(city)s</City>
33+ <CountryCode>%(country)s</CountryCode>
34+ <EmailAddress>%(email)s</EmailAddress>
35+ <Phone>%(phone)s</Phone>
36 </ns2:Declarant>
37 <ns2:Period>%(period)s</ns2:Period>
38 """ % annual_listing_data
39
40 # Turnover and Farmer tags are not included
41 client_datas = self._get_datas(cr, uid, ids, context=context)
42+ if not client_datas:
43+ raise osv.except_osv(_('Data Insufficient!'),_('No data available for the client.'))
44 data_client_info = ''
45 for amount_data in client_datas:
46 data_client_info += """
47@@ -307,6 +311,8 @@
48 datas['year'] = context['year']
49 datas['limit_amount'] = context['limit_amount']
50 datas['client_datas'] = self._get_datas(cr, uid, ids, context=context)
51+ if not datas['client_datas']:
52+ raise osv.except_osv(_('Error !'),_('No record to print.'))
53 return {
54 'type': 'ir.actions.report.xml',
55 'report_name': 'partner.vat.listing.print',