Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
149 มุมมอง

I want to add translate=True to the company field 

city = fields.Char(compute='_compute_address', inverse='_inverse_city')

so I inherited the model, altered the field to:

city = fields.Char(translate=True)

and now it properly shows the country code next to the field:


But unfortunately it ignores all editing when I click on it. Doesn't matter what I write, it's ignored and keeps resetting to Chicago for both languages that I installed



Probably thats connected to the fact that its computed and has an inverse field. Is it still somehow possible to achieve my goal? I want the user to be able to enter the city name in his own language for example the city Köln in german would be Cologne in english. 



I had the same issue for the field:

company_registry = fields.Char(related='partner_id.company_registry', string="Company ID", readonly=False)

but all I had to do was altering both fields company_registry in res_company and company_registry in res_partner to translate=True and it works now. This approch doesn't seem to work for inverse fields.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Alexander: Try adding force_save="1"​for the field in the view XML.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ม.ค. 19
4161
0
ส.ค. 25
207
1
พ.ค. 25
886
2
ก.ย. 24
1685
2
มี.ค. 24
2725