Check if the value of reference field is -1

Hi,

I was a common issue with reference field, specially with origin of account.move. When only the model is filled but not the record, tryton stores it as -1. Is there a way to validate a field before to save making the model and record required?

Thanks in advance!

Required works as you would expect http://hg.tryton.org/trytond/rev/a6ba95b555c3

I would expect that if I modify model I require to add a record, but at the moment I can only edit the model without the need to add a record.

I found a working example in sale_advance_payment/sale.py at f7ef932d3f274b988f4dedb8e727fc17b21b8e2f · tryton/sale_advance_payment · GitHub

I will try with it.

Only if the field is required.