Skip to Content
Menu
This question has been flagged
2 Replies
4970 Rodiniai

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


Portretas
Atmesti
Best Answer

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
Portretas
Atmesti
Autorius Best Answer

@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,
})
Portretas
Atmesti

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

Related Posts Replies Rodiniai Veikla
0
rugp. 22
1856
1
liep. 22
19350
0
bal. 22
2521
3
rugs. 21
2701
2
rugs. 21
4084