Julio Tobar
Julio Tobar

Reputation: 17

How close a popup model with after saving in odoo 13

I have a problem when i want to close a popup model, only save the data but i want return to invoice.

I open this module from invoice but i want that only close after save not create a new invoice.

something help me please

my code xml

 <record id="create_autorizacion_form" model="ir.ui.view">
<field name="name">autorizacion.autorizacion.wizard</field>
<field name="model">autorizacion.autorizacion</field>
<field name="arch" type="xml">
    <form string="Autorización">
        <group >
            <field name="invoice_amount"/>
            <field name="new_balance"/>
            <field name="my_credit_limit"/>

        </group>
         <xpath  expr="//sheet" position="after">
        <footer>
            <button string="Confirm" name="create_autorization" class="btn-primary" special="save"/>
            <button string="Cancel" class="btn-secondary" special="cancel"/>
        </footer>
    </xpath>
    </form>
</field>

my code .py

class autorizacion(models.Model):
    _name="autorizacion.autorizacion"
    invoice_amount = fields.Float('Invoice Amount')
    new_balance = fields.Float('Total Balance')
    my_credit_limit = fields.Float('Partner Credit Limit')
    @api.model
    def create_autorization(self,vals):
       print("funciona")
       view =  {
        'context': self.env.context,
        'view_type': 'list',
        'view_mode': 'form',
        'res_model': 'account.move',
        'res_id': self.id,
        'view_id': False,
        'type': 'ir.actions.act_window',
        'nodestroy': False,
           'domain': '[]',
        'target': 'self',
    }
       return  view  

Upvotes: 0

Views: 1239

Answers (1)

imad
imad

Reputation: 132

you are trying to create a wizard so for module declaration you need juste to change

this : class class autorizacion(models.Model):

to this : class autorizacion(models.TransientModel) :

hope this will help you

Upvotes: 1

Related Questions