diff --git a/animal_owner/README.rst b/animal_owner/README.rst new file mode 100644 index 000000000..58422b792 --- /dev/null +++ b/animal_owner/README.rst @@ -0,0 +1,90 @@ +============ +Animal Owner +============ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github + :target: https://github.com/OCA/partner-contact/tree/14.0/animal_owner + :alt: OCA/partner-contact +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/partner-contact-12-0/partner-contact-12-0-animal_owner + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/134/14.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to store the owner of a pet. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +* Go to Animals +* Create or select an animal +* Select his owner + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Open Source Integrators + +Contributors +~~~~~~~~~~~~ + +* Open Source Integrators + + * Maxime Chambreuil + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px + :target: https://github.com/max3903 + :alt: max3903 + +Current `maintainer `__: + +|maintainer-max3903| + +This module is part of the `OCA/partner-contact `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/animal_owner/__init__.py b/animal_owner/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/animal_owner/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/animal_owner/__manifest__.py b/animal_owner/__manifest__.py new file mode 100644 index 000000000..44c9d463b --- /dev/null +++ b/animal_owner/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Animal Owner", + "version": "14.0.1.0.0", + "license": "AGPL-3", + "summary": "Add owner to the animal", + "author": "Open Source Integrators, Odoo Community Association (OCA)", + "maintainer": "Open Source Integrators", + "website": "https://github.com/OCA/partner-contact", + "depends": ["animal"], + "data": ["views/animal.xml", "views/res_partner.xml"], + "development_status": "Beta", + "maintainers": ["max3903"], +} diff --git a/animal_owner/i18n/animal_owner.pot b/animal_owner/i18n/animal_owner.pot new file mode 100644 index 000000000..e5160cbcf --- /dev/null +++ b/animal_owner/i18n/animal_owner.pot @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * animal_owner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: animal_owner +#: model_terms:ir.ui.view,arch_db:animal_owner.view_partner_animal_owner_form +msgid " Animals" +msgstr "" + +#. module: animal_owner +#: model:ir.model,name:animal_owner.model_animal +msgid "Animal" +msgstr "" + +#. module: animal_owner +#: model:ir.model.fields,field_description:animal_owner.field_res_partner__animal_ids +#: model:ir.model.fields,field_description:animal_owner.field_res_users__animal_ids +msgid "Animals" +msgstr "" + +#. module: animal_owner +#: model:ir.model,name:animal_owner.model_res_partner +msgid "Contact" +msgstr "" + +#. module: animal_owner +#: model:ir.model.fields,field_description:animal_owner.field_res_partner__animal_count +#: model:ir.model.fields,field_description:animal_owner.field_res_users__animal_count +msgid "Number of Animals" +msgstr "" + +#. module: animal_owner +#: model:ir.model.fields,field_description:animal_owner.field_animal__partner_id +#: model_terms:ir.ui.view,arch_db:animal_owner.view_animal_owner_search +msgid "Owner" +msgstr "" + diff --git a/animal_owner/i18n/es.po b/animal_owner/i18n/es.po new file mode 100644 index 000000000..0bbd4d653 --- /dev/null +++ b/animal_owner/i18n/es.po @@ -0,0 +1,50 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * animal_owner +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-10-20 04:08+0000\n" +"Last-Translator: Maxime Chambreuil \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: animal_owner +#: model_terms:ir.ui.view,arch_db:animal_owner.view_partner_animal_owner_form +msgid " Animals" +msgstr " Animales" + +#. module: animal_owner +#: model:ir.model,name:animal_owner.model_animal +msgid "Animal" +msgstr "" + +#. module: animal_owner +#: model:ir.model.fields,field_description:animal_owner.field_res_partner__animal_ids +#: model:ir.model.fields,field_description:animal_owner.field_res_users__animal_ids +msgid "Animals" +msgstr "Animales" + +#. module: animal_owner +#: model:ir.model,name:animal_owner.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: animal_owner +#: model:ir.model.fields,field_description:animal_owner.field_res_partner__animal_count +#: model:ir.model.fields,field_description:animal_owner.field_res_users__animal_count +msgid "Number of Animals" +msgstr "Numero de animales" + +#. module: animal_owner +#: model:ir.model.fields,field_description:animal_owner.field_animal__partner_id +#: model_terms:ir.ui.view,arch_db:animal_owner.view_animal_owner_search +msgid "Owner" +msgstr "DueƱo" diff --git a/animal_owner/models/__init__.py b/animal_owner/models/__init__.py new file mode 100644 index 000000000..e84a5c235 --- /dev/null +++ b/animal_owner/models/__init__.py @@ -0,0 +1,3 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import animal, res_partner diff --git a/animal_owner/models/animal.py b/animal_owner/models/animal.py new file mode 100644 index 000000000..4c9cc2707 --- /dev/null +++ b/animal_owner/models/animal.py @@ -0,0 +1,11 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class Animal(models.Model): + _inherit = "animal" + + partner_id = fields.Many2one( + "res.partner", string="Owner", index=True, track_visibility="onchange" + ) diff --git a/animal_owner/models/res_partner.py b/animal_owner/models/res_partner.py new file mode 100644 index 000000000..662c32e78 --- /dev/null +++ b/animal_owner/models/res_partner.py @@ -0,0 +1,26 @@ +# Copyright (C) 2020 Open Source Integrators +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + @api.depends("animal_ids") + def _compute_animal_count(self): + for rec in self: + rec.animal_count = len(rec.animal_ids) + + animal_ids = fields.One2many("animal", "partner_id", string="Animals") + animal_count = fields.Integer( + compute=_compute_animal_count, string="Number of Animals", store=True + ) + + def action_view_animals(self): + action = self.env.ref("animal.action_animal").read()[0] + if self.animal_count > 1: + action["domain"] = [("id", "in", self.animal_ids.ids)] + else: + action["views"] = [(self.env.ref("animal.view_animal_form").id, "form")] + action["res_id"] = self.animal_ids and self.animal_ids.ids[0] or False + return action diff --git a/animal_owner/readme/CONTRIBUTORS.rst b/animal_owner/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..cddff22dc --- /dev/null +++ b/animal_owner/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Open Source Integrators + + * Maxime Chambreuil diff --git a/animal_owner/readme/DESCRIPTION.rst b/animal_owner/readme/DESCRIPTION.rst new file mode 100644 index 000000000..539fc224c --- /dev/null +++ b/animal_owner/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows you to store the owner of a pet. diff --git a/animal_owner/readme/USAGE.rst b/animal_owner/readme/USAGE.rst new file mode 100644 index 000000000..dbb34ff8c --- /dev/null +++ b/animal_owner/readme/USAGE.rst @@ -0,0 +1,3 @@ +* Go to Animals +* Create or select an animal +* Select his owner diff --git a/animal_owner/static/description/icon.png b/animal_owner/static/description/icon.png new file mode 100644 index 000000000..85d01763f Binary files /dev/null and b/animal_owner/static/description/icon.png differ diff --git a/animal_owner/static/description/index.html b/animal_owner/static/description/index.html new file mode 100644 index 000000000..ff61116de --- /dev/null +++ b/animal_owner/static/description/index.html @@ -0,0 +1,433 @@ + + + + + + +Animal Owner + + + +
+

