Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
4085 Tampilan

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 ? 

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang

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

Jawaban Terbai

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.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
5
Sep 25
20894
3
Agu 25
3009
1
Mei 25
2892
1
Apr 25
3863
1
Apr 25
4730