On Tue, May 16, 2017 at 12:49 PM, Sergi Almacellas Abellana <
[email protected]> wrote:
> El 16/05/17 a les 09:42, Khurram Shahzad ha escrit:
>
>> Hi all,
>>
>> I have added following field on the view:
>>
>> surgeries = fields.Function(fields.One2Many('gnuhealth.surgery',
>> None, 'Surgeries'), 'get_surgeries')
>>
>> The function 'get_surgeries' returns the list of surgeries as per
>> foreign key.
>>
>> The list of surgeries is displayed but when the user opens a surgery
>> record by double clicking on it, the record is not editable and all the
>> action buttons are disabled.
>>
>> Is there anyway to have this record opened in edit mode?
>>
>
> Function fields are readonly by default unless you provide a setter [1]
> for them. You should implement a setter that writes the changes to the
> source model.
>
> HIH
>
> [1] http://doc.tryton.org/4.4/trytond/doc/ref/models/fields.html
> ?highlight=setter#trytond.model.fields.Function.setter
>
Thank you Sergi. Its fine as long as I have to call write method of the
'Surgery' class from my setter method. But, what about other methods called
on click events of buttons on the Surgery form? Will I have to write
methods for calling them as well?
--
Regards,
Khurram.
--
You received this message because you are subscribed to the Google Groups
"tryton" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tryton/CAM3N3CwQbmUQosKtxVNupRxLVpuX3FDXJc0KZfEhQOqrn6beCw%40mail.gmail.com.