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

Hello all,


i have an own module but i have a Problem with inherit the view base.view_partner_form from res.partner and adding a new field in an environment where a another company used odoo and manipulate res.partner too.

I have installed odoo17 on my local machine and the inheritance worked fine without problems.

But if i try to use the same module to the environment where share to work with another company they manipulate/use the res.partner too, it doesn't works.

By installing the module there are no error in the log file, but if i wanna open a contact it shows me the error message: Error: child.attrs is undefined.

Then i go back to the apps to update my module, i get the error message: The Field `sale_warn_msg` doesn't exist. The view was shown in the error message is my view.

The environment where the other company works too is odoo13.


I do not understand why it doesn't works. Is it possible that the other company manipulate a file (maybe renamed class or module name or other things) to get this exception?

I don't know where i should to look for and what i should to look for to solve this problem.


In the following my Python and Xml files.

__manifest__.py

{

    'name': 'Heinzmann',

    'category': 'Uncategorized',

    'version': '0.1',

    'license': 'Other proprietary',

    'depends': ['base'],

    'data': [

        'views/res_partner.xml',

    ],

}

res_partner.xml

<?xml version="1.0" encoding="utf-8"?>

<odoo>

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

        <field name="name">res.partner.form</field>

        <field name="model">res.partner</field>

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

        <field name="inherit_id" ref="base.view_partner_form"/>

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

            <xpath expr="//field[@name='category_id']" position="after">

                Anzahl neuer Kundenkarten:<field name="x_customer_card_selection"/>

            </xpath>

        </field>

    </record>

</odoo>

res_partner.py

class ResPartner(models.Model):

    _inherit = 'res.partner'


    #x_auto_invoice_at_end_of_month = fields.Boolean()


    x_customer_card_selection = fields.Selection(

        [('1', 1),('2', 2),('3',3)]

        ,'Anzahl neuer Kundenkarten',default=''

        )



Ảnh đại diện
Huỷ bỏ

Hi Oliver,

Have you tried to give an priority to your custom/inherited XML view?
you can try below one if not used.

<field name="priority" eval="999"/>

Thanks & Regards,
Sunny Sheth

Tác giả

> Sunny Sheth
Yes i have set the priority to 1. And i added _name = 'res.partner' in the python file. Nothing works.

Hi Oliver,

set priority higher not "1" to that view as i mentioned if not.

and add _inherit = 'res.partner'

Thanks

Tác giả

Setting the priority to 999 doesn't work too. And _inherit = 'res.partner' already exists.

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

Whenever you are adding new field in object like res.partner and res.company you need to install that module or increase manifest version simple upgrade module wan't work. 

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

I don't think so because in the clear installation of odoo 17 it works fine without reinstall the module res.partner. Or behaves odoo 13 different?

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

Hi Oliver,

Do you mind to test to upgrade "base" and "sale" module?

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

Hello Andry,
updating base and sale module doesn't help.

Thanks for confirming.
I believe the field is there (you can double check the database), so it left with views sequence, seems like you need to trace whether there is any Studio customized.
You can start to trace the "inherit views", try to delete some default views and upgrade the modules related again to create the deleted default views and align the sequences.

I wish I can help further.

Tác giả

Thank you for your answer. I try to analyse the views.

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

Hello Oliver,

To add a new field to the res.partner model, which is part of the base module, you can't do it directly. First, you need to create a custom module, then add the field to that module. After creating and adding the field, you can install the module, and it should work properly. Your code looks valid; just try creating a new module and include your code there.

Thanks.

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

Hello Mathesh,
i have done it like your description. In the clear installation of odoo 17 it works fine but not in the other environment.

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

sale_warn_msg is actually implemented in sale module (as the name suggests and I did check the code). Though it is displayed in the base.view_partner_form, the base module has no idea about it.

So you need to add sale to your dependency I guess

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

Hello Exon Odoo,
i don't think so because in the clear installation of odoo 17 it works fine but not in the other environment. But i have try your suggestion but it doesn't works.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 8 24
1310
2
thg 11 24
2188
3
thg 10 23
14052
2
thg 2 23
1863
1
thg 12 22
1371