Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
4971 Näkymät

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


Avatar
Hylkää
Paras vastaus

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
Avatar
Hylkää
Tekijä Paras vastaus

@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,
})
Avatar
Hylkää

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

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
elok. 22
1856
1
heinäk. 22
19350
0
huhtik. 22
2521
3
syysk. 21
2701
2
syysk. 21
4084