跳至內容
選單
此問題已被標幟
1725 瀏覽次數

Now I have records like fields 1 & 2,

and want record auto fill like field3

field1field2field3
d111
d122-1
d122-2
d133
d211-1
d211-2
d222
I try with count function in modle, 

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
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
6月 25
15546
3
4月 25
5801
2
7月 24
3842
1
1月 24
1903
1
7月 22
2339