Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
2738 Ansichten

I'm starting with odoo (v10). The following code creates the fields "name" in the model "Category" and "Author" but not in "Book". There is no trace of said field in the views (produces error) nor postgre. Can someone tell me why?
Thank you.

import logging, datetime

from odoo import models, fields, api

class Libro(models.Model):
_name = 'biblioteca.libro'
_description = 'Contiene los libros'

name=fields.Char(string='Titulo')
tipo=fields.Selection([('a', 'Tipo A'),('b','Tipo B')], string='Tipo de libro')
prestado=fields.Selection([('s','S'),('n','N')], string='Prestado (s/n)')
categoria=fields.Many2one(comodel_name='biblioteca.categoria',string='Referencia a categorías')
autores=fields.Many2many(comodel_name='biblioteca.autor')

class Categoria(models.Model):
_name='biblioteca.categoria'
_description='Contiene las categorias'

name=fields.Char(string='Categoría',size=30)
libros=fields.One2many(comodel_name='biblioteca.libro',inverse_name='categoria')

class Autor(models.Model):
_name='biblioteca.autor'
_description='Contiene los autores'

name=fields.Char(string='Autor')
libros=fields.Many2many(comodel_name='biblioteca.libro')
Avatar
Verwerfen

Please share the Book object / class.

Autor Beste Antwort

"Book" is "Libro", "Category" is "Categoria" and "Author" is "Autor".

my apologies!


Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Nov. 24
1820
1
Juli 22
7220
0
Nov. 16
5158
3
Mai 25
1367
1
Apr. 25
1056