good night, I have an error loading a value in a custom column. I don't identify what the problem may be. I verify that the model einvoice.catalog.01, if it has the data of: "01". Please appreciate your help. RELEASE: ODOO12 Traceback (most recent call last): File "<decorator-gen-3>", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _model_create_multi return create(self, [arg]) File "/usr/lib/python3/dist-packages/odoo/models.py", line 3516, in create records = self._create(data_list) File "/usr/lib/python3/dist-packages/odoo/models.py", line 3602, in _create col_val = field.convert_to_column(val, self, stored) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1934, in convert_to_column value = self.convert_to_cache(value, record) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1946, in convert_to_cache raise ValueError("Wrong value for %s: %r" % (self, value)) ValueError: Wrong value for account.journal.invoice_type_code_id: '01' During handling of the above exception, another exception occurred: Traceback (most recent call last): return self.browse().concat(*(create(self, vals) for vals in arg)) File "/mnt/extra-addons/efact/models/account/account_journal.py", line 58, in create return super(AccountJournal,self).create(vals) File "<decorator-gen-192>", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 430, in _model_create_single return create(self, arg) File "/usr/lib/python3/dist-packages/odoo/addons/account/models/account.py", line 781, in create journal = super(AccountJournal, self).create(vals) File "<decorator-gen-3>", line 2, in create File "/usr/lib/python3/dist-packages/odoo/api.py", line 451, in _model_create_multi return create(self, [arg]) File "/usr/lib/python3/dist-packages/odoo/models.py", line 3516, in create records = self._create(data_list) File "/usr/lib/python3/dist-packages/odoo/models.py", line 3602, in _create col_val = field.convert_to_column(val, self, stored) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1934, in convert_to_column value = self.convert_to_cache(value, record) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1946, in convert_to_cache raise ValueError("Wrong value for %s: %r" % (self, value)) odoo.tools.convert.ParseError: "Wrong value for account.journal.invoice_type_code_id: '01'" while parsing /mnt/extra-addons/efact/data/account_journal.xml:45, near <record id="sales_journal" model="account.journal"> <field name="name">Factura</field> <field name="refund_sequence" eval="True"/> <field name="type">sale</field> <field name="invoice_type_code_id">01</field> <field name="code">001</field> </record> ****************************************************** # -*- coding: utf-8 -*- from odoo import fields,models,api,_ from odoo.exceptions import UserError from odoo.http import request class AccountJournal(models.Model): _inherit = "account.journal" _name="account.journal" def _list_invoice(self): catalogs=self.env["einvoice.catalog.01"].search([]) list=[] for cat in catalogs: list.append((cat.code,cat.name)) return list invoice_type_code_id=fields.Selection(string="Tipo",selection=_list_invoice) <odoo> <data noupdate="1"> <record id="sales_journal" model="account.journal"> <field name="name">Factura01 </field> <field name="refund_sequence" eval="True"/> <field name="type">sale</field> <field name="invoice_type_code_id">01</field> <field name="code">001</field> </record> </data> </odoo> ******************************************************************************************** from odoo import models, fields, api class einvoice_catalog_01(models.Model): _name = "einvoice.catalog.01" _description = 'Codigo de Tipo de documento' code = fields.Char(string='Codigo', size=4, index=True, required=True) name = fields.Char(string='Descripcion', size=128, index=True, required=True) @api.multi @api.depends('code', 'name') def name_get(self): result = [] for table in self: l_name = table.code and table.code + ' - ' or '' l_name += table.name result.append((table.id, l_name )) return result <?xml version="1.0" encoding="utf-8"?> <openerp> <data noupdate="0"> <!-- Catálogo No. 01 - Código de Tipo de documento --> <record id="e01_00" model="einvoice.catalog.01"><field name="code">00</field><field name="name">Otros</field></record> <record id="e01_01" model="einvoice.catalog.01"><field name="code">01</field><field name="name">Factura</field></record> <record id="e01_02" model="einvoice.catalog.01"><field name="code">02</field><field name="name">Recibo por Honorarios</field></record> <record id="e01_03" model="einvoice.catalog.01"><field name="code">03</field><field name="name">Boleta de Venta</field></record> <record id="e01_04" model="einvoice.catalog.01"><field name="code">04</field><field name="name">Liquidación de compra</field></record> <record id="e01_05" model="einvoice.catalog.01"><field name="code">05</field><field name="name">Boleto de compañía de aviación comercial por el servicio de transporte aéreo de pasajeros</field></record> <record id="e01_06" model="einvoice.catalog.01"><field name="code">06</field><field name="name">Carta de porte aéreo por el servicio de transporte de carga aérea</field></record> </data> </openerp>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi,
You are passing 01 value to invoice_type_code_id field. This may be many2one field. So give 1 for invoice_type_code_id.
<record id="sales_journal" model="account.journal">
<field name="name">Factura</field>
<field name="refund_sequence" eval="True"/>
<field name="type">sale</field>
<field name="invoice_type_code_id">1</field>
<field name="code">001</field>
</record>
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up