diff --git a/res_partner_affiliate/README.rst b/res_partner_affiliate/README.rst new file mode 100644 index 000000000..948a00759 --- /dev/null +++ b/res_partner_affiliate/README.rst @@ -0,0 +1,58 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +================== +Partner Affiliates +================== + +This module allows to use parent_id in company partner to refer to a parent +company, plus will show a tab in parent company of affiliated companies. + +Usage +===== + +New tab 'Affiliates' are available on the contact form if partner is company. +In tab 'Contact & Addresses' only are shown those contacts that are not +companies. + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/134/9.0 + +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. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Yannick Vaucher +* Vicent Cubells + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/res_partner_affiliate/__init__.py b/res_partner_affiliate/__init__.py index 3cd8dd337..c20444aba 100644 --- a/res_partner_affiliate/__init__.py +++ b/res_partner_affiliate/__init__.py @@ -1,22 +1,5 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher -# Copyright 2012 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2012 Camptocamp SA - Yannick Vaucher +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from . import res_partner +from . import models diff --git a/res_partner_affiliate/__openerp__.py b/res_partner_affiliate/__openerp__.py index 718fb73ce..ac4e0e524 100644 --- a/res_partner_affiliate/__openerp__.py +++ b/res_partner_affiliate/__openerp__.py @@ -1,40 +1,21 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher -# Copyright 2012 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# Copyright 2012 Camptocamp SA - Yannick Vaucher +# Copyright 2017 Tecnativa - Vicent Cubells +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Partner Affiliates', - 'version': '8.0.1.0.0', - 'author': "Camptocamp,Odoo Community Association (OCA)", - 'maintainer': 'Camptocamp', + 'version': '9.0.1.0.0', + 'author': "Camptocamp, " + "Tecnativa, " + "Odoo Community Association (OCA)", + 'website': 'http://www.camptocamp.com', 'category': 'CRM', 'license': 'AGPL-3', - 'depends': ['base'], - 'description': """ - Allows to use parent_id in company partner to refer to a parent company - Plus will show a tab in parent company of affiliated companies""", - 'website': 'http://www.camptocamp.com', + 'installable': True, + 'depends': [ + 'base' + ], 'data': [ - 'res_partner_view.xml', + 'views/res_partner_view.xml', ], - 'demo': [], - 'installable': False, - 'auto_install': False, - 'application': True } diff --git a/res_partner_affiliate/models/__init__.py b/res_partner_affiliate/models/__init__.py new file mode 100644 index 000000000..67f136801 --- /dev/null +++ b/res_partner_affiliate/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# Copyright 2012 Camptocamp SA - Yannick Vaucher +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import res_partner diff --git a/res_partner_affiliate/models/res_partner.py b/res_partner_affiliate/models/res_partner.py new file mode 100644 index 000000000..8a33e85b1 --- /dev/null +++ b/res_partner_affiliate/models/res_partner.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Copyright 2012 Camptocamp SA - Yannick Vaucher +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import fields, models + + +class ResPartner(models.Model): + """Add relation affiliate_ids.""" + _inherit = "res.partner" + + child_ids = fields.One2many(domain=[('is_company', '=', False)]) + affiliate_ids = fields.One2many( + comodel_name='res.partner', + inverse_name='parent_id', + string='Affiliates', + domain=[('is_company', '=', True)], + ) diff --git a/res_partner_affiliate/res_partner.py b/res_partner_affiliate/res_partner.py deleted file mode 100644 index 259c86e46..000000000 --- a/res_partner_affiliate/res_partner.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# Author: Yannick Vaucher -# Copyright 2012 Camptocamp SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp.osv import orm, fields - - -class ResPartner(orm.Model): - """ - Add relation affiliate_ids - """ - _name = "res.partner" - _inherit = "res.partner" - - _columns = { - 'child_ids': fields.one2many( - 'res.partner', 'parent_id', - 'Contacts', domain=[('is_company', '=', False)]), - 'affiliate_ids': fields.one2many( - 'res.partner', 'parent_id', - 'Affiliates', domain=[('is_company', '=', True)]), - } diff --git a/res_partner_affiliate/res_partner_view.xml b/res_partner_affiliate/res_partner_view.xml deleted file mode 100644 index 837a99094..000000000 --- a/res_partner_affiliate/res_partner_view.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - res.partner.form - res.partner - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- X -
- - - - - - - - - - - - - - - - -
-
- - - - -
-

-
-
- -
Phone:
-
Mobile:
-
Fax:
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
diff --git a/res_partner_affiliate/views/res_partner_view.xml b/res_partner_affiliate/views/res_partner_view.xml new file mode 100644 index 000000000..95fc56c80 --- /dev/null +++ b/res_partner_affiliate/views/res_partner_view.xml @@ -0,0 +1,79 @@ + + + + + + res.partner.form + res.partner + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +