Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
3775 Vizualizări

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.



Imagine profil
Abandonează
Cel mai bun răspuns

If you find answer for this means please post here

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
oct. 19
6549
1
mai 19
5547
1
mar. 18
11392
3
mai 17
11144
2
iul. 25
4290