Skip to Content
Menu
This question has been flagged
1 Reply
4284 Views

    i have added monitoring of complaints, in this i have two users one is proffesor and another one is student

if the profeesor enter studentname and reason then how only that student can see the form or that reason?

then he need to give explanation for that then how it sends to proffesor ,  can anyone please give me solutions. 

     student = fields.Many2one('op.student',string="Student:",required=True)
     reason = fields.Text('Reason:', required=True)

    explanation = fields.Text('Explanation by Student')
    attachments = fields.Many2many('ir.attachment', attachment=True, string="Add attachment")
   action_ids = fields.Many2one('monitoring.actions',string="Action")

    state = fields.Selection(string="Status",selection=[('draft','Draft'),('waiting_explanation','Waiting Explanation'),('waiting_action','Waiting Action'),('action_validated','Action Validated')], default="draft")

@api.multi
def waiting_explanation(self):
self.state = "waiting_explanation"

@api.multi
def waiting_action(self):
self.state = "waiting_action"
@api.multi
def action_validated(self):
self.state = "action_validated"                                                         this is my python code.


<header>
<button name="waiting_explanation" string="Waiting Explanation" class="oe_highlight" states="draft" type="object" />

<button name="waiting_action" string="Waiting Action" class="oe_highlight" states="waiting_explanation" type="object" />

<button name="action_validated" string="Action Validated" class="oe_highlight" states="waiting_action" type="object" />


<field name="state" widget="statusbar" statusbar_visible="draft,waiting_explanation,waiting_action,action_validated"/>
</header>

<sheet>
<group>
<field name="student"/>
<field name="reason"/>
</group>
<group>
<field name="explanation" attrs="{'invisible': [('state', 'in', ['draft'])],'required': [('state', 'in', ['waiting_explanation','waiting_action','action_validated'])]}" />
<field name="attachments" widget="many2many_binary" attrs="{'invisible': [('state', 'in', ['draft'])],'visible': [('state', 'in', ['waiting_explanation','waiting_action','action_validated'])]}" />
</group>
<group>
<field name="action_ids" attrs="{'invisible': [('state', 'in', ['draft','waiting_explanation'])],'required': [('state', 'in', ['waiting_action','action_validated'])]}"/>
</group>
</sheet>       this is my xml code.


Avatar
Discard
Best Answer

Hi Srikanth,

I don't know what you expect, But if you want to hide a field based on Users, You can assign that users to separate group and following link will help you to hide fields based on Users

https://www.odoo.com/forum/help-1/question/group-wise-field-permission-read-write-152570#answer-152598

If you want to hide a record based on Users, refer following link

https://www.odoo.com/forum/help-1/question/how-to-add-record-rule-for-page-structure-152509#answer-152602

Thanks.

Avatar
Discard