Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
4543 Lượt xem
I want to get the fields  (customer_site_name , customer_site_Address , city) of "sites" module
in my "saleorder" module.
how i can achieve it.

my modules are given below,

----------Site (Custom Module)---------------

class sites(models.Model):
    _name = 'sites.sites'
     customer_site_name = fields.Char('Site Name')
     customer_site_Address = fields.Char('Site Address')
     city = fields.Char()

-----------Sales Module ----------------

class SaleOrder(models.Model):
    _name = "sale.order"
    _inherit = ['mail.thread', 'ir.needaction_mixin']


please give sample code.
Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Sites and saleoder are not linked i just want to select the Sites things in saleorder tree grid like this,

Site A Name  (selection), Site A Address , Site B Name (selection)  , Site B Address , Link(text) 


when i select Site  Site A Name its address will show in Site A Address same will be for Site B and I will input the text in link

thats my senairo.


 

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

0

Fawad Mazhar

Le 15/05/2017 12:22

Sites and saleoder are not linked i just want to select the Sites things in saleorder tree grid like this,

Site A Name (selection), Site A Address , Site B Name (selection) , Site B Address , Link(text)

when i select Site Site A Name its address will show in Site A Address same will be for Site B and I will input the text in link

thats my senairo.

Câu trả lời hay nhất

Hi,

how 'Sites' and 'Sale Order' are linked? Would you like to have some reference from an order to sites? If so:

class SaleOrder(models.Model):
    _inherit = "sale.order"
     sites_id = fields.Many2one("sites.sites")
Then, if you want to show a field of Sites in an Order, use the 'related' attribute:
 customer_site_name = fields.Char(related="sites_id.customer_site_name")
Ảnh đại diện
Huỷ bỏ