diff --git a/partner_priority/README.rst b/partner_priority/README.rst new file mode 100644 index 000000000..5a45a9e96 --- /dev/null +++ b/partner_priority/README.rst @@ -0,0 +1,25 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +================ +Partner Priority +================ + +This module adds priority on partners. Priorities can be used to rank partners or as a way to mark the sensitivity level of a customer. + +Usage +===== + +To use this module, you need to: + +#. Configure via CONTACT -> CONFIGURATION -> PRIORITIES. +#. Set the priority level on the partner form. + +Credits +======= + +Contributors +------------ + +* Patrick Wilson diff --git a/partner_priority/__init__.py b/partner_priority/__init__.py new file mode 100644 index 000000000..31660d6a9 --- /dev/null +++ b/partner_priority/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/partner_priority/__manifest__.py b/partner_priority/__manifest__.py new file mode 100644 index 000000000..86bd16cbf --- /dev/null +++ b/partner_priority/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2019 Patrick Wilson +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + 'name': 'Partner Priority', + 'summary': "Adds priority to partners.", + 'author': "Patrick Wilson, Odoo Community Association (OCA)", + 'website': "https://github.com/OCA/partner-contact", + 'category': 'Customer Relationship Management', + 'version': '12.0.1.0.0', + 'license': 'AGPL-3', + 'depends': [ + 'contacts', + ], + 'data': [ + 'views/res_partner.xml', + 'views/partner_priority.xml', + 'security/ir.model.access.csv', + 'data/partner_priority_data.xml', + 'data/partner_priority_sequence_data.xml', + ], + 'development_status': 'Beta', + 'maintainers': ['patrickrwilson'], +} diff --git a/partner_priority/data/partner_priority_data.xml b/partner_priority/data/partner_priority_data.xml new file mode 100644 index 000000000..ebfe533bb --- /dev/null +++ b/partner_priority/data/partner_priority_data.xml @@ -0,0 +1,25 @@ + + + + + Low + Low Priority + 1 + + + Normal + Normal Priority + 3 + + + Elevated + Elevated Priority + 5 + + + Critical + Critical Priority + 8 + + diff --git a/partner_priority/data/partner_priority_sequence_data.xml b/partner_priority/data/partner_priority_sequence_data.xml new file mode 100644 index 000000000..0e974a076 --- /dev/null +++ b/partner_priority/data/partner_priority_sequence_data.xml @@ -0,0 +1,11 @@ + + + + + Priority Sequence + partner.priority + 0 + 1 + + diff --git a/partner_priority/models/__init__.py b/partner_priority/models/__init__.py new file mode 100644 index 000000000..7aa45359c --- /dev/null +++ b/partner_priority/models/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import partner_priority +from . import res_partner diff --git a/partner_priority/models/partner_priority.py b/partner_priority/models/partner_priority.py new file mode 100644 index 000000000..e4bf4610e --- /dev/null +++ b/partner_priority/models/partner_priority.py @@ -0,0 +1,15 @@ +# Copyright 2019 Patrick Wilson +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class PartnerPriority(models.Model): + _name = 'partner.priority' + _order = 'sequence' + _description = 'Partner Priority' + + name = fields.Char(string="Priority", required=True) + description = fields.Text(required=True) + sequence = fields.Integer(required=True, default=lambda self: self.env[ + 'ir.sequence'].next_by_code('res.partner.priority') or 0) diff --git a/partner_priority/models/res_partner.py b/partner_priority/models/res_partner.py new file mode 100644 index 000000000..4f7c3bb28 --- /dev/null +++ b/partner_priority/models/res_partner.py @@ -0,0 +1,10 @@ +# Copyright 2019 Patrick Wilson +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + priority_id = fields.Many2one('partner.priority') diff --git a/partner_priority/readme/CONTRIBUTORS.rst b/partner_priority/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..4f895601b --- /dev/null +++ b/partner_priority/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Patrick Wilson diff --git a/partner_priority/readme/DESCRIPTION.rst b/partner_priority/readme/DESCRIPTION.rst new file mode 100644 index 000000000..21774046b --- /dev/null +++ b/partner_priority/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module adds priority on partners. Priorities can be used to rank partners or as a way to mark the sensitivity level of a customer. diff --git a/partner_priority/readme/USAGE.rst b/partner_priority/readme/USAGE.rst new file mode 100644 index 000000000..beb3d9d8a --- /dev/null +++ b/partner_priority/readme/USAGE.rst @@ -0,0 +1,4 @@ +To use this module, you need to: + +#. Configure via CONTACT -> CONFIGURATION -> PRIORITIES. +#. Set the priority level on the partner form. diff --git a/partner_priority/security/ir.model.access.csv b/partner_priority/security/ir.model.access.csv new file mode 100644 index 000000000..5bfff61ac --- /dev/null +++ b/partner_priority/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_partner_priority_user,partner.priority.user,model_partner_priority,base.group_user,1,0,0,0, +access_partner_priority_manager,partner.priority.manager,model_partner_priority,base.group_partner_manager,1,1,1,1, diff --git a/partner_priority/static/description/icon.png b/partner_priority/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/partner_priority/static/description/icon.png differ diff --git a/partner_priority/views/partner_priority.xml b/partner_priority/views/partner_priority.xml new file mode 100644 index 000000000..ddf0a3ada --- /dev/null +++ b/partner_priority/views/partner_priority.xml @@ -0,0 +1,47 @@ + + + + + Priority List + partner.priority + + + + + + + + + + + Priority Form + partner.priority + +
+ +
+
+ + + +
+
+
+
+ + + Priority Action + partner.priority + tree,form + + + +
diff --git a/partner_priority/views/res_partner.xml b/partner_priority/views/res_partner.xml new file mode 100644 index 000000000..208ab74ec --- /dev/null +++ b/partner_priority/views/res_partner.xml @@ -0,0 +1,29 @@ + + + + + partner.priority.form + res.partner + + + + + + + + + + partner.priority.filter + res.partner + + + + + + + +