跳至内容
Odoo 菜单
  • 登录
  • 免费试用
  • 应用程序
    财务
    • 会计
    • 发票
    • 费用
    • 电子表格 (BI)
    • 文档
    • 电子签名
    销售
    • 客户关系管理
    • 销售
    • POS 销售点管理-零售
    • POS 销售点管理 - 餐厅
    • 订阅
    • 租赁
    网站
    • 网站设计
    • 电子商务
    • 博客
    • 论坛
    • 在线客服
    • 在线学习
    供应链
    • 库存
    • 制造
    • 产品生命周期
    • 采购
    • 维护保养
    • 品控
    人力资源
    • 员工
    • 招聘
    • 休假
    • 评价
    • 内部推荐
    • 车队
    营销
    • 社媒营销
    • 电邮营销
    • 短信营销
    • 近期活动
    • 营销自动化
    • 网上调查
    服务
    • 项目管理
    • 工时单
    • 现场服务
    • 服务台
    • 排期
    • 预约
    生产力
    • 讨论
    • 批核
    • IoT物联网
    • VoIP
    • 知识库
    • WhatsApp
    第三方应用软件 Odoo 定制 Odoo云端平台
  • 行业
    零售
    • 书店
    • 服装店
    • 家具店
    • 食品杂货店
    • 五金店
    • 玩具店
    餐饮与酒店服务
    • 酒吧及酒馆
    • 餐厅
    • 快餐
    • 民宿
    • 饮品分销商
    • 酒店
    房地产
    • 房地产代理
    • 建筑师事务所
    • 建造业
    • 地产管理
    • 园艺
    • 业主协会
    咨询
    • 会计师事务所
    • Odoo合作伙伴
    • 市场推广公司
    • 律师事务所
    • 人才招聘
    • 审核 & 认证
    制造
    • 纺织
    • 金属
    • 家具
    • 食品
    • 啤酒厂
    • 企业礼品
    保健与健身
    • 体育俱乐部
    • 眼镜店
    • 健身中心
    • 健康从业者
    • 药房
    • 发型屋
    商贸服务
    • 维修人员
    • IT 硬件及支持
    • 太阳能系统
    • 鞋匠
    • 清洁服务
    • 暖通空调服务
    其他
    • 非营利组织
    • 环境机构
    • 广告牌租赁
    • 摄影服务
    • 自行车租赁
    • 软件经销商
    浏览所有行业
  • 社区
    学习
    • 教学视频
    • 文档
    • 认证
    • 培训
    • 博客
    • 播客
    赋能教育
    • 教育计划
    • Scale Up! 商业游戏
    • 参观Odoo
    获取软件
    • 下载
    • 版本对比
    • 发布
    合作
    • Github
    • 论坛
    • 近期活动
    • 翻译
    • 成为合作伙伴
    • 合作伙伴服务
    • 注册您的会计事务所
    获取服务
    • 寻找合作伙伴
    • 查找会计服务
    • 预约顾问咨询
    • 安装及推行服务
    • 客户参考
    • 支持
    • 升级
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    获取演示
  • 定价
  • 技术支持

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • 客户关系管理
  • e-Commerce
  • 会计
  • 库存
  • PoS
  • 项目
  • MRP
All apps
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
只限注册用戶才可与社群互动。
所有帖文 人 徽章
标签 (查看所有)
odoo accounting v14 pos v15
关于此论坛区
帮助

I try install my first module and not work.

订阅

此帖文有活动时,接收通知

此问题已终结
odoo11communityodoo11.0Version
5 回复
4226 查看
形象
Aitor

Hello everyone, i try to install my first module to school, don´t work and I don´t know why. The mistake is ¨module not found¨. I paste here the error and the code to models.py and views.xml. Thank you.

---MISTAKE---

Modelo no encontrado: al.taller.propietarios

Contexto del error:
Vista `taller.propietarios.tree`
[view_id: 1020, xml_id: n/a, model: al.taller.propietarios, parent_id: n/a]
None" while parsing /opt/odoo/odoo11/custom-addons/taller/views/views.xml:6, near
<record model="ir.ui.view" id="taller_propietarios_tree">
        <field name="name">taller.propietarios.tree</field>
        <field name="model">al.taller.propietarios</field>
        <field name="arch" type="xml">
          <tree>
            <field name="name"/>
            <field name="nombre"/>
            <field name="apellido1"/>
            <field name="apellido2"/>
          </tree>
        </field>
      </record>

---MODELS.PY---
from odoo import models, fields, api

class taller_propietarios(models.Model):
_name="al.taller.propietarios"
name=fields.Char(string="DNI",required=True)
nombre=fields.Char(string="Nombre",required=True)
apellido1=fields.Char(string="Primer apellido",required=True)
apellido2=fields.Char(string="Segundo apellido",required=False)
coches = fields.One2many("al.taller.coches",'name',ondelete="cascade")
class taller_mecanicos(models.Model):
_name="al.taller.mecanicos"
name=fields.Char(string="Numero empleado",required=True)
nombre=fields.Char(string="Nombre",required=True)
puesto=fields.Selection((('0','Mecanico'),('1','Chapista'),('2','Jefe taller')),string="Puesto",required=True)
coches = fields.Many2many("al.taller.coches",string="Coches a su cargo")
class taller_coches(models.Model):
_name="al.taller.coches"
name=fields.Char(string="Matricula",required=True)
bastidor=fields.Char(string="Bastidor",required=True)
marca=fields.Char(string="Marca",required=True)
modelo=fields.Char(string="Modelo",required=True)
defectos=fields.Text(string="Defectos del vehiculo",required=True)
propietaros = fields.Many2one("al.taller.propietarios",string="Propietario",ondelete='cascade')
mecanicos = fields.Many2many("al.taller.mecanicos",string="Encargado/s del coche")
class taller_marcas(models.Model):
_name="al.taller.marcas"
name=fields.Char(string="Marca",required=True);
description=fields.Text(string="Descripcion",required=False)
modelos = fields.One2many("al.taller.modelos", string="Modelos", 'coches')
class taller_modelos(models.Model):
_name="al.taller.modelos"
name=fields.Char(string="Modelos")
marcas = fields.Many2one("al.taller.marcas",string="Modelos",ondelete='cascade')

---VIEWS.XML---
<odoo>
<data>

<!--PROPIETARIOS -->

<record model="ir.ui.view" id="taller_propietarios_tree">
<field name="name">taller.propietarios.tree</field>
<field name="model">al.taller.propietarios</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="nombre"/>
<field name="apellido1"/>
<field name="apellido2"/>
</tree>
</field>
</record>

<record model="ir.ui.view" id="taller_propietarios_form">
<field name="name">taller.propietarios.form</field>
<field name="model">al.taller.propietarios</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="nombre"/>
<field name="apellido1"/>
<field name="apellido2"/>
<field name="coches"/>
</group>
</form>
</field>
</record>

<!-- MECANICOS -->

<record model="ir.ui.view" id="taller_mecanicos_tree">
<field name="name">taller.mecanicos.tree</field>
<field name="model">al.taller.mecanicos</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="nombre"/>
<field name="puesto"/>
<field name="coches"/>
</tree>
</field>
</record>

<record model="ir.ui.view" id="taller_mecanicos_form">
<field name="name">taller.mecanicos.form</field>
<field name="model">al.taller.mecanicos</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="nombre"/>
<field name="puesto"/>
<field name="coches"/>
</group>
</form>
</field>
</record>

<!-- COCHES -->

<record model="ir.ui.view" id="taller_coches_tree">
<field name="name">taller.coches.tree</field>
<field name="model">al.taller.coches</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="bastidor"/>
<field name="marca"/>
<field name="modelo"/>
<field name="defectos"/>
<field name="propietarios"/>
<field name="mecanicos"/>
</tree>
</field>
</record>

<record model="ir.ui.view" id="taller_coches_form">
<field name="name">taller.coches.form</field>
<field name="model">al.taller.coches</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="bastidor"/>
<field name="marca"/>
<field name="modelo"/>
<field name="defectos"/>
<field name="propietarios"/>
<field name="mecanicos"/>
</group>
</form>
</field>
</record>

<!-- MARCAS -->

<record model="ir.ui.view" id="taller_marcas_tree">
<field name="name">taller.marcas.tree</field>
<field name="model">al.taller.marcas</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="description"/>
<field name="modelos"/>
</tree>
</field>
</record>

<record model="ir.ui.view" id="taller_marcas_form">
<field name="name">taller.marcas.form</field>
<field name="model">al.taller.marcas</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="description"/>
<field name="modelos"/>
</group>
</form>
</field>
</record>

<!-- MODELOS -->

<record model="ir.ui.view" id="taller_modelos_tree">
<field name="name">taller.modelos.tree</field>
<field name="model">al.taller.modelos</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="marcas"/>
</tree>
</field>
</record>

<record model="ir.ui.view" id="taller_modelos_form">
<field name="name">taller.modelos.form</field>
<field name="model">al.taller.modelos</field>
<field name="arch" type="xml">
<form>
<group colspan="2" col="2">
<field name="name"/>
<field name="marcas"/>
</group>
</form>
</field>
</record>

<!-- ACTIONS -->

<record model="ir.actions.act_window" id="taller.propietarios_action_window">
<field name="name">taller.propietarios.action_window</field>
<field name="res_model">al.taller.propietarios</field>
<field name="view_mode">tree,form</field>
</record>

<record model="ir.actions.act_window" id="taller.mecanicos_action_window">
<field name="name">taller.mecanicos.action_window</field>
<field name="res_model">al.taller.mecanicos</field>
<field name="view_mode">tree,form</field>
</record>

<record model="ir.actions.act_window" id="taller.coches_action_window">
<field name="name">taller.coches.action_window</field>
<field name="res_model">al.taller.coches</field>
<field name="view_mode">tree,form</field>
</record>

<record model="ir.actions.act_window" id="taller_marcas_action_window">
<field name="name">taller.marcas.action_window</field>
<field name="res_model">al.taller.marcas</field>
<field name="view_mode">tree,form</field>
</record>

<record model="ir.actions.act_window" id="taller_modelos_action_window">
<field name="name">taller.modelos.action_window</field>
<field name="res_model">al.taller.modelos</field>
<field name="view_mode">tree,form</field>
</record>

<!-- MENU -->

<menuitem name="Taller" id="taller.menu_root" />
<menuitem name="Propietarios" id="taller.propietarios_menu" parent="taller.menu_root" action="taller.propietarios_action_window" />
<menuitem name="Mecanicos" id="taller.mecanicos_menu" parent="taller.menu_root" action="taller.mecanicos_action_window"/>
<menuitem name="Coches" id="taller.coches_menu" parent="taller.menu_root" action="taller.coches_action_window" />
<menuitem name="Marcas" id="taller.marcas_menu" parent="taller.menu_root" action="taller.marcas_action_window" />
<menuitem name="Modelos" id="taller.modelos_menu" parent="taller.menu_root" action="taller.modelos_action_window" />
</data>
</odoo>



0
形象
丢弃
Sehrish

Follow these tips: http://learnopenerp.blogspot.com/

形象
Aitor
编写者 最佳答案

Thank you all, but yes, in the __inity.py of my models folder, have the line ¨from . import models¨

0
形象
丢弃
形象
Nasir
最佳答案

Hi Aitor,

Kindlt check if you have written "from . import (module_name_of_yours)" in the __init__.py file listed in the module folder in a module folder. Thanks.

Regards,

Nasir

0
形象
丢弃
形象
Niyas Raphy (Walnut Software Solutions)
最佳答案

HI,

If you are new to odoo development, you can see this videos which explains the basic of how to create a module from scratch in odoo: https://www.youtube.com/watch?v=BDepk0LhVuI&list=PLqRRLx0cl0hoJhjFWkFYowveq2Zn55dhM


And you can get the code samples used in the above tutorials from this link: https://apps.odoo.com/apps/modules/12.0/om_hospital/


Even though its for v12, it will work in v11 also. Regarding the issue you have told just make sure that you have restarted the service after adding the model, all python files are imported in init file .

Thanks

0
形象
丢弃
形象
Cybrosys Techno Solutions Pvt.Ltd
最佳答案

Hi Aitor,
Kindly check if you have omitted to import the models.py in the __init__.py file like below
from . import models
Regards

0
形象
丢弃
喜欢讨论吗?不要只阅读,加入进来!

立即创建账户,享受专属功能,与我们的精彩社区互动!

注册
相关帖文 回复 查看 活动
when generating payslip i got this error 已解决
odoo11community odoo11.0
形象
形象
1
2月 21
4270
How to programatically move file from i.attachment to specific directory
odoo11community odoo11.0
形象
0
6月 20
3269
Add a button after import button 已解决
odoo11community odoo11.0
形象
形象
2
1月 19
6043
How to add a sequence on date that we select from date field ???
odoo11 odoo11community odoo11.0
形象
0
5月 22
4150
Group by function / computed field with out ==> “store = True” in odoo 11 已解决
python3 odoo11community odoo11.0
形象
形象
1
3月 22
14318
社区
  • 教学视频
  • 文档
  • 论坛
开源
  • 下载
  • Github
  • Runbot
  • 翻译
服务
  • Odoo.sh 托管
  • 支持
  • 升级
  • 自定义开发服务
  • 教育
  • 查找会计服务
  • 寻找合作伙伴
  • 成为合作伙伴
关于我们
  • 我们的公司
  • 品牌资产
  • 联系我们
  • 招聘
  • 近期活动
  • 播客
  • 博客
  • 客户
  • 法律 • 隐私
  • 安全
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo致力于为企业管理提供高效智能的开源解决方案,是全球业内高速成长的软件服务商之一,逾七百五十万用户选择Odoo进行数字化升级。通过一系列全业务链覆盖、高度集成、简单易用的商业应用,助力企业实现信息化改革、降本增效并释放公司增长潜力。

Odoo独特的价值在于是一款非常容易使用又完全集成的应用。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now