Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
3743 Weergaven

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.



Avatar
Annuleer
Beste antwoord

If you find answer for this means please post here

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
okt. 19
6506
1
mei 19
5497
1
mrt. 18
11338
3
mei 17
11119
2
jul. 25
4236