码迷,mamicode.com
首页 > 其他好文 > 详细

odoo之页面跳转

时间:2017-05-15 22:21:50      阅读:288      评论:0      收藏:0      [点我收藏+]

标签:value   val   sans   信息   pac   页面   family   uid   origin   

击备注时,会由备注id带出他的内容 customer.requirement这是备注内容表

def sale_requirements_change(self, cr, uid, ids, requirements_id=None, context=None):
    result={}
    if requirements_id:
        require_ids=self.pool.get(‘customer.requirement‘).search(cr,uid,[(‘id‘,‘=‘,requirements_id)])
        obj=self.pool.get(‘customer.requirement‘).browse(cr,uid,require_ids,context=None)
        result[‘requirement_text‘]=obj.name
    else:
        result[‘requirement_text‘]=‘‘
return {‘value‘:result}

默认信息写法
_defaults={
    ‘product_qty‘:1,  
    ‘date_planned‘:fields.datetime.now,  交期
    ‘state‘:‘draft‘,
    ‘price‘:0,
}
# 创建发货单
def action_create_wave(self, cr, uid, ids, context=None):
    if not context:
       context = {}
    selfobj=self.browse(cr,uid,ids[0],context=context)
    pickobj=self.pool(‘stock.picking‘)
    pickids=pickobj.search(cr,uid,[(‘origin‘,‘like‘,selfobj.name)])

//销售订单里面的信息,默认带到发货单里面去 ctx={‘default_partner_id‘:selfobj.partner_id.id,‘default_bzfs_type‘:selfobj.packing_type,‘default_delvy_type‘:selfobj.send_invoice_type,‘default_picking_ids‘:pickids,‘default_origin‘:selfobj.name} #增加传递selfobj.send_invoice_type运送方式
mod_obj = self.pool.get(‘ir.model.data‘)
    form_res = mod_obj.get_object_reference(cr, uid, ‘stock_picking_wave‘, ‘view_picking_wave_form‘)
    form_id = form_res and form_res[1] or False
return {
        ‘name‘:u‘发货单新增,
        ‘type‘: ‘ir.actions.act_window‘,
        ‘view_type‘: ‘form‘,
        ‘view_mode‘: ‘form‘,
        ‘res_model‘: ‘stock.picking.wave‘,
        ‘views‘: [(form_id, ‘form‘)],
        ‘view_id‘:form_id,
        ‘context‘:ctx,
    }
#汇总金额的函数
def _get_subtotal(self, cr, uid, ids,  field_name, arg, context=None):
    res = {}
    for order in self.browse(cr, uid, ids, context=context):
        subtotal=0.0
for line in order.line_id:
            subtotal += line.total
        res[order.id] = subtotal
    return res

odoo之页面跳转

标签:value   val   sans   信息   pac   页面   family   uid   origin   

原文地址:http://www.cnblogs.com/1314520xh/p/6858470.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!