Skip to Content
Menu
This question has been flagged
1 Odpoveď
3078 Zobrazenia

Hello.

I have successfully created a custom module and added a new field called "room_number" to hr.employee kanban view so to everyone can see where in the building to find their colleague. The problem is, everyone except HR`s and admins are redirected to hr\.employees\.public where\ this\ field\ is\ not\ visible\.\ Next,\ I\ try\ to\ make\ this\ field\ visible\ to\ everyone\ by\ moving\ it\ to\ hr\.employee\.public:


from\ odoo\ import\ models,\ fields
class\ sep_hr_employee_abs\(models\.Model\):
\ \ \ \ \ ​_name\ =\ 'hr\.employee\.public'
\ \ \ \ \ ​_inherit\ =\ 'hr.employee.public'
​room_number = fields.Char(string='Room number')


<record id="sep_employee_kanban_view" model= "ir.ui.view"><field name="inherit_id"ref="hr.hr_kanban_view_employees"/><field name="model">hr.employee.publicfield><field name="arch"type="xml"><xpath expr="//kanban/templates/t/div/div" position="after"><field name="work_location_id"/>
xpath>
field>
record>

 

after that I have got the following error:

Error while validating view near:

                               
                               
                               
Avatar
Zrušiť
Autor

Ok, can anyone help me paste code here? :DD

I have tried by this manual and it is not working:

https://www.youtube.com/watch?v=nw3q0Cs1swg

Best Answer

Hi,

Remove the _name attribute from the inherited class and just keep inherit and see if it makes any difference.

class HrEmployeePublic(models.Model):
_inherit = 'hr.employee.public'


Thanks

Avatar
Zrušiť
Autor

no, it doesn`t help.
Here is the second try to insert the code in this forum:
<p>from odoo import models, fields</p>
<p><br></p>
<p>class sep_hr_employee_abs(models.Model):</p>
<p>&nbsp; &nbsp; _inherit = &apos;hr.employee.public&apos;</p>
<p>&nbsp; &nbsp; room_number = fields.Char(string=&apos;Room number&apos;)</p>

<div>&lt;openerp&gt;<br>&nbsp; &nbsp; &lt;data&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;record id=&quot;sep_employee_kanban_view&quot; model= &quot;ir.ui.view&quot;&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;inherit_id&quot; ref=&quot;hr.hr_kanban_view_employees&quot;/&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;field name=&quot;model&quot;&gt;hr.employee.public&lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;user_id&quot; position=&quot;after&quot;&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;field name=&quot;work_location_id&quot;/&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br>&nbsp; &nbsp; &lt;/data&gt;<br>&lt;/openerp&gt;</div>

<pre>Error while validating view near:
&lt;span t-if=&quot;record.job_title.raw_value&quot; class=&quot;o_kanban_record_subtitle&quot;&gt;
&lt;field name=&quot;job_title&quot;/&gt;
&lt;/span&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;field name=&quot;category_ids&quot; widget=&quot;many2many_tags&quot; options=&quot;{&apos;color_field&apos;: &apos;color&apos;}&quot; groups=&quot;hr.group_hr_manager&quot;/&gt;
&lt;ul&gt;

Field &quot;category_ids&quot; does not exist in model &quot;hr.employee.public&quot;

View error context:
{&apos;file&apos;: &apos;/mnt/extra-addons/sep_employee/sep_employee_view.xml&apos;,
&apos;line&apos;: 44,
&apos;name&apos;: &apos;hr.employee kanban&apos;,
&apos;view&apos;: ir.ui.view(431,),
&apos;view.model&apos;: &apos;hr.employee.public&apos;,
&apos;view.parent&apos;: ir.ui.view(369,),
&apos;xmlid&apos;: &apos;sep_employee_kanban_view&apos;}</pre>

Related Posts Replies Zobrazenia Aktivita
1
jan 22
8107
1
apr 24
868
2
aug 24
4871
2
okt 22
3355