Browse Source

[ADD] partner_priority module

This module adds a priority field to contacts which can be configured within the configuration menu.

[UPD] LINT errors

fixed lint error, renamed test py file, added missing readme

[UPD] Removed unused file

removed incorrect py file

[FIX] wrong sequence val in test

Remove Test

[FIX] Data File Sequence

Fixed wrong sequence field name on data file.

[UPD] noupdate

Removed <data> element and moved noupdate into Odoo as suggested by reviewers.

[UPD] Reviewer Changes

Changes based on reviewer's suggestions

[UPD] Additional Review Changes

Additional changes requested from reviewers

[UPD] Sequence

Moved next sequence out of create method and into field def.

[UPD] Review Change

[FIX] LINT
pull/732/head
Patrick Wilson 6 years ago
committed by patrickrwilson
parent
commit
fad3971025
  1. 25
      partner_priority/README.rst
  2. 3
      partner_priority/__init__.py
  3. 24
      partner_priority/__manifest__.py
  4. 25
      partner_priority/data/partner_priority_data.xml
  5. 11
      partner_priority/data/partner_priority_sequence_data.xml
  6. 4
      partner_priority/models/__init__.py
  7. 15
      partner_priority/models/partner_priority.py
  8. 10
      partner_priority/models/res_partner.py
  9. 1
      partner_priority/readme/CONTRIBUTORS.rst
  10. 1
      partner_priority/readme/DESCRIPTION.rst
  11. 4
      partner_priority/readme/USAGE.rst
  12. 3
      partner_priority/security/ir.model.access.csv
  13. BIN
      partner_priority/static/description/icon.png
  14. 47
      partner_priority/views/partner_priority.xml
  15. 29
      partner_priority/views/res_partner.xml

25
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 <patrickraymondwilson@gmail.com>

3
partner_priority/__init__.py

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models

24
partner_priority/__manifest__.py

@ -0,0 +1,24 @@
# Copyright 2019 Patrick Wilson <patrickraymondwilson@gmail.com>
# 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'],
}

25
partner_priority/data/partner_priority_data.xml

@ -0,0 +1,25 @@
<!-- Copyright 2019 Patrick Wilson <patrickraymondwilson@gmail.com>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record id="res_partner_priority_low" model="partner.priority">
<field name="name">Low</field>
<field name="description">Low Priority</field>
<field name="sequence">1</field>
</record>
<record id="res_partner_priority_normal" model="partner.priority">
<field name="name">Normal</field>
<field name="description">Normal Priority</field>
<field name="sequence">3</field>
</record>
<record id="res_partner_priority_elavated" model="partner.priority">
<field name="name">Elevated</field>
<field name="description">Elevated Priority</field>
<field name="sequence">5</field>
</record>
<record id="res_partner_priority_critical" model="partner.priority">
<field name="name">Critical</field>
<field name="description">Critical Priority</field>
<field name="sequence">8</field>
</record>
</odoo>

11
partner_priority/data/partner_priority_sequence_data.xml

@ -0,0 +1,11 @@
<!-- Copyright 2019 Patrick Wilson <patrickraymondwilson@gmail.com>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record id="partner_priority_seq" model="ir.sequence">
<field name="name">Priority Sequence</field>
<field name="code">partner.priority</field>
<field name="prefix">0</field>
<field name="padding">1</field>
</record>
</odoo>

4
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

15
partner_priority/models/partner_priority.py

@ -0,0 +1,15 @@
# Copyright 2019 Patrick Wilson <patrickraymondwilson@gmail.com>
# 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)

10
partner_priority/models/res_partner.py

@ -0,0 +1,10 @@
# Copyright 2019 Patrick Wilson <patrickraymondwilson@gmail.com>
# 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')

1
partner_priority/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Patrick Wilson <patrickraymondwilson@gmail.com>

1
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.

4
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.

3
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,

BIN
partner_priority/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

47
partner_priority/views/partner_priority.xml

@ -0,0 +1,47 @@
<!-- Copyright 2019 Patrick Wilson <patrickraymondwilson@gmail.com>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="partner_priority_view_list" model="ir.ui.view">
<field name="name">Priority List</field>
<field name="model">partner.priority</field>
<field name="arch" type="xml">
<tree string="Priority">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="description"/>
</tree>
</field>
</record>
<record id="partner_priority_view_form" model="ir.ui.view">
<field name="name">Priority Form</field>
<field name="model">partner.priority</field>
<field name="arch" type="xml">
<form string="Priority">
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Name" />
<h1><field name="name" /></h1>
</div>
<group>
<field name="description"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="partner_priority_action" model="ir.actions.act_window">
<field name="name">Priority Action</field>
<field name="res_model">partner.priority</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem
name="Priorities"
id="res_partner_priority_menu"
parent="contacts.res_partner_menu_config"
action="partner_priority_action"
sequence="101"/>
</odoo>

29
partner_priority/views/res_partner.xml

@ -0,0 +1,29 @@
<!-- Copyright 2019 Patrick Wilson <patrickraymondwilson@gmail.com>
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">partner.priority.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="category_id" position="after">
<field name="priority_id"
options="{'no_create': True, 'no_open': True}"/>
</field>
</field>
</record>
<record id="view_res_partner_filter" model="ir.ui.view">
<field name="name">partner.priority.filter</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<filter name="group_country" position="after">
<filter name="group_priority"
string="Priority"
context="{'group_by': 'priority_id'}"/>
</filter>
</field>
</record>
</odoo>
Loading…
Cancel
Save