Skip to Content
Menu
This question has been flagged
2 Replies
4064 Views

    # -*- coding: utf-8 -*-
    from odoo import models, fields, api


    class StudentDetails(models.TransientModel):
        _name = 'wizto.form'

        students_id = fields.Many2one('student.student', string='Student')
        cust_order_no = fields.Integer(string='Customer Order No.')
        remarks_id = fields.Char(string='Remarks Given')

    #--------------------------------------------------------------
    #Code for wizard
    #--------------------------------------------------------------

    <?xml version="1.0" encoding="utf-8"?>
    <odoo>

        <!--Create a Wizard and Call it in Button Click-->
         <record id="wizto_form_form" model="ir.ui.view">
             <field name="name">wizto.form.wizard</field>
             <field name="model">wizto.form</field>
             <field name="arch" type="xml">
                <form string="Wizard to Form">
                    <group>
                        <field name="students_id"/>
                        <field name="cust_order_no"/>
                        <field name="remarks_id"/>
                    </group>
                    <footer>
                        <button string="Cancel" class="btn-secondary" special="cancel"/>
                    </footer>
                </form>
             </field>
         </record>
   
        <record id="wizto_form_wizard" model="ir.actions.act_window">
            <field name="name">Wizard to Form</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">wizto.form</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
            <field name="view_id" ref="wizto_form_form"/>
            <field name="target">new</field>
        </record>

    </odoo>



Avatar
Discard
Best Answer

Hi, you can follow following link for this:

https://youtu.be/oMnHpHH54QU

Thanks

Avatar
Discard
Best Answer

Hi,

In this case, you need to create an action for the wizard button, so you need to add a button in the wizard to view

<button string="Action" class="btn-primary" name='action_wizard_button/>
<button string="Cancel" class="btn-secondary" special="cancel"/>

n the wizard Python file, you need to add the functions

  class StudentDetails(models.TransientModel):
        _name = 'wizto.form'

        students_id = fields.Many2one('student.student', string=' Student')
        cust_order_no = fields.Integer(string='Customer Order No.')
        remarks_id = fields.Char(string='Remarks Given')

def action_wizard_button(self)
//you can write your own condition
if you need to create/write the record you can search or browse the r
record and you can add your own codes to these functions
eg: if you need to add students and remarks details in any other model you can use the code

like self.env['model.name'].sudo().create/write({
'field': self.students_id
//you can add any methods
})

Hope it helps

Avatar
Discard
Related Posts Replies Views Activity
2
Sep 20
5634
1
Sep 19
6051
3
Sep 23
2920
2
Sep 22
3638
2
Sep 22
3978