← Back to team overview

openerp-community team mailing list archive

Re: Workflow: trigger_model and trigger_expr_id

 

Le 02/04/2011 20:55, Nhomar Hernández a écrit :
In lines,

2011/4/1 Thibaut DIRLIK <thibaut.dirlik@xxxxxxxxx
<mailto:thibaut.dirlik@xxxxxxxxx>>

    Good morning,

    Question Of The Day:

    I've got a workflow for my rent orders, and I would like to confirm
    a transition if all invoices are removed/paid/anything.

    I did this:

    <record id="ongoing_to_confirmed" model="workflow.transition">
    <field name="act_from" ref="state_ongoing" />
    <field name="act_to" ref="state_confirmed" />
    <field name="condition">not test_have_invoices()</field>
    <field name="trigger_model">account.invoice</field>
    <field name="trigger_expr_id">get_orders_invoices_ids()</field>
    </record>

    It seems the work, my method get_orders_invoices_ids() returns the
    invoices IDs associated to my orders, test_have_invoices() returns
    True if the order have nay invoices attached to it.

    My problem is that the test is called only once. Later, when I
    edit/remove my invoice, nothing is called. So, I would like to be
    sure I understood what trigger_model and trigger_expr_id does.


Every single time you excecute a workflow an instance is created and the
state of this instance change, for this reason if you need that the
trigger in this state should be exetude again you need to add every
single state you need it is excecuted add your trigger....

I hope it can help you.


I don't understand what you mean. Could you explain a bit more, and give me some examples ? Thanks in advance,

--
Thibaut



References