콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
11 답글
8841 화면

Hi everyone,

I am trying to create a sub-menu to Payroll Modules. Tried so many way but i cant make it.

I found this code in forum but it is not working.

<menuitem id="menu_test" parent="hr_payroll.menu_hr_payroll_root" name="Test Module Parent"/>
<menuitem id="menu_test_child" parent="menu_test" name="My Menu" action="action_view_hr_module_reports_form"/>
Employee Payslips
Payslips Batches
Configuration
아바타
취소
베스트 답변

Hello

The issue is you didn't define any action in menuitem..iN ODOO10 you have to assign action in menuitem.


Thanks

아바타
취소

he already given the action for the menu

베스트 답변

Hi,

The code you have given to create the menu is correct. I think you may didn't have defined the action for the menu as well as corresponding views on clicking the menu. If you not defined the action "action_view_hr_module_reports_form" and the view, please do it , then you can see the menu.

Thanks

아바타
취소
작성자 베스트 답변

Defined like that, but still gives me an error "External ID not found..."


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

            <field name="name">hr_module.reports.tree</field>

            <field name="model">hr_module.reports</field>

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

                <tree string="Payslips Batches">

                    <field name="name"/>

                    <field name="date_start"/>

                    <field name="credit_note"/>

                    <field name="state"/>

                </tree>

            </field>

        </record>

        

        <record id="action_view_hr_module_reports_form" model="ir.actions.act_window">

            <field name="name">Employee Payslips</field>

            <field name="res_model">hr_module.reports</field>

            <field name="view_type">form</field>

            <field name="view_id" ref="view_hr_module_reports_tree"/>

        </record>

아바타
취소

Check that you mention the inherited module name in your manifest file.

작성자

'depends': [

'base',

'hr',

'hr_contract',

'hr_payroll',

],

here is my _manifest_.py

작성자

ParseError: "External ID not found in the system: hr_module.action_view_hr_module_reports_form" while parsing /home/dev1/odoo-10.0/custom_addons/hr_module/views/payroll_payslips_view.xml:5, near

<menuitem id="menu_test_child" parent="menu_test" name="My Menu" action="action_view_hr_module_reports_form"/> gives me this error

try to change to tree instead of form,

<field name="view_type">tree</field>

and did you have defined the model , hr_module.reports ?

작성자

yes in my module.py defined like

class hr_payroll_reports(models.Model):

name = 'hr_module.reports'

_description = 'Reports'

작성자

here is my full code,

<data>

<menuitem id="menu_test" parent="hr_payroll.menu_hr_payroll_root" name="Test Module Parent"/>

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

<field name="name">hr_module.reports.tree</field>

<field name="model">hr_module.reports</field>

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

<tree string="Payslips Batches">

<field name="name"/>

<field name="date_start"/>

<field name="credit_note"/>

</tree>

</field>

</record>

<record id="action_view_hr_module_reports_form" model="ir.actions.act_window">

<field name="name">Employee Payslips</field>

<field name="res_model">hr_module.reports</field>

<field name="view_type">tree</field>

<field name="view_id" ref="view_hr_module_reports_tree"/>

</record>

<menuitem id="menu_test_child" parent="menu_test" name="My Menu" action="action_view_hr_module_reports_form"/>

</data>

models.py

class hr_payroll_reports(models.Model):

name = 'hr_module.reports'

_description = 'Reports'

name = fields.Char(required=True, readonly=True, states={'draft': [('readonly', False)]})

date_start = fields.Date(string='Date From', required=True, readonly=True)

credit_note = fields.Boolean(string='Credit Note', readonly=True,

states={'draft': [('readonly', False)]},

help="If its checked, indicates that all payslips generated from here are refund payslips.")

and gives me this error

Model not found: hr_module.reports

Error context:

View `hr_module.reports.tree`

[view_id: 1114, xml_id: n/a, model: hr_module.reports, parent_id: n/a]

None" while parsing /home/dev1/odoo-10.0/custom_addons/hr_module/views/payroll_payslips_view.xml:6, near

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

<field name="name">hr_module.reports.tree</field>

<field name="model">hr_module.reports</field>

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

<tree string="Payslips Batches">

<field name="name"/>

<field name="date_start"/>

<field name="credit_note"/>

</tree>

</field>

</record>

py file mentioned in init ?

작성자

yes of course

작성자

I found the solution, my mistake is class name hr_payroll_reports should be like HrModuleReports, i think in odoo has some method for class name and it is seperating capital letters than put dot between letters. So odoo find and use methods something like that.

관련 게시물 답글 화면 활동
0
1월 17
4052
0
3월 20
2833
4
11월 19
5790
1
8월 19
4875
2
7월 25
4782