Skip to Content
Menu
This question has been flagged
1893 Views

Dear All,

      I' a newbie for ODOO. I'm trying to develop my knowledge. Then I make a personal project name "My Recruitment". 

I'v inherited model "hr.applicant" and add new field name "x_place". 

Model "place" has many2many "res.users". 


 

class MYRecruitment(models.Model):

    x_place = fields.Many2one('my.recruitment.place', "Place")

class MyRecruitmentPlace(models.Model):

    _name = "my.recruitment.place"

    _description = "Place of Recruitment"

    _sql_constraints = [

        ('name_uniq', 'unique (name)', 'The name of the place of Recruitment must be unique!')

    ]

    name = fields.Char("Place", required=True, translate=True)

    user_ids = fields.Many2many('res.users', string="Owners")

    sequence = fields.Integer("Sequence", default=1, help="Gives the sequence order when displaying a list of place.")

   

templates:

<record model="ir.ui.view" id="hr_kanban_view_applicant_my_extend">

        <field name="name">Hr Applicants kanban Extend</field>

        <field name="model">hr.applicant</field>

        <field name="inherit_id" ref="hr_recruitment.hr_kanban_view_applicant"/>

        <field name="arch" type="xml">

            <xpath expr="//kanban" position="attributes">

                <attribute name="quick_create">false</attribute>

                <attribute name="default_order">create_date desc</attribute>

            </xpath>

        </field>

    </record>


Example Data:

Place:

----------------------------------------

Place     User

---------------------------------------

Place01   user1,user2,user3

Place02   user2

Place03   user3

----------------------------------------



Applicant:

----------------------------------------

Name       Place 

----------------------------------------

App1       Place01

App2       Place01

App3       Place02

App4       Place03

-----------------------------------------



I'd like the odoo show the record with the following scenario:

When user login

user1 login:   

    show  record only     App1

user2 login:

    show  record only     App1,App2, App3

user3 login :

     Show record only     App1,App4



Appreciate for every response. 

Avatar
Discard

Hope this will helps you, Show records on TreeView that are related to Active User

https://goo.gl/hv4WAi

Author

Thank you Sehrish.