Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
22310 Weergaven

I am using Odoo Online and trying to install a custom module that I have built. I installed the Base import module to allow for installing custom modules on an Odoo Online instance:

https://apps.openerp.com/apps/modules/online/base_import_module/

I then created a simple module consisting of the following:

    mymodule/

         __init__.py

        __manifeset__.py

        product.py

        views/

            product_product_tree.xml

Here is the content of the files:

__init__.py

    from . import product

__manifest__.py

    {  'name': "My Module", 'version': '1.0', 'depends': ['stock', 'sale', 'contacts', 'purchase'], 'description': """ Add custom functionality.

      """, # data files always loaded at installation 'data': [ 'views/product_product_tree.xml', ], }

product.py

    from odoo import models, fields, api class ProductProduct(models.Model):

      _inherit = 'product.product' x_reserved_qty = fields.Float(string='Reserved', readonly=True)

views/product_product_tree.xml

    <odoo> <data> <record model="ir.ui.view" id="mymodule.product_product_tree"> <field name="name">x_product.product.tree</field> <field name="model">product.product</field> <field name="priority" eval="16"/> <field name="inherit_id" ref="product.product_product_tree_view"/> <field name="arch" type="xml"> <xpath expr="//tree" position="inside"> <field name="x_reserved_qty"/> </xpath> </field> </record> </data> </odoo>

I then zip up the file and import it via the Base Import Module. Doing so results in an error and the module does not install. The error is occurring because the `x_reserved_qty` field does not exist on the model even though I have defined it in `product.py`. It seems that the python portion of the module is never getting executed.

I can confirm this by commenting out the `<field name="x_reserved_qty"/>` line, and reimporting the module. This time it imports successfully, but when I browse to `Settings > Technical > Database Structure > Fields`, I do not see my new field listed anywhere.

Does anybody know if python files are supported for custom modules imported via this Base Import Module method? The module description says:

> This module allows authorized users to import a custom data module> (.xml files and static assests) for customization purpose.

It specifically mentions .xml and static assets, but not python files. So, I'm just wondering if I'm doing something wrong in my python files that is causing this not to work, or if it's actually designed not to support python files in modules.

Avatar
Annuleer

hello, where can I get that "Base Import Module"? it seems that the link is not working anymore

Beste antwoord

This Module is not used for import Odoo Module, Is use for import Data from xml file such as Asset , Product , and Partner Data

Avatar
Annuleer
Beste antwoord

Hi Michael,

To import custom module using import, you need to install "Base Import Module" (technical name: base_import_module), which is odoo's base functionality.

For importing custom module, you can not import python related code. If you have added some python related code then it will reject. You can only import some frontend side features like static files, CSV files (access rights). 

If you want to import your custom module then i suggest you to import file as CSV for defined fields, views etc and import in ir.model.fields or ir.ui.view

If you have added some big changes in python code or override base code then it's not possible to import, because odoo online take case about security parts


I hope this will helpful for you.

Thanks

Haresh Kansara

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
3
mei 25
2850
1
jul. 24
1466
2
feb. 25
3418
0
jun. 21
1957
1
aug. 24
2918