Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1777 Lượt xem

On my sale.line, I've added a Many2one-field, referencing to an other (custom) model.
My goal is to get the field in orderlines translated.


Custom model

class Color(models.Model):
_name = 'color.color'
_description = 'Color'
_rec_name = 'name'

code = fields.Char('Code')
name = fields.Char('Color', translate=True)

Added field in an inherited sale_line.py

color_id = fields.Many2one('color.color', string='Color')

Inherited view of sale.view_order_form

<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom']" position="after">
<field name="color_id" context="{'lang': 'de_DE'}"/>
xpath>

My issue

The dropdown is shown in user's language, and not in de_DE

(I really want to relate the context to partner's language, but that's no problem when this issue is solved).


I've also tried the following, but this didn't seem to work either.

color_id = fields.Many2one('color.color', context="{'lang': 'de_DE'}")




Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 23
14990
0
thg 1 21
2227
2
thg 8 18
3788
0
thg 3 15
4981
3
thg 5 24
7230