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

I have this module that allows to select the category of product that going to be used for this purchase, because we have a lot of products this a way to limit the search result,

but the problem is all the info related to order_id field are available after the product is selected, for example state, if we make state visible in the order line it value is there only after selecting a product, the same for my field category, is someone have an idea to fix this.

I am using odoo 11.0


from odoo import api, fields, models

class PurchaseOrder(models.Model):
_inherit = "purchase.order"

category = fields.Many2one('product.category',  )


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

category = fields.Many2one (related='order_id.category', string='Cat', readonly=True, store=True)

product_id = fields.Many2one('product.product', domain="['&', ('categ_id','=',category), ('purchase_ok', '=', True)]",
string='Product', change_default=True, required=True)

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 21
2626
0
thg 3 17
3560
3
thg 8 25
513
1
thg 7 25
426
1
thg 7 25
846