I need to customize the sale order action_confirm method to skip product quantity validation step and deliver the order once I confirmed the sale order
How to do it ?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I need to customize the sale order action_confirm method to skip product quantity validation step and deliver the order once I confirmed the sale order
How to do it ?
Hii Abdullah ,
Please find code in Comment.
Note: Make sure that you have on hand quantities of the product to be sold otherwise it will raise error message
"You cannot validate a transfer if no quantities are reserved nor done. To force the transfer, switch in edit mode and encode the done quantities."
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
You can try this below code:
in py:
class SaleOrderInherit(models.Model):
_inherit = 'sale.order'
def action_confirm(self):
res = super(SaleOrderInherit, self).action_confirm()
for sale_rec in self:
delivery = self.env['stock.picking'].search([('sale_id', '=', sale_rec.id)])
delivery.action_set_quantities_to_reservation()
delivery.button_validate()
return res
Hello this is Gulshan Negi
Well, by creating a custom module and overriding the method, you can modify the action_confirm method of a sale order in Odoo. You can modify the procedure in the following manner to skip the product quantity validation step and immediately deliver the order:
@api.multi
def action_confirm(self):
for order in self:
# Skip product quantity validation step
order.state = 'sale'
# Deliver the order
order.action_done()
return True
I hope you are clear now.
相关帖文 | 回复 | 查看 | 活动 | |
---|---|---|---|---|
|
5
9月 25
|
20637 | ||
|
3
8月 25
|
2973 | ||
|
1
5月 25
|
2850 | ||
|
1
4月 25
|
3816 | ||
|
1
4月 25
|
4686 |