Animal Owner

+ + +

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runbot

+

This module allows you to store the owner of a pet.

+

Table of contents

+ +
+

Usage

+
    +
  • Go to Animals
  • +
  • Create or select an animal
  • +
  • Select his owner
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Open Source Integrators
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

max3903

+

This module is part of the OCA/partner-contact project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/animal_owner/views/animal.xml b/animal_owner/views/animal.xml new file mode 100644 index 000000000..49bb4cfc1 --- /dev/null +++ b/animal_owner/views/animal.xml @@ -0,0 +1,62 @@ + + + + + view.animal.owner.tree + animal + + + + + + + + + + + view.animal.owner.form + animal + + + + + + + + + + + view.animal.owner.kanban + animal + + + + + + +
  • +
    +
    +
    + + + + view.animal.owner.search + animal + + + + + + + + + + + +
    diff --git a/animal_owner/views/res_partner.xml b/animal_owner/views/res_partner.xml new file mode 100644 index 000000000..9ed3492f8 --- /dev/null +++ b/animal_owner/views/res_partner.xml @@ -0,0 +1,25 @@ + + + + + res.partner + + +
    + +
    +
    +
    + +
    diff --git a/setup/animal_owner/odoo/addons/animal_owner b/setup/animal_owner/odoo/addons/animal_owner new file mode 120000 index 000000000..8c6ac1a74 --- /dev/null +++ b/setup/animal_owner/odoo/addons/animal_owner @@ -0,0 +1 @@ +../../../../animal_owner \ No newline at end of file diff --git a/setup/animal_owner/setup.py b/setup/animal_owner/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/animal_owner/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)