跳至內容
選單
此問題已被標幟
2 回覆
4973 瀏覽次數

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
1863
1
7月 22
19362
0
4月 22
2526
3
9月 21
2711
2
9月 21
4092