2011-12-14 17:09:13 +00:00
-
In order to test the Requested Date feature in Sale Orders in OpenERP,
2012-01-04 17:05:58 +00:00
I update a demo Sale Order with Requested Date on 2010-12-17
2011-12-14 17:09:13 +00:00
-
2012-01-04 17:05:58 +00:00
!python {model: sale.order}: |
2014-03-06 22:50:09 +00:00
self.write(cr, uid, ref("sale.sale_order_6"), {'requested_date': '2010-07-12'})
-
2011-12-14 17:09:13 +00:00
I confirm the Sale Order.
2014-03-06 22:50:09 +00:00
-
2011-12-14 17:09:13 +00:00
!workflow {
model: sale.order, action : order_confirm,
2014-03-06 22:50:09 +00:00
ref : sale.sale_order_6
2011-12-14 17:09:13 +00:00
}
-
I verify that the Procurements and Stock Moves have been generated with the
correct date
-
!python {model: sale.order}: |
from datetime import datetime, timedelta
2014-03-06 22:50:09 +00:00
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
2014-04-16 15:48:30 +00:00
from openerp.osv import fields
2014-03-06 22:50:09 +00:00
so = self.browse(cr, uid, ref("sale.sale_order_6"))
security_delay = timedelta(days=so.company_id.security_lead)
2014-05-08 14:28:59 +00:00
requested_date = datetime.strptime(so.requested_date, DEFAULT_SERVER_DATETIME_FORMAT)
2014-04-14 16:12:29 +00:00
right_date = (requested_date - security_delay).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
2011-12-14 17:09:13 +00:00
for line in so.order_line :
2014-04-16 15:48:30 +00:00
assert line.procurement_ids, "No Procurement was created"
assert line.procurement_ids[0].date_planned == right_date, "The planned date for the Procurement Order is wrong"
assert line.procurement_ids[0].move_ids and line.procurement_ids[0].move_ids[0].date_expected == right_date, "The expected date for the Stock Move is wrong"