Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
4565 มุมมอง

Hi everyone,

i would to get value from Many2one field, and put it in other field readonly.

here is my code :

code_BL=fields.Many2one("stock.picking",string='BL code',required=True,)
partner=fields.Many2one("res.partner")
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello CZN SARL

You can used field onchamnge or set readonly from xml or py file for this fields.

Please find code in comment.

I hope This will help you.

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

อวตาร
ละทิ้ง

For example.

sale_id = field.Many2one('sale.order')

partner_id = field.Many2one('res.partner', readonly="True")

def sale_id_onchange(self):
self.partner_id = sale_id.partner_id.id

คำตอบที่ดีที่สุด

Hi, 

You can use 'related' attribute to achieve this. 
For example to get mobile number from partner 

mobile_number = fields.Char(string='Mobile No,
                               related='partner_id.mobile')



อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.พ. 25
5970
1
ธ.ค. 24
1494
1
พ.ย. 22
16066
3
ส.ค. 22
13120
0
ก.ค. 22
836