Hello All,
I want to change status of Navigation menu from quotation to sale order when sales confirm. For this i tried to call sale order menu action into action_confirm. but didn't get up-to result.
also image attached below:
My action_confirm method code is here:
# Override action confirm Function
@api.multi
def action_confirm(self):
# Show Sales Order status in customer form
if self.partner_id.pet_names:
for record in self.partner_id.pet_names:
if record == self.pet_names_info:
if record.order:
raise ValidationError("Sale order already confirmed for this pet")
else:
if self.order_line:
if not self.sale_consent_rel:
raise ValidationError(_("Fill Consent Form.")) # Consent Validation
self.confirm_sale_info_to_pet_info_res_partner() # Send Record on pet information in res partner
# Services
for s in self.order_line:
if s.product_id:
if self.ser1 or self.ind_ser1:
self.confirm_rental_service() # Rental service
self.confirm_rental_service_history() # Rental history maintain
break
res = super(sale_order_pet, self).action_confirm()
#if res:
#self.confirm_email_template() # Send Email
ir_model_data = self.env['ir.model.data']
try:
view_id = ir_model_data.get_object_reference('sale', 'action_orders')[1]
except ValueError:
view_id = False
record_id = self.search([('id', '=', self.id)]).id
return {
'view_type': 'form',
'view_mode': 'form',
'views': [(view_id, 'form')],
'res_model': 'sale.order',
'view_id': view_id,
'type': 'ir.actions.act_window',
'res_id': record_id,
'target': 'new',
# 'context': context,
}
else:
raise ValidationError("Please Add Products in Order Lines")