← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 677064] Re: [6.0RC1][purchase_requisition] Error requesting a quotation

 

Hi vra, getting the latest trunk addons code (rev 3938), I still got
same error. This time, I'm going to reproduce more accurately the steps
I followed:

1.-Create a PR with default values
2.-Add a product (in my case, i used a 'service' product).
3.-Request a quotation selecting a supplier partner.

Got following error:

File "/opt/openerp/6.0/server/bin/addons/purchase_requisition/wizard/purchase_requisition_partner.py", line 102, in create_order
    date_planned = newdate.strftime('%Y-%m-%d %H:%M:%S')
AttributeError: 'datetime.timedelta' object has no attribute 'strftime'

Debugging affected file
(purchase_requisition/wizard/purchase_requisition_partner.py) I got:

>pp newdate (line 87)
datetime.datetime(2010, 11, 18, 18, 41, 40)

ipdb> pp newdate (line 90)
datetime.datetime(2010, 11, 17, 18, 41, 40)

(line 92) newdate = newdate -(delay and relativedelta(days=delay) or
datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )

ipdb> pp newdate (line 93)
datetime.timedelta(-1)

I think this is because  'newdate -(delay and relativedelta(days=delay)
or datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )'
operation returns a 'timedelta' object, so 'newdate' gets this value,
invalidating subsecuent operations (date_planned =
newdate.strftime('%Y-%m-%d %H:%M:%S') in line 102, and so on). So, I
think proper solution would be:

newdate -= newdate -(delay and relativedelta(days=delay) or
datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )

to keep 'newdate' as a 'datetime.datetime' object.

Also, I think this bug is related to
https://bugs.launchpad.net/bugs/671323.

Regards,

** Changed in: openobject-addons
       Status: Invalid => New

-- 
[6.0RC1][purchase_requisition] Error requesting a quotation
https://bugs.launchpad.net/bugs/677064
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: New

Bug description:
Hi all,
Using 6.0RC1 when I try to request a quotation for an existing 'purchase requisition' (having installed 'purchase_requisition' module), I always got following error: "datetime.timedelta does not have attribute 'strftime' because in wizard/purchase_requisition_partner.py there was an incorrect operation with 'newdate', specifically in line 90:

newdate = newdate -(delay and relativedelta(days=delay) or datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') )

This line converted newdate from 'datetime.datetime' object into a 'datetime.timedelta' one.

I attach a patch.

Regards,





References