当我们从conform sale
sale order
生成stock picking
时,它在all transfer
中生成stock picking
,并自动地将一些字段(如oder id
作为源文档、合作伙伴id和其他东西)传递给stock picking
,现在我想与它们一起传输另一个字段,即partner_shipping_id
字段的地址。谁来告诉我该怎么做。我会非常感激..。
发布于 2016-10-10 10:27:39
以下是解决问题的方法。
1.在py和视图端设置sale.order和stock.pirking上的自定义字段。
2.继承自定义模块中的_prepare_picking_assign(),并使用stock.move over ridding方法。
3.使用super
并设置自定义字段值。
4.确认销售订单文件后的变更意见。
例如, :
from openerp import models, fields, api, _
class sale_order(models.Model):
_inherit='sale.order'
customer_field=fields.Char(string='Customer Field')
class stock_picking(models.Model):
_inherit='stock.picking'
customer_field=fields.Char(string='Customer Field')
class stock_move(models.Model):
_inherit='stock.move'
def _prepare_picking_assign(self,cr, uid, move, context=None):
res=super(stock_move,self)._prepare_picking_assign(cr, uid, move, context)
if move.procurement_id and move.procurement_id.sale_line_id and move.procurement_id.sale_line_id.order_id:
sale_obj = move.procurement_id.sale_line_id.order_id
if sale_obj.dif_pick_address:
res.update({
'customer_field':sale_obj.customer_field,
})
return res
以上代码在Odo8.0版本中运行良好
此外,您应该设置在视图部分,以便您可以检查销售订单价值进入股票挑选后,确认您的销售订单。
我希望我的回答能对你有所帮助:)
https://stackoverflow.com/questions/39953729
复制相似问题