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.
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
5
thg 9 25
|
22351 | ||
|
3
thg 8 25
|
3270 | ||
|
1
thg 5 25
|
3124 | ||
|
1
thg 4 25
|
4097 | ||
|
1
thg 4 25
|
4961 |