コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1206 ビュー

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

アバター
破棄
著作者

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.

関連投稿 返信 ビュー 活動
0
9月 25
505
0
4月 25
2946
0
7月 24
2104
0
4月 24
2390
0
5月 22
2535