• odoo学习之弹框显示


    
    
    按条件隐藏:
    <xpath expr="//group[1]" position="attributes">
    <attribute name="attrs">{'invisible':[('uid_qx','=',False),('customer','=',True),('id','!=',False)]}</attribute>
    </xpath>
    <xpath expr="//div[@name='buttons']" position="attributes">
    <attribute name="attrs">{'invisible':[('uid_qx','=',False),('customer','=',True),('id','!=',False)]}</attribute>
    </xpath>
    <xpath expr="//notebook" position="attributes">
    <attribute name="attrs">{'invisible':[('uid_qx','=',False),('customer','=',True),('id','!=',False)]}</attribute>
    </xpath>

    binary: 二进制型,可存图片,文档
    class="oe_edit_only"

    options
    :
    options='{"no_open": True}' 不会弹出窗口 就是 many2oneXM 界面不再显示超链
    options="{'reload_on_button': true}"
    one2many 首先加载记录 然后调用按钮动作重新加载
    options="{' always_reload': true}" one2many 每次插入数据时重新载入记录

    nolabel="1"  options="{'reload_on_button': true}"

    def do_enter_prod_line(self, cr, uid, ids, context=None):
    if not context:
    context = {}
    id=ids[0]
    ctx={'default_manufac_id':id}
    mod_obj = self.pool.get('ir.model.data')
    form_res = mod_obj.get_object_reference(cr, uid, 'demo_sale', 'view_prod_choice_origin_form')
    form_id = form_res and form_res[1] or False[0] or False
    return {
    'name': u'创建织造单',
    'type': 'ir.actions.act_window',
    'view_type': 'form',
    'view_mode': 'form',
    'res_model': 'prod.choice.origin',
    'views': [(form_id, 'form')],
    'view_id': form_id,
    'target': 'new',
    'context':ctx,
    }




    def add_za_order_line(self, cr, uid,man_id, record, context=None):
    man_obj=self.pool.get('manufacture.origin')
    id=man_id
    vals={}
    vals={'line_id':record}
    print vals
    self.write(cr,uid,[id],vals,context=context)
    return True
     
    
    

    
    
    class prod_choice_origin(osv.osv):
        _name='prod.choice.origin'
        _description='prod choice  origin'



    def action_add_za_order(self,cr,uid,ids,context=None):
    assert len(ids)==1
    result={}
    mo_obj=self.pool.get('manufacture.origin')
    zz_origin_obj=self.browse(cr,uid,ids,context)
    man_id=zz_origin_obj.manufac_id.id
    record=[]
    i=0
    for line_ids in zz_origin_obj.line_id:
    if line_ids.choice==True:
    record.append((0,0,{
    'sequence':i+1,
    'product_id':line_ids.product_id.id,
    'plan_qty':line_ids.realy_qty,
    'partner_id':line_ids.partner_id.id,
    'lot_id':line_ids.lot_id.id,
    }))
    i+=1


    mo_obj.add_za_order_line(cr,uid,man_id,record,context=None)
    return True

    _columns={ 'manufac_id':fields.many2one('manufacture.origin',string=u'单号'), 'product_id':fields.many2one('product.product',string=u'物料',domain=[('categ_id','not in',[6])]), 'line_id':fields.one2many('prod.choice.origin.line','order_id',string=u'物料明细', copy=True), } class prod_choice_origin_line(osv.osv): _name='prod.choice.origin.line' _description='prod choice origin' _columns={ 'sequence':fields.integer(u'序号'), 'order_id':fields.many2one('prod.choice.origin',u'上级 单号',required=True, ondelete='cascade', select=True,), 'choice':fields.boolean(u'请选择'), 'product_id':fields.many2one('product.product',string=u'物料',domain=[('sale_ok', '=', True)]), 'partner_id':fields.many2one('res.partner', u'供应商',domain=[('supplier', '=', True)],select=True), 'wl_qty':fields.float(u'库存',), 'realy_qty':fields.float(u'实用数量'), 'location_id':fields.many2one('stock.location',u'位置'), 'date_in':fields.date(u'入库日期'), } _defaults = { 'sequence':1, }
    
    
    <?xml version="1.0"?>
    <openerp>
        <data>
          <!--form view-->
          <record id="view_prod_choice_origin_form" model="ir.ui.view">
            <field name="name">prod.choice.origin.form</field>
            <field name="model">prod.choice.origin</field>
            <field name="arch" type="xml">
                <form >
                    <sheet>
                        <h2>
                            <label string="物料选择"/>
                        </h2>
                        <notebook>
                            <page >
                              <group col="4">
                                <group>
                                  <field name="product_id" on_change="onchange_product_id(product_id)"/>
                                </group>
                                <group></group>  
                                <group></group>  
                                <group></group>  
                              </group>
                                <field name="line_id">
                                    <tree  editable="bottom">
                                        <field name="sequence" />
                                        <field name="choice" />
                                        <field name="partner_id" />
                                        <field name="product_id"/>
                                        <field name="lot_id"/>
                                        <field name="wl_qty"  />
                                        <field name="realy_qty" />
                                        <field name="location_id"/>
                                        <field name="date_in"/>
                                    </tree>
                                </field>
                            </page>
                        </notebook>
                        <button name="action_add_za_order" string="添加" type="object" />
                    </sheet>
                </form>
            </field>
          </record>
        </data>
    </openerp>
    
    
    security.xml

    <record id="group_purchase_reopen_pring" model="res.groups"> <field name="category_id" ref="base.module_category_purchase_management" /> <field name="name">显示打印订单</field> <field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> <!--<field name="in_group_77" default="true"/>--> <field name="comment">显示打印订单 </field> </record>
    
    
       <report
                header="False"
                attachment_use="False"
                model="purchase.origin"
                report_type="qweb-pdf"
                id="print_purchase_add_menu_02"
                string="订单打印"
                name="demo_print_report.print_po_wx"
                file="demo_print_report.print_po_wx"
                groups="demo_purchase.group_purchase_reopen_print"
            />

     produc_tobj_ids=productobj.search(cr,uid,[('pname','=',pna),('product_color_id','=',pcol_id),('categ_id','=',6)],limit =1, context=context)

     
  • 相关阅读:
    SVN如何切换用户对代码进行操作
    SVN更新的时候报断言失败解决办法
    根据身份证号判断性别
    4.UiCollection API 详细介绍
    1.UiDevice API 详细介绍
    安卓常见反破解方式
    腾讯应用加固的脱壳分析和修复
    1.Android JUnit Runner(使用AndroidStudio)
    Java图形化界面设计——布局管理器之null布局(空布局)
    Java图形化界面设计——布局管理器之CardLayout(卡片布局)
  • 原文地址:https://www.cnblogs.com/1314520xh/p/9011756.html
Copyright © 2020-2023  润新知