This question has been flagged
1 Reply
3168 Views

Hello. Here again, with another of my never-answer problems >_<

I have a form with a boolean flag, set to compute @api.depends(...) on another o2m field. This field has tree with several buttons, all of them change the state of the record changing the state of the flag of the main form.

In the code, the compute function is called and the values updated, but the form is not updated. If i perform a xmlrpc or js query the form values are updated, but not in the view.

mymodule.py

    b_validate_tick = fields.Boolean(string="...", compute="_compute_validate_tick", store=True)

    invoice_ids = fields.Many2many(comodel_name='account.invoice', string="...")

    @api.depends('invoice_ids', 'invoice_ids.state')

    def _compute_validate_tick(self):

        print "_compute_validate_tick", self.invoice_ids.ids

        for reg in self:

            #logic here mymodule.xml

<header><field name="b_validate_tick" invisible="1"/></header>

<field name="invoice_ids" colspan="4" readonly="1">

    <tree colors="..." string="..." default_order="...">

        <button name="invoice_open" states="draft" string="Validate" class="oe_highlight" groups="base.group_user"/>

        <button name="cancel_and_draft" states="open" string="Quitar Validacion" type="object" groups="base.group_no_one"/>

        <button name="clean_and_unlink" states="draft" string="Borrar" type="object" groups="base.group_user"/>

    </tree>

</field>

Any solutions?

Avatar
Discard
Author Best Answer

Auto answer. It needs options="{'reload_on_button': True}" to force the reload of the view after button action is done.

Avatar
Discard