Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1273 Lượt xem

So i have added a piece of code that creates a sales quotation when a stock.picking(Transfer) is confirmed.

The problem is that two such sales quotation is created , 1 has all the fields correcty filled in but the other unwanted one has move.lines with the products but the quantity is set to 0 for each line. 

 WHat is causing this issue here, i cant seem to find out.

----------------------------------------------------------------------------------------

class PickingToQuotation (models.Model):

 _inherit = 'stock.picking


def button_validate(self):

​ res=super(PickingToQuotation,self).button_validate()

​self.action_create_quotation()

​return res


def action_create_quotation(self):

​if self.picking_type_id.code in ['outgoing','internal']:

  ​vals={'partner_id':self.partner_id.id,

​'warehouse_id':self.location_id.warehouse_id.id,

​'origin':self.name,'picking_ids':[self.id] }
​res=self.env['sale.order'].create(vals)

return True

Ảnh đại diện
Huỷ bỏ
Tác giả

I have dwelled into this problem and found that, when I directly validate the transfer without setting the done quantities manually, two orders are created. But when I manually set the done quantities on the transfer and then only click the validate button, only the one required sales quotation gets created.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 9 25
668
0
thg 4 25
3052
0
thg 7 24
2198
0
thg 4 24
2552
0
thg 5 22
2615