Dhruti Shastri has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-576266-dhs into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-576266-dhs/+merge/115536

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'


-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-576266-dhs/+merge/115536
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-576266-dhs.
=== modified file 'l10n_be/wizard/l10n_be_partner_vat_listing.py'
--- l10n_be/wizard/l10n_be_partner_vat_listing.py	2012-02-15 13:18:16 +0000
+++ l10n_be/wizard/l10n_be_partner_vat_listing.py	2012-07-18 11:59:30 +0000
@@ -65,6 +65,8 @@
 
         partners = []
         partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context)
+        if not partner_ids:
+             raise osv.except_osv(_('Missing Partner Configuration'),_('Could not find VAT  and Legal Statement Validation'))
         cr.execute("""SELECT sub1.partner_id, sub1.name, sub1.vat, sub1.turnover, sub2.vat_amount
                 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
                       FROM account_move_line l
@@ -188,7 +190,7 @@
         addr = obj_partner.address_get(cr, uid, [obj_cmpny.partner_id.id], ['invoice'])
         if addr.get('invoice',False):
             ads = obj_addr.browse(cr, uid, [addr['invoice']], context=context)[0]
-            phone = ads.phone.replace(' ','') or ''
+            phone = ads.phone.replace(' ','') if ads.phone  else ''
             email = ads.email or ''
             name = ads.name or ''
             city = obj_addr.get_city(cr, uid, ads.id)
@@ -246,17 +248,19 @@
             <VATNumber>%(SenderId)s</VATNumber>
             <Name>%(comp_name)s</Name>
             <Street>%(street)s</Street>
-            <PostCode>%(zip)s</PostCode> 
-            <City>%(city)s</City> 
-            <CountryCode>%(country)s</CountryCode> 
-            <EmailAddress>%(email)s</EmailAddress> 
-            <Phone>%(phone)s</Phone> 
+            <PostCode>%(zip)s</PostCode>
+            <City>%(city)s</City>
+            <CountryCode>%(country)s</CountryCode>
+            <EmailAddress>%(email)s</EmailAddress>
+            <Phone>%(phone)s</Phone>
         </ns2:Declarant>
         <ns2:Period>%(period)s</ns2:Period>
         """ % annual_listing_data
 
         # Turnover and Farmer tags are not included
         client_datas = self._get_datas(cr, uid, ids, context=context)
+        if not client_datas:
+             raise osv.except_osv(_('Data Insufficient!'),_('No data available for the client.'))
         data_client_info = ''
         for amount_data in client_datas:
             data_client_info += """
@@ -307,6 +311,8 @@
         datas['year'] = context['year']
         datas['limit_amount'] = context['limit_amount']
         datas['client_datas'] = self._get_datas(cr, uid, ids, context=context)
+        if not datas['client_datas']:
+            raise osv.except_osv(_('Error !'),_('No record to print.'))
         return {
             'type': 'ir.actions.report.xml',
             'report_name': 'partner.vat.listing.print',

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to