Odoo Ayuda

0

0
1 Answer
1
Avatar

Yenthe Van Ginneken

--Yenthe Van Ginneken--
22706
| 9 9 12
Turnhout, Bélgica
--Yenthe Van Ginneken--

My Odoo training platform: https://www.oocademy.com
My Odoo blog: http://www.odoo.yenthevg.com/
My Twitter: https://twitter.com/Yenthe666

Yenthe Van Ginneken
14/1/19 3:39

Hi Nguyen,

This is because your model cinema.seat has no field name.
By default Odoo will build the name that is shown in a many2one with the field 'name'.
If you don't have a field named 'name' you'll need to define your own with the _rec_name parameter though.
Just add it to your cinema.seat model like this:

class CinemaSeat(models.Model):
    _name = 'cinema.seat'
    _rec_name = 'seat_number'

If you want to go further and build a whole custom title you can do it too. You just need to add a function "name_get" to build your own name then. For example:

@api.multi
def name_get(self):
    result = []
    for record in self:
        record_name = record.movie + ' - ' + record.seat_number
        result.append((record.id, record_name))
    return result

Regards,
Yenthe

Realizar una pregunta
Etiquetas
Keep Informed
1 seguidor(es)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now