Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Before saved,how can I move my wizard's data to move_lines

By
rongsy
on 1/10/14, 5:22 AM 872 views

Hi,ereryone, I want to use wizard to do the "Add an Item". I add "My add" after "Add an Item". when I click "My add", it will pop wizard. But after I choose product, move_lines doesn't have any data lines. the following is my question: How can I move my wizard data to move_lines?

my_wizard.py:

class stock_move_product(osv.osv_memory): _name = "stock.move.product" _columns = { 'product_id': fields.many2one('product.product', 'Product', required=True, select=True),
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product Unit of Measure'), required=True),
}

def default_get(self, cr, uid, fields, context=None):
    if context is None:
        context = {}
    res = super(stock_move_product, self).default_get(cr, uid, fields, context=context)
    '''move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
    if 'product_id' in fields:
        res.update({'product_id': move.product_id.id})
    if 'product_uom' in fields:
        res.update({'product_uom': move.product_uom.id})'''
    res.update({'product_uom':1})
    return res

def do_move_product(self, cr, uid, ids, context=None):
    return {'type': 'ir.actions.act_window_close'}

my_wizard_view.xml:

<openerp> <data> <record id="view_stock_move_product_wizard" model="ir.ui.view"> <field name="name">Product Move</field> <field name="model">stock.move</field> <field name="type">form</field> <field name="arch" type="xml"> <form string="Product Move" version="7.0"> <group string="Move Products"> <field name="product_id"/> <field name="product_qty"/> </group> <footer> <button name="do_move_product" string="Ok" type="object" class="oe_highlight"/> or <button string="Cancel" class="oe_link" special="cancel"/> </footer> </form> </field> </record>

    <record id="move_product" model="ir.actions.act_window">
        <field name="name">Product Move</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">stock.move</field>
        <field name="src_model">product.product</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>
</data>

</openerp>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 1/10/14, 5:22 AM
Seen: 872 times
Last updated: 3/16/15, 8:10 AM