跳至内容
菜单
此问题已终结

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
518
0
4月 25
2954
0
7月 24
2108
0
4月 24
2417
0
5月 22
2538