AttributeError: 'NoneType' object has no attribute 'translate'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Magento OpenERP Connector |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Overnight i updated Magento to latest version 1.4.1.0. Strange is that the first order that came with the latest version was imported wihout a problem. The second order however triggered this error:
Environment Information :
System : Windows-32bit
OS Name : nt
Operating System Release :
Operating System Version : 32bit
Operating System Architecture : 32bit
Operating System Locale : nl_NL.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 5.0.10
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "netsvc.pyo", line 245, in dispatch
File "netsvc.pyo", line 74, in __call__
File "service\
File "osv\osv.pyo", line 58, in wrapper
File "osv\osv.pyo", line 119, in execute
File "osv\osv.pyo", line 111, in execute_cr
File "C:\Users\
File "C:\Users\
File "C:\Users\
File "C:\Users\
File "C:\Users\
File "C:\Users\
AttributeError: 'NoneType' object has no attribute 'translate'
Any hints where to look?
Changed in magentoerpconnect: | |
status: | Incomplete → Invalid |
Sorry but my foldername is magerp instead of magentoerpconnect. I still did not changed it and made that name when i started it in the beginning of this project when the first release had still the name from smile.
Line 286 in magentoerpconne ct/sale. py has this line:
vat = data_record[ 'customer_ taxvat' ].translate( allchars, delchars).upper() an takes the value from the sales_flat_order table ( new table name in Magento 1.4.1.0) form the field customer_taxvat.
The value in that field for the first order to import was (NULL). When i removed the (NULL) and had just an empty field i was able to import the order.
This is strange because all previous orders from Magento 1.4.0.1 that had a (NULL) value I had no problems of importing the orders.
So I think the code snippet:
if cr.fetchone() and 'customer_taxvat' in data_record:
allchars = string. maketrans( '', '')
delchars = ''.join([c for c in allchars if c not in string.letters + string.digits]) 'customer_ taxvat' ].translate( allchars, delchars).upper()
vat_ country, vat_number = vat[:2].lower(), vat[2:] partner_ obj, 'check_vat_' + vat_country)
vat = data_record[
check = getattr(
vat_ok = check(vat_number)
Should contain an if statement when NOT NULL