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

I am trying to use my own custom fields in the address layout generation of odoo like this:


However I get the error "The layout contains an invalid format key"


What can I do in order to use my own custom fields?

I have inherited the res.partner and added the custom field with the name "firm1" so it should work?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

You can inherit res.partner and super this function and pass your new fields in res.partner

class ResPartner(models.Model):
_inherit = "res.partner"

@api.model
def _formatting_address_fields(self):
"""Returns the list of address fields usable to format addresses."""
return super(ResPartner, self)._formatting_address_fields() + ['new_field1']


Hope this will help you

Thanks

Ảnh đại diện
Huỷ bỏ
Tác giả

Thank you very much

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 24
1740
4
thg 3 25
50902
1
thg 2 23
2299
1
thg 5 22
3030
0
thg 12 19
3650