简体   繁体   English

引发ValueError('在系统中找不到外部ID:%s'%xmlid)

[英]raise ValueError('External ID not found in the system: %s' % xmlid)

I am trying to create a module for "Daily Transaction" and getting a ValueError 我正在尝试为“每日交易”创建一个模块并获取ValueError

  value = d[key] = self.method(*args, **kwargs) File "/home/odoo/odoo-dev/odoo/odoo/addons/base/ir/ir_model.py", line 1028, in xmlid_lookup raise ValueError('External ID not found in the system: %s' % xmlid) ParseError: "External ID not found in the system: daily_transaction.action_daily_transaction" while parsing /home/odoo/odoo-dev/custom-addons/daily_transaction/daily_transaction_view.xml:11, near <menuitem action="action_daily_transaction" id="menu_action_daily_transaction" parent="menu_daily_transaction_root" sequence="20"/> 

My file Structure: (One with Bold are my file names) 我的文件结构:(我的文件名带有粗体)

__init__.py __init__.py

from import daily_transaction

__manifest__.py __manifest__.py

{
        'name':'Daily Transaction Manager',
        'version':'1.0',
        'description':'**********************This app will keep the record of all the tansactions happening*********',
        'author':'Test',
        'data':['daily_transaction_view.xml'],
        'installable':True,
        'auto_install':False,
}

daily_transaction.py daily_transaction.py

from . import fields,osv

class daily_transaction(osv.osv):
        _name = 'daily.transaction'
        _description = 'Daily Transaction'
        _columns = {

                'subject': fields.char('Subject', size=128, required = True),
                'data' : fields.data('Date', required = True),
                'note': fields.text('Notes'),
                'amount': fields.float('Amount', required = True),
                'type' : fields.selection([
                        ('transport','Transport'),
                        ('household','Household'),
                        ('personal','Personal'),
                        ],
                        'Type', required = True),
                        }

daily_transaction_view.xml daily_transaction_view.xml

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

<odoo>
<data>

<!-- Main Menu Related Info -->        
<menuitem name="Daily Transaction" id="base.daily_transaction_root"            sequence="60"/>
<!-- Sub Menu Related Info -->       
<menuitem id="menu_daily_transaction_root" name="Daily Transaction"            parent="base.daily_transaction_root" sequence="1" /> 
<!-- Action Menu Related Info -->       
<menuitem action="action_daily_transaction" id="menu_action_daily_transaction" parent="menu_daily_transaction_root" sequence="20"/>

<!--Daily Transaction List View-->    
<record id="view_daily_transaction_tree" model="ir.ui.view">  <!-- here id is the external id for this tree view which must be unique and will be used for accessing this record -->
<field name="name">daily.transaction.tree</field> <!-- this will be our name of record in ir.ui.view -->        
<field name="model">daily.transaction</field>    <!-- this will map out tree view with our daily transaction model -->
<field name="arch" type="xml">           
 <!-- this will be our title of list/tree view -->            
<tree string="Daily Transaction">               
 <!-- these will automatically map table headers for our list view, so we’ll select out column names of our model here -->               
 <field name="name"/>              
 <field name="date"/>              
 <field name="type"/>               
<field name="amount"/>                   
</tree>       
</field>
</record>


<!--Daily Transaction Form View-->    
<record id="view_daily_transaction_form" model="ir.ui.view">        
<field name="name">daily.transaction.form.view</field>        
<field name="model">daily.transaction</field>        
<field name="arch" type="xml">            
<!-- this will be our title of list/tree view -->            
<form string="Daily Transaction" version="7.0">                
<group>                    
<field name="name"/>                    
<field name="date"/>                    
<field name="type"/>                     
<field name="amount"/>                     
<field name="note"/>                                   
</group>             
</form>        
</field>    
</record>

<record id="action_daily_transaction" model="ir.actions.act_window">        
<field name="name">Daily Transaction</field>        <!-- name of action -->
<field name="res_model">daily.transaction</field>        <!-- this action will be mapped to model specified -->
<field name="view_type">form</field>        
<field name="view_mode">tree,form</field>        <!-- these are type of view our module will show for our daily transaction mode  -->
<field name="search_view_id"  eval="False"/>        <!-- here we specify id of our search view -->
<field name="context">{}</field>        
<field name="help">Create new daily transaction.</field>    <!-- help text for our model -->
</record>

</data>
</odoo

It is giving this error because you are using action before it is created, So first you have to define your action and then you can use it. 出现此错误是因为您在创建操作之前就在使用它,因此首先必须定义您的操作,然后才能使用它。

So you should try as following: 因此,您应该尝试以下操作:

<record id="action_daily_transaction" model="ir.actions.act_window">        
    <field name="name">Daily Transaction</field>        <!-- name of action -->
    <field name="res_model">daily.transaction</field>        <!-- this action will be mapped to model specified -->
    <field name="view_type">form</field>        
    <field name="view_mode">tree,form</field>        <!-- these are type of view our module will show for our daily transaction mode  -->
    <field name="search_view_id"  eval="False"/>        <!-- here we specify id of our search view -->
    <field name="context">{}</field>        
    <field name="help">Create new daily transaction.</field>    <!-- help text for our model -->
</record>

<menuitem action="action_daily_transaction" id="menu_action_daily_transaction"
parent="menu_daily_transaction_root" sequence="20"/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ValueError('系统中未找到外部 ID:%s' % xmlid) ValueError:系统中未找到外部 ID:gen_doc.report_cahier_des_charges - ValueError('External ID not found in the system: %s' % xmlid) ValueError: External ID not found in the system: gen_doc.report_cahier_des_charges Odoo 12 报告系统中未找到外部 ID:%s' % xmlid - Odoo 12 Report External ID not found in the system: %s' % xmlid Odoo 9 ValueError:在系统中找不到外部ID: - Odoo 9 ValueError: External ID not found in the system: ValueError:在系统中找不到外部 ID:website.assets_frontend - ValueError: External ID not found in the system: website.assets_frontend 如果找不到文件,则引发 ValueError - Raise ValueError if file not found ValueError:在系统中找不到外部ID:todo_report.report_todo_task_template - ValueError: External ID not found in the system: todo_report.report_todo_task_template 引发 ValueError ValueError: Found array with 0 feature(s) (shape=(124, 0)) 而最少需要 1 - raise ValueError ValueError: Found array with 0 feature(s) (shape=(124, 0)) while a minimum of 1 is required 错误:OpenERP中的“系统中找不到外部ID” - Error: “External ID not found in the system” in OpenERP 错误:尝试使用scrappy登录时发生ValueError(“在%s中找不到元素”%响应) - Error: raise ValueError(“No element found in %s” % response) occur when try to login with scrappy 使用函数的 output 创建列引发 ValueError - Create column with function's output raise a ValueError
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM