İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
4080 Görünümler

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
Vazgeç
En İyi Yanıt

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
Vazgeç

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

En İyi Yanıt

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
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
5
Eyl 25
20865
3
Ağu 25
3006
1
May 25
2888
1
Nis 25
3857
1
Nis 25
4729