diff --git a/addons/zoo/models/__pycache__/zoo_animal.cpython-312.pyc b/addons/zoo/models/__pycache__/zoo_animal.cpython-312.pyc index 0ea30c4..c7af4df 100644 Binary files a/addons/zoo/models/__pycache__/zoo_animal.cpython-312.pyc and b/addons/zoo/models/__pycache__/zoo_animal.cpython-312.pyc differ diff --git a/addons/zoo/models/__pycache__/zoo_creature.cpython-312.pyc b/addons/zoo/models/__pycache__/zoo_creature.cpython-312.pyc index f9516ac..2f0e942 100644 Binary files a/addons/zoo/models/__pycache__/zoo_creature.cpython-312.pyc and b/addons/zoo/models/__pycache__/zoo_creature.cpython-312.pyc differ diff --git a/addons/zoo/models/zoo_animal.py b/addons/zoo/models/zoo_animal.py index a5c9b24..6eeed05 100644 --- a/addons/zoo/models/zoo_animal.py +++ b/addons/zoo/models/zoo_animal.py @@ -25,8 +25,6 @@ class ZooAnimal(models.Model): introduction_vn = fields.Html('Introduction (VI)') is_purchased = fields.Boolean('Has Been Purchased', default=False) purchase_price = fields.Float('Purchase Price') - parent_id = fields.Many2one(comodel_name='zoo.animal', string='Parent', ondelete='set null') - male_children_ids = fields.One2many(comodel_name='zoo.animal', inverse_name='parent_id', string='Children') veterinarian_id = fields.Many2one(comodel_name='res.partner', string='Veterinarian') # thêm vào cuối: @@ -38,6 +36,10 @@ class ZooAnimal(models.Model): mother_id = fields.Many2one(comodel_name='zoo.animal', string='Mother', ondelete='set null') # ondelete: 'set null', 'restrict', 'cascade' mother_name = fields.Char('Mother Name', related='mother_id.name') female_children_ids = fields.One2many(comodel_name='zoo.animal', inverse_name='mother_id', string='Female Children') + father_id = fields.Many2one(comodel_name='zoo.animal', string='Father', ondelete='set null') + father_name = fields.Char('Father Name', related='father_id.name') + male_children_ids = fields.One2many(comodel_name='zoo.animal', inverse_name='father_id', string='Male Children') + toy_ids = fields.Many2many(comodel_name='product.product', string="Toys", diff --git a/addons/zoo/views/zoo_animal_views.xml b/addons/zoo/views/zoo_animal_views.xml index 3b45458..a6a37ed 100644 --- a/addons/zoo/views/zoo_animal_views.xml +++ b/addons/zoo/views/zoo_animal_views.xml @@ -23,11 +23,17 @@ + + + + + + @@ -38,6 +44,10 @@