Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
5722 Lượt xem


Having moved the code from odoo16 to odoo17, I ran into the following error.

raise ParseError(msg) from None  # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback
odoo.tools.convert.ParseError: while parsing /opt/odoo17/odoo/addons/gb_hr_payroll_community/views/res_config_settings_views.xml:11
Error while parsing or validating view:

Element '' cannot be located in parent view

View error context:
{'file': '/opt/odoo17/odoo/addons/gb_hr_payroll_community/views/res_config_settings_views.xml',
 'line': 2,
 'name': 'res.config.settings.view.form.inherit.hr.payroll',
 'view': ir.ui.view(3364,),
 'view.model': 'res.config.settings',
 'view.parent': ir.ui.view(176,),
 'xmlid': 'res_config_settings_view_form_payroll'}                   

What steps should I follow to fix this?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

In odoo 17 there is so many changes had occurred inside res config settings. So make clear that you are xpathing the correct location

example:

<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="model">res.config.settings</field>
        <field name="inherit_id"
ref="base_setup.res_config_settings_view_form"/>
        <field name="arch" type="xml">
<xpath expr="//setting[@id='mail_templates_setting']"
                   position="after">
                <setting id="company_share_product"
                         string="Inter Company features"
                         help="Automatically generate counterpart documents for orders/invoices between companies "
                         company_dependent="1">
                    <div class="content-group">
                        <div class="mt16">
                            <field name="company_share_product"/>
                            <label string="Common Product Catalog"
                                   for="company_share_product" class="o_light_label"/>
                        </div>
                    </div>
                </setting>

       </xpath>

</field>

</record>


Hope it helps

Ảnh đại diện
Huỷ bỏ
Tác giả

Now it showing

raise ParseError(msg) from None # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback
odoo.tools.convert.ParseError: while parsing /opt/odoo17/odoo/addons/gb_hr_payroll_community/views/res_config_settings_views.xml:11
Since 17.0, the "attrs" and "states" attributes are no longer used.
View: res.config.settings.view.form.inherit.hr.payroll in gb_hr_payroll_community/views/res_config_settings_views.xml

View error context:
{'name': 'invalid view'}

Code:

<h2 attrs="{'invisible': ['|', '|', ('module_l10n_fr_hr_payroll', '=', True), ('module_l10n_be_hr_payroll', '=', True), ('module_l10n_in_hr_payroll', '=', True)]}">Payroll</h2>

Câu trả lời hay nhất

Try this

Ảnh đại diện
Huỷ bỏ
Tác giả

Now it shows new error.

raise ParseError(msg) from None # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback
odoo.tools.convert.ParseError: while parsing /opt/odoo17/odoo/addons/gb_hr_payroll_community/views/res_config_settings_views.xml:11
Invalid Expression while parsing xpath "//setting[@id='display_payslip]"

View error context:
'-no context-'

Tác giả

Sorry, later I just added the hr_payroll in depends. Now it shows new error.

You try to install module 'gb_hr_payroll_community' that depends on module 'hr_payroll'.
But the latter module is not available in your system.

Hello Cruz

//setting[@id='display_payslip]" replace with this --> //setting[@id='display_payslip']"

--You have not used ' in above code after payslip

Do step 1:- install hr_payroll first and then install your module

​Step 2 :- Install your module through terminal using -i 'Your module name' if you doing it locally

Thanks

Tác giả

Hi Jaiswal,
I couldn't find hr_payroll module in odoo17.

hi Cruz
because payroll is not available in community version I have written above code for odoo17 enterprise version

You can prefer above Cybrosys Techno Solutions Pvt.Ltd's Solution

Thanks

Tác giả

Ok Jaiswal. Thank you for spending your valuable time.