Missing _py_type in one2one model fields
1. Try run a module test in version 7.4: ``` ====================================================================== ERROR: test (test_scenario_abort_event_test.Test.test) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tryton/trytond/trytond/modules/farm/tests/test_scenario_abort_event_test.py", line 113, in test AbortEvent.validate_event([abort_female.id], config.context) File "/tryton/tryton/proteus/proteus/config.py", line 211, in __call__ result = rpc.result(meth(*c_args, **c_kwargs)) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tryton/tryton/trytond/trytond/model/modelview.py", line 775, in wrapper return func(cls, records, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tryton/tryton/trytond/trytond/model/workflow.py", line 37, in wrapper result = func(cls, filtered, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tryton/tryton/trytond/trytond/modules/farm/events/abort_event.py", line 60, in validate_event diagnosis_event.female_cycle = diagnosis_event.animal.current_cycle ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tryton/tryton/trytond/trytond/model/fields/one2one.py", line 60, in __set__ Field.__set__(self, inst, value) File "/tryton/tryton/trytond/trytond/model/fields/field.py", line 403, in __set__ value = self._py_type(value) ^^^^^^^^^^^^^^^^^^^^ TypeError: 'farm.animal.female_cycle' object is not iterable ``` 2. Source code, save data in one2one field: ``` for diagnosis_event in events: diagnosis_event.female_cycle = diagnosis_event.animal.current_cycle diagnosis_event.save() diagnosis_event.female_cycle.update_state(diagnosis_event) ``` 3. Example debuging scenario data: ``` >>> diagnosis_event.animal.current_cycle.id 1 >>> diagnosis_event.id 1 >>> diagnosis_event.female_cycle None >>> diagnosis_event.female_cycle = diagnosis_event.animal.current_cycle TypeError: 'farm.animal.group' object is not iterable ``` Since issue6460 add "Allow SQL expression as value of fields". I think in case one2one field, is missing _py_type attribute. In case apply next diff, the test return "OK" (succesfully). ``` diff --git a/trytond/trytond/model/fields/one2one.py b/trytond/trytond/model/fields/one2one.py index 9d7207a62a..72ed23add6 100644 --- a/trytond/trytond/model/fields/one2one.py +++ b/trytond/trytond/model/fields/one2one.py @@ -8,6 +8,8 @@ from trytond.pool import Pool class One2One(Many2Many): _type = 'one2one' + _py_type = None + _sql_type = 'INTEGER' def get(self, ids, model, name, values=None): ''' ```
issue