跳至内容
菜单
此问题已终结
2 回复
4800 查看

I have tried several times to googling but still im struggle. I already passed my value using _prepare_order_picking methods but the value does not show up, so i change my code using stock_order_procurement still it does not show up too . Please help :) .  

models.py

_inherit = 'sale.order.line' 
@api.multi

def _prepare_order_picking ( self , cr , uid , order , context = None ):
res = super ( SaleOrderLine , self ). _prepare_order_picking ( cr , uid , order , context = context )
res . update ({ 'description_picking' : self.
product_id })
return res


形象
丢弃
最佳答案

Hello,
you can use below method for pass value from SO Line to Stock Picking.

   Below is a Example from source of Odoo V10.
***********************************************
    @api.multi
     def _prepare_order_line_procurement(self, group_id):
vals = super(SaleOrderLine, self)._prepare_order_line_procurement(group_id=group_id)
for line in self.filtered("order_id.requested_date"):
date_planned = fields.Datetime.from_string(line.order_id.requested_date) - timedelta(days=line.order_id.company_id.security_lead)
vals.update({
'date_planned': fields.Datetime.to_string(date_planned),
})
return vals I hope it will help you. Thanks
形象
丢弃
编写者 最佳答案

@SunnyDev    

Thanks for your answer, but the value still empty :(.

class StockPackOperation(models.Model):
_inherit ='stock.pack.operation'
DescriptionSO = fields.Text(string='SO Description', store=True)

class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

@api.multi
def _prepare_order_line_procurement(self, group_id):
res = super(SaleOrderLine, self)._prepare_order_line_procurement(group_id=group_id)
for line in self.filtered("order_id.product_id"):
res.update({
'DescriptionSO': self.name,
})
形象
丢弃

Hello ahmatdanis24@gmail.com,

you should be remove "store=True" attribute from field Definition because no it's a Character field so no need to add this extra attribute.

after that Upgrade your Module and see the effect.

it will help you in this case.

Thanks

相关帖文 回复 查看 活动
0
8月 22
1658
1
7月 22
18936
0
4月 22
2240
3
9月 21
2467
2
9月 21
3905