Now I have records like fields 1 & 2,
and want record auto fill like field3
field1 | field2 | field3 |
d1 | 1 | 1 |
d1 | 2 | 2-1 |
d1 | 2 | 2-2 |
d1 | 3 | 3 |
d2 | 1 | 1-1 |
d2 | 1 | 1-2 |
d2 | 2 | 2 |
but meet some difficulty
Here is my try
@api.depends("field1", "field2")
def _compute_field3(self):
for rec in self:
if self.count(rec.field2) > 1:
rec.field3 = rec.field2 + "-" + #the subscript
# Maybe somthing like this
else:
rec.field3 = rec.field2