On 01-04-11 14:29, "Cédric Krier" <[email protected]>" wrote:

> It is a possibility but it will add a little overload to invoice
> creation/modification.

Just for the record: triggers saved my day!

Following xml excerpt will setup a trigger for when an invoice is opened:

<record model="ir.trigger" id="invoice_open_trigger">
  <field name="name">Open Invoice</field>
  <field name="model" search="[('model','=','account.invoice')]"/>
  <field name="on_write">True</field>
  <field name="condition">self.state == 'open'</field>
  <field name="action_model" search="[('model','=','account.invoice')]"/>
  <field name="action_function">trigger_callback</field>
</record>

this will call the method 'trigger_callback(ids, trigger_id)' when
the state is changed to 'open'


I'm not sure the 'model' and 'action_model' fields are best setup like
this, but it works, and I'm happy :-)



-- 
  ________________________________________________________________
  Paul Stevens                                      paul at nfg.nl
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands________________________________http://www.nfg.nl

-- 
[email protected] mailing list

Reply via email to