首页 > 代码库 > odoo系统之产品表

odoo系统之产品表

<style>p { line-height: 120% } pre.western { font-family: "Courier New", monospace }</style>

# 输入产品带出它默认的包装方式\单位\品名\规格

def get_product_unit(self, cr, uid,ids,product_id,pcust_order_no,pdate_planned,partner_id,context=None):
    if partner_id:
        result={}
        try:
            result[‘cust_order_no‘]=pcust_order_no#zxs 从上一级获取客户订单号
result[‘date_planned‘]=pdate_planned #zxs 从上一级获取交期
result[‘partner_id‘]=partner_id #zxs 从上一级获取客户
productobj = self.pool.get(‘product.product‘)
            produtt_obj=productobj.browse(cr,uid,[product_id],context=None)
            result[‘pname‘]=produtt_obj.material
            result[‘spec‘]=produtt_obj.cust_spec
            result[‘product_uom‘]=produtt_obj.uom_id.id
            result[‘packing_type1‘]=produtt_obj.packing_type1
//最近订单
sql="select price_unit from sale_price_list where partner_id=%d and product_id=%d order by write_date desc limit 1"%(partner_id,product_id) cr.execute(sql) dict=cr.fetchall() if dict: result[‘price‘]=dict[0][0] else: result[‘price‘]=0 return {‘value‘:result} except Exception, ex: return False else:
<style>p { line-height: 120% } pre.western { font-family: "Courier New", monospace }</style>

raise osv.except_osv((u‘警告!‘),(u‘请先选择客户))
 

odoo系统之产品表