I want to install my custom module product_print_zpl_barcode
, but when I press the button install it shows this error:
ParseError: "Invalid view definition
D\xe9tails de l'erreur :
Mod\xe8le non trouv\xe9 : product.print.zpl.barcode
Contexte de l'erreur :
Vue `product_print_zpl_barcode.form`
[view_id: 847, xml_id: n/a, model: product.print.zpl.barcode, parent_id: n/a]
None" while parsing [...]/openerp/addons/product_print_zpl_barcode/views/product_print_zpl_barcode_view.xml:5, near
product_print_zpl_barcode_view.xml
<record id="product_print_zpl_barcode_form" model="ir.ui.view">
<field name="name">product_print_zpl_barcode.form</field>
<field name="model">product.print.zpl.barcode</field>
<field name="arch" type="xml">
<form string="Generate and Print Product Barcode">
<group name="step1" string="Configuration">
<field name="state" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="product_id"/>
<field name="product_name" attrs="{'readonly': [('state', '=', 'step2')]}"/>
<field name="pricelist_id" attrs="{'readonly': [('state', '=', 'step2')]}"/>
<field name="price_uom"/>
<field name="label_size" attrs="{'readonly': [('state', '=', 'step2')]}"/>
<field name="nomenclature_id" attrs="{'readonly': [('state', '=', 'step2')]}"/>
<field name="rule_id"/>
<field name="barcode_type"/>
<field name="barcode"/>
<field name="copies" attrs="{'readonly': [('state', '=', 'step2')]}"/>
</group>
<group string="Enter Quantity" attrs="{'invisible': [('barcode_type', '=', 'product')]}">
<div name="qty_uom">
<field name="quantity" attrs="{'readonly': [('state', '=', 'step2')]}" class="oe_inline"/>
<field name="uom_id" class="oe_inline"/>
</div>
</group>
<group name="step2" states="step2" string="Label">
<field name="price"/>
<field name="zpl_file" filename="zpl_filename"/>
<field name="zpl_filename" invisible="1"/>
<field name="zpl_printer_id" required="1"/>
</group>
<footer>
<button name="generate" type="object" string="Generate Label" class="btn-primary" states="step1"/>
<button special="cancel" string="Cancel" class="oe_link" states="step1"/>
<button name="print_zpl" type="object" string="Print" class="btn-primary" states="step2"/>
<button name="print_zpl" type="object" string="Print and New" class="btn-primary" context="{'print_and_new': True}" attrs="{'invisible': ['|', ('state', '!=', 'step2'), ('barcode_type', '=', 'product')]}"/>
<button special="cancel" string="Close" class="oe_link" states="step2"/>
</footer>
</form>
</field>
</record>
<record id="product_print_zpl_barcode_action" model="ir.actions.act_window">
<field name="name">Generate Barcode</field>
<field name="res_model">product.print.zpl.barcode</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
I want to create a new model product.print.zpl.barcode
but Odoo doesn't recognize the new model even though the action is created.
Here is the code of
So make sure you are adding the model in the right way. You must take into account
Include this in the /your_module/__init__.py
import models
Include this in the /your_module/models/__init__.py
import model_name
Include your model in the /your_module/models/model_name.py
file:
from openerp import models, fields
class YourModel(models.Model):
_name = 'a.model.name'
field1 = fields.Char()
To reload the python files you need to restart the server
--update=your_module
. You can make this update by pressing the Update button on the module form.Note: Take that if you inherit from the class models.TransientModel
the data of your table is going to be erased from time to time. The common use is on wizards. If you want a persistent model you need to inherit from models.Model