diff --git a/animal/README.rst b/animal/README.rst new file mode 100644 index 000000000..21cd7854d --- /dev/null +++ b/animal/README.rst @@ -0,0 +1,21 @@ +**This file is going to be generated by oca-gen-addon-readme.** + +*Manual changes will be overwritten.* + +Please provide content in the ``readme`` directory: + +* **DESCRIPTION.rst** (required) +* INSTALL.rst (optional) +* CONFIGURE.rst (optional) +* **USAGE.rst** (optional, highly recommended) +* DEVELOP.rst (optional) +* ROADMAP.rst (optional) +* HISTORY.rst (optional, recommended) +* **CONTRIBUTORS.rst** (optional, highly recommended) +* CREDITS.rst (optional) + +Content of this README will also be drawn from the addon manifest, +from keys such as name, authors, maintainers, development_status, +and license. + +A good, one sentence summary in the manifest is also highly recommended. diff --git a/animal/__init__.py b/animal/__init__.py new file mode 100644 index 000000000..3b2a810b9 --- /dev/null +++ b/animal/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import models diff --git a/animal/__manifest__.py b/animal/__manifest__.py new file mode 100644 index 000000000..fba2e5d5c --- /dev/null +++ b/animal/__manifest__.py @@ -0,0 +1,29 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Animal", + "version": "12.0.1.0.0", + "license": "AGPL-3", + "summary": "Manage animals information", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "maintainer": "Open Source Integrators", + "website": "https://github.com/OCA/partner-contact", + "depends": ["mail"], + "data": [ + "data/ir.module.category.csv", + "data/animal.species.csv", + "data/animal.breed.csv", + "data/animal.color.csv", + "security/res_groups.xml", + "security/ir.model.access.csv", + "views/animal_color.xml", + "views/animal_breed.xml", + "views/animal_species.xml", + "views/animal.xml", + "views/menu.xml", + ], + "demo": [], + "application": True, + "development_status": "Beta", + "maintainers": ["max3903"], +} diff --git a/animal/data/animal.breed.csv b/animal/data/animal.breed.csv new file mode 100644 index 000000000..df01c159f --- /dev/null +++ b/animal/data/animal.breed.csv @@ -0,0 +1,25 @@ +id,name,species_id/id +beagle,Beagle,animal.dog +boxer,Boxer,animal.dog +bull_terrier,Bull Terrier,animal.dog +bulldog,Bulldog,animal.dog +chihuahua,Chihuahua,animal.dog +cocker,Cocker,animal.dog +collie,Collie,animal.dog +dalmatian,Dalmatian,animal.dog +dachshund,Dachshund,animal.dog +doberman,Doberman,animal.dog +english_cocker_spaniel,English Cocker Spaniel,animal.dog +french_bulldog,French Bulldog,animal.dog +german_shepard,German Shepard,animal.dog +golden_retriever,Golden Retriever,animal.dog +great_dane,Great Dane,animal.dog +jack_russell,Jack Russell,animal.dog +labrador,Labrador,animal.dog +pomeranian,Pomeranian,animal.dog +pug,Pug,animal.dog +rottweiler,Rottweiler,animal.dog +schnauzer,Schnauzer,animal.dog +shih_tzu,Shih Tzu,animal.dog +siberian_husky,Siberian Husky,animal.dog +yorkshire_terrier,Yorkshire Terrier,animal.dog diff --git a/animal/data/animal.color.csv b/animal/data/animal.color.csv new file mode 100644 index 000000000..7b1dc2b4b --- /dev/null +++ b/animal/data/animal.color.csv @@ -0,0 +1,2 @@ +id,name,breed_id/id +salt,Salt and pepper,animal.schnauzer diff --git a/animal/data/animal.species.csv b/animal/data/animal.species.csv new file mode 100644 index 000000000..ee14f37d3 --- /dev/null +++ b/animal/data/animal.species.csv @@ -0,0 +1,4 @@ +id,name +bird,Bird +cat,Cat +dog,Dog diff --git a/animal/data/ir.module.category.csv b/animal/data/ir.module.category.csv new file mode 100644 index 000000000..0ba0e79a7 --- /dev/null +++ b/animal/data/ir.module.category.csv @@ -0,0 +1,2 @@ +id,name,sequence +animal,Animal,30 diff --git a/animal/models/__init__.py b/animal/models/__init__.py new file mode 100644 index 000000000..6272f78c7 --- /dev/null +++ b/animal/models/__init__.py @@ -0,0 +1,8 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from . import ( + animal_species, + animal_breed, + animal_color, + animal, +) diff --git a/animal/models/animal.py b/animal/models/animal.py new file mode 100644 index 000000000..9df51f7ec --- /dev/null +++ b/animal/models/animal.py @@ -0,0 +1,42 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class Animal(models.Model): + _name = "animal" + _description = "Animal" + _inherit = ["mail.thread", "mail.activity.mixin"] + _order = "name" + + name = fields.Char(string="Name") + ref = fields.Char(string="Reference") + species_id = fields.Many2one("animal.species", string="Species", required=True) + breed_id = fields.Many2one("animal.breed", string="Breed", required=True) + color_id = fields.Many2one("animal.color", string="Color") + size = fields.Char(string="Size") + weight = fields.Float(string="Weight (in kg)") + birth_date = fields.Date(string="Birth Date") + gender = fields.Selection( + string="Gender", + selection=[ + ("female", "Female"), + ("male", "Male"), + ("hermaphrodite", "Hermaphrodite"), + ("neutered", "Neutered"), + ], + default="female", + required=True, + ) + active = fields.Boolean(default=True) + image = fields.Binary( + "Image", attachment=True, help="This field holds the photo of the animal." + ) + + @api.onchange("species_id") + def onchange_species(self): + self.breed_id = False + + @api.onchange("breed_id") + def onchange_breed(self): + self.color_id = False diff --git a/animal/models/animal_breed.py b/animal/models/animal_breed.py new file mode 100644 index 000000000..901544426 --- /dev/null +++ b/animal/models/animal_breed.py @@ -0,0 +1,12 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class AnimalBreed(models.Model): + _name = "animal.breed" + _description = "Animal Breeds" + _order = "name" + + name = fields.Char(string="Name", translate=True) + species_id = fields.Many2one("animal.species", string="Species", required=True) diff --git a/animal/models/animal_color.py b/animal/models/animal_color.py new file mode 100644 index 000000000..611a04f5f --- /dev/null +++ b/animal/models/animal_color.py @@ -0,0 +1,14 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class AnimalColor(models.Model): + _name = "animal.color" + _description = "Animal Colors" + + name = fields.Char(string="Name", translate=True) + breed_id = fields.Many2one("animal.breed", string="Breed", required=True) + species_id = fields.Many2one( + "animal.species", string="Species", related="breed_id.species_id", readonly=True + ) diff --git a/animal/models/animal_species.py b/animal/models/animal_species.py new file mode 100644 index 000000000..4afb8b2db --- /dev/null +++ b/animal/models/animal_species.py @@ -0,0 +1,12 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class AnimalSpecies(models.Model): + _name = "animal.species" + _description = "Animal Species" + _order = "name" + + name = fields.Char(string="Name", translate=True) + breed_ids = fields.One2many("animal.breed", "species_id", string="Breeds") diff --git a/animal/readme/CONTRIBUTORS.rst b/animal/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..cddff22dc --- /dev/null +++ b/animal/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Open Source Integrators + + * Maxime Chambreuil diff --git a/animal/readme/DESCRIPTION.rst b/animal/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5299ccfbf --- /dev/null +++ b/animal/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows you to store animal information. diff --git a/animal/readme/USAGE.rst b/animal/readme/USAGE.rst new file mode 100644 index 000000000..00b41732f --- /dev/null +++ b/animal/readme/USAGE.rst @@ -0,0 +1,3 @@ +* Go to Animals +* Create an animal by entering his name and selecting his gender, species, breed and + color. diff --git a/animal/security/ir.model.access.csv b/animal/security/ir.model.access.csv new file mode 100644 index 000000000..e52e11b05 --- /dev/null +++ b/animal/security/ir.model.access.csv @@ -0,0 +1,8 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_animal_user,animal.user,model_animal,base.group_user,1,1,1,1 +access_animal_color_user,animal.color.user,model_animal_color,base.group_user,1,0,0,0 +access_animal_color_manager,animal.color.manaager,model_animal_color,animal.group_animal_manager,1,1,1,1 +access_animal_breed_user,animal.breed.user,model_animal_breed,base.group_user,1,0,0,0 +access_animal_breed_manager,animal.breed.manager,model_animal_breed,animal.group_animal_manager,1,1,1,1 +access_animal_species_user,animal.species.user,model_animal_species,base.group_user,1,0,0,0 +access_animal_species_manager,animal.species.manager,model_animal_species,animal.group_animal_manager,1,1,1,0 diff --git a/animal/security/res_groups.xml b/animal/security/res_groups.xml new file mode 100644 index 000000000..851c584b2 --- /dev/null +++ b/animal/security/res_groups.xml @@ -0,0 +1,10 @@ + + + + + Manager + + + + + diff --git a/animal/static/description/icon.png b/animal/static/description/icon.png new file mode 100644 index 000000000..30c21221f Binary files /dev/null and b/animal/static/description/icon.png differ diff --git a/animal/static/img/avatar.png b/animal/static/img/avatar.png new file mode 100644 index 000000000..56efa764e Binary files /dev/null and b/animal/static/img/avatar.png differ diff --git a/animal/views/animal.xml b/animal/views/animal.xml new file mode 100644 index 000000000..0b55c0c3a --- /dev/null +++ b/animal/views/animal.xml @@ -0,0 +1,156 @@ + + + + + animal.tree + animal + + + + + + + + + + + + + + + animal.form + animal + +
+
+ +
+ +
+ +
+

+ +

+ +
+ + + + + + + + + + + + + + +
+
+ + + +
+ + + + + + + animal.kanban + animal + + + + + + + +
+ + + + + Avatar + +
+ +
+
    +
  • +
  • ,
  • +
+ +
+ + + + + + + + + animal.search + animal + + + + + + + + + + + + + + + + + + + + + + + + + Animals + animal + form + kanban,tree,form + + +

+ Create an animal. +

+
+
+ + diff --git a/animal/views/animal_breed.xml b/animal/views/animal_breed.xml new file mode 100644 index 000000000..621d54155 --- /dev/null +++ b/animal/views/animal_breed.xml @@ -0,0 +1,53 @@ + + + + + view.animal.breed.tree + animal.breed + + + + + + + + + + + view.animal.breed.form + animal.breed + +
+
+ +
+
+

+ +

+
+ + + + + + + + + + + + + + Breeds + animal.breed + form + tree,form + +

+ Create a breed. +

+
+
+ + diff --git a/animal/views/animal_color.xml b/animal/views/animal_color.xml new file mode 100644 index 000000000..2c569eb9e --- /dev/null +++ b/animal/views/animal_color.xml @@ -0,0 +1,55 @@ + + + + + view.animal.color.tree + animal.color + + + + + + + + + + + + view.animal.color.form + animal.color + +
+
+ +
+
+

+ +

+
+ + + + + + + + + + + + + + + Colors + animal.color + form + tree,form + +

+ Create a color. +

+
+
+ + diff --git a/animal/views/animal_species.xml b/animal/views/animal_species.xml new file mode 100644 index 000000000..c93641e54 --- /dev/null +++ b/animal/views/animal_species.xml @@ -0,0 +1,54 @@ + + + + + view.animal.species.tree + animal.species + + + + + + + + + + view.animal.species.form + animal.species + +
+
+ +
+
+

+ +

+
+ + + + + + + + + + + + + + + + Species + animal.species + form + tree,form + +

+ Create a species. +

+
+
+ + diff --git a/animal/views/menu.xml b/animal/views/menu.xml new file mode 100644 index 000000000..259bbbe1d --- /dev/null +++ b/animal/views/menu.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + +