在交货单(stock.picking.out)上创建自定义字段,该字段从销售订单中获取其价值 [英] Create custom field at delivery order (stock.picking.out) which gets its value from sales order

查看:98
本文介绍了在交货单(stock.picking.out)上创建自定义字段,该字段从销售订单中获取其价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个销售订单表格,其中包含一个自定义的交货日期字段. 现在,我要将值从销售订单中的交货日期字段传递到交货订单中的承诺日期字段(stock.picking.out).

I have a sales order form which contains a custom delivery date field. Now I want to pass the value from delivery date field in sales order to the commitment date field in delivery order (stock.picking.out).

我们是否在stock.picking和stock.picking.out中都创建了两列? 还有如何在自动创建交货单的过程中(单击确认订单按钮)从销售订单中提取交货日期字段值.

Did we make two columns in both stock.picking and stock.picking.out? And also how can I take the delivery date field value from sales order during the automatic creation of delivery order(at the click of confirm order button).

我正在使用v7.预先感谢

I am using v7. Thanks in advance

推荐答案

我从以下链接获得了答案.非常感谢@Sudhir Arya对我的帮助.

I got the answer from the following link. Thanks too much for @Sudhir Arya for helping me.

链接

这是完整的代码

class StockPicking(orm.Model):
    _inherit = 'stock.picking'

    _columns = {
        'x_commitment_date': fields.date('Commitment Date', help="Committed date for delivery."),
    }

StockPicking()

class StockPickingOut(orm.Model):
    _inherit = 'stock.picking.out'

    def __init__(self, pool, cr):
        super(StockPickingOut, self).__init__(pool, cr)
        self._columns['x_commitment_date'] = self.pool['stock.picking']._columns['x_commitment_date']

StockPickingOut()

class Sale_Order(osv.Model):
    _inherit = 'sale.order'

    def _prepare_order_picking(self, cr, uid, order, context=None):
        vals = super(sale_order, self)._prepare_order_picking(cr, uid, order, context=context)
        vals.update({'x_commitment_date': order.commitment_date})
        return vals

 Sale_Order()

这篇关于在交货单(stock.picking.out)上创建自定义字段,该字段从销售订单中获取其价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