跳至内容
菜单
此问题已终结
1 回复
3541 查看

I have 2 models, 'cus.enq' and 'cus.act'. The models for customer enquiries and customer activities. Some fields in both models are common. 

#cus.enq

class CustomerEnquiries(models.Model):

    _name = 'cus.enq'


    task_ids = fields.One2many('cus.act', 'enquiries_id')

    partner_id = fields.Many2one('res.partner', string="Customer Name")

    source_id = fields.Many2one('utm.source', string="Source")

    email = fields.Char()

    partner_phone = fields.Char(string="Phone")

    partner_mobile = fields.Char(string="Mobile")

Here i have a one2many field that is related to 'cus.act' model.

#cus.act

class CustomerActivities(models.Model):

    _name = 'cus.act'

    

    action_id = fields.Many2one('lmc.action', required=True, string="Action")

    create_uid = fields.Many2one('res.users', string="Created By", readonly=True)

    source_id = fields.Many2one('utm.source', string="Source")

    partner_id = fields.Many2one('res.partner', string="Client")

    partner_phone = fields.Char(string="Phone")

    user_id = fields.Many2one('res.users', string="Responsible")

    partner_mobile = fields.Char(string="Mobile")

    email = fields.Char()

    enquiries_id = fields.Many2one('lmc.enq')

#xml

<notebook>

    <page string="Related Tasks">
<group>
<field name="task_ids" nolabel="1">

      <tree editable="bottom"

    <field name="create_uid"/>

      <field name="action_id"/>

      <field name="user_id"/>
</tree>

      </field>

      </group>

        </page>

 </notebook>

#notes

in xml the page is one2many of cus.enq module.My question is i want to create the record of models 'cus.act' from the model 'cus.enq'. How it is possible. I want to create the create when the save button is pressed.I know the create method is used here.Please help me how it is used here.Thanks in advance.



形象
丢弃
最佳答案

If you find answer for this means please post here

形象
丢弃
相关帖文 回复 查看 活动
2
10月 19
6270
1
5月 19
5278
1
3月 18
11002
3
5月 17
10932
2
12月 24
7089