[FIX] sale_order_dates: copy demo data

The SO line in the demo data is already linked to an existing
procurement. Therefore, the test is not correct.
This commit is contained in:
Nicolas Martinelli
2015-09-29 19:09:08 +02:00
parent 2e98125c6d
commit 21bd895536
@@ -1,23 +1,19 @@
-
In order to test the Requested Date feature in Sale Orders in OpenERP,
I update a demo Sale Order with Requested Date on 2010-12-17
-
!python {model: sale.order}: |
self.write(cr, uid, ref("sale.sale_order_6"), {'requested_date': '2010-07-12'})
-
I confirm the Sale Order.
-
!python {model: sale.order}: |
self.action_confirm(cr, uid, ref("sale.sale_order_6"), context=context)
-
I verify that the Procurements and Stock Moves have been generated with the
I copy a demo Sale Order with Requested Date on 2010-12-17
Then I verify that the Procurements and Stock Moves have been generated with the
correct date
-
!python {model: sale.order}: |
from datetime import datetime, timedelta
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
from openerp.osv import fields
so = self.browse(cr, uid, ref("sale.sale_order_6"))
new_id = self.copy(cr, uid, ref("sale.sale_order_6"))
self.write(cr, uid, [new_id], {'requested_date': '2010-07-12'})
self.action_confirm(cr, uid, [new_id], context=context)
so = self.browse(cr, uid, new_id)
security_delay = timedelta(days=so.company_id.security_lead)
requested_date = datetime.strptime(so.requested_date, DEFAULT_SERVER_DATETIME_FORMAT)
right_date = (requested_date - security_delay).strftime(DEFAULT_SERVER_DATETIME_FORMAT)