30 lines
1.3 KiB
YAML
30 lines
1.3 KiB
YAML
-
|
|
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.
|
|
-
|
|
!workflow {
|
|
model: sale.order, action: order_confirm,
|
|
ref: sale.sale_order_6
|
|
}
|
|
-
|
|
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"))
|
|
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)
|
|
for line in so.order_line:
|
|
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"
|