On 01/04/11 15:51 +0200, Paul J Stevens wrote: > 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 :-)
It is the good way ;-) -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpw7CKXFPTWc.pgp
Description: PGP signature
