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

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
1868
1
7月 22
19362
0
4月 22
2528
3
9月 21
2711
2
9月 21
4096