I create the order form from my custom mudule. But I want to display it automatically in form view after its creation. How to do ?
def createOrder(self):
order = self.env['sale.order'].create({
'partner_id': self.client.id,
'validity_date': self.date_end,
'date_order': str(fields.Datetime.to_datetime(datetime.date.today()))
})
for product in self.product_ids:
self.env['sale.order.line'].create({
'product_id': product.id,
'order_id': order.id,
'price_unit': product.list_price,
'price_subtotal': float(self.prix_ht),
'product_uom_qty': product.uom_id.id,
'product_uom': product.uom_id.id
})