This question has been flagged
1969 Views

I've inherited `stock.move` object, and added a `Many2one` field to another model in my module like this:

  •     class stock_move(models.Model):

  •         _name = "stock.move"

  •         _inherit = "stock.move"

  •         stock_move_lines = fields.Many2one('bsi.print.order', string="BSI Print order")

On `bsi.print.order` model I have a `One2many`:

    stock_move = fields.One2many('stock.move', 'stock_move_lines', string="Stock Move")

Now, in my view:

  •       <record id="view_print_order_form" model="ir.ui.view">

  •             <field name="name">bsi.print.order.form</field>

  •             <field name="model">bsi.print.order</field>

  •             <field name="arch" type="xml">

  •                 <form string="Print Order">

  •                 <div class="oe_title">

  •                 <label for="name" class="oe_edit_only" />

  •                 <h1>

  •                     <field name="name" />

  •                 </h1>

  •                 </div>

  •                 <sheet>

  •                     <h1>

  •                         <field name="name" class="oe_inline" readonly="1"/>

  •                     </h1>

  •                     <group>

  •                         <group>

  •                           <field name="date_print"/>

  •                           <field name="production_orders"/>

  •                           <field name="worksheet_calc" />

  •                         </group>

  •                         <group>

  •                         </group>

  •                     </group>

  •                       <notebook>

  •                             <page string="Stock Lines">

  •                                 <field name="stock_move" colspan="4" nolabel="1">

  •                                     <tree string="Stock Lines">

  •                                         <field name="product_id" />

  •                                         <field name="name"/>

  •                                         <field name="product_uom_qty"/>

  •                                         <field name="invoice_state"/>

  •                                         <field name="company_id"/>

  •                                         <field name="location_id"/>

  •                                         <field name="location_dest_id"/>

  •                                         <field name="date_expected"/>

  •                                         <button name="action_done" string="Generate Move" class="oe_highlight"/>

  •                                     </tree>

  •                                 </field>

  •                             </page>

  •                         </notebook>

  •                 </sheet>

  •                 </form>

  •             </field>

  •         </record>

What I need, is to add a button to create the stock move from my view/module, so far I've tried adding `action_done` to the tree, but it doesn't work, so

Any ideas on how to achieve this?

It is actually a simplified `stock.move`

Avatar
Discard