odoo学习之弹框显示

 
def do_enter_prod_line(self, cr, uid, ids, context=None):
    if not context:
       context = {}

    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',
    }
 

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

    _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>
 

猜你喜欢

转载自www.cnblogs.com/1314520xh/p/9011756.html
今日推荐