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

Hi all, help me please!

I need to add a column in the sales field in which it will be possible to upload not just one image, but many. I made models where I set up one2many and many2one fields. But no matter how I register the field in the view, the column itself appears, but I can’t add anything there. Why and what do I need to write for this opportunity to appear?

Below I post my models and presentation.

Thanks in advance and have a nice day :)

model:

class ImagesList(models.Model):
_name = 'images.list'

img_id = fields.Many2one(string='Изображения', comodel_name='sale.order.line')
image_images = fields.Image(string='Изображение')



class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

image = fields.Image(string="Изображение", max_width=256, max_height=256)
img_ids = fields.One2many(string='Изображения', comodel_name='images.list', inverse_name='img_id')



my.mrp.sale.order.tree.inherit
sale.order
















I don’t know why the hml doesn’t drop

field name="image"
field name="img_ids" widget="one2many"



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

Hi,
First of all make sure you have granted access right for the user to create record in the newly added one2many model. Once this is done, ensure the one2many field is properly added in the form.

See the sample in the comment section.

Other than adding a one2many field, you can handle with a many2many field to ir.attachment model

Thanks

Ảnh đại diện
Huỷ bỏ

<field name="img_ids">
<field name="image_images"/>
</field>

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 15
5200
1
thg 12 21
4937
1
thg 12 19
10876
0
thg 3 15
3717
1
thg 8 24
1292