콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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)

아바타
취소
관련 게시물 답글 화면 활동
1
3월 21
2642
0
3월 17
3591
3
8월 25
536
1
7월 25
457
1
7월 25
866