Browse Source

[IMP] partner_employee_quantity: black, isort

14.0
newtratip 5 years ago
parent
commit
0f62aa8e3b
  1. 31
      partner_employee_quantity/__manifest__.py
  2. 9
      partner_employee_quantity/models/res_partner.py
  3. 17
      partner_employee_quantity/views/res_partner_employee_quantity_range_view.xml
  4. 29
      partner_employee_quantity/views/res_partner_view.xml

31
partner_employee_quantity/__manifest__.py

@ -5,26 +5,21 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Employee quantity in partners',
'summary': 'Know how many employees a partner has',
'version': '12.0.1.0.0',
'category': 'Customer Relationship Management',
"author": 'Tecnativa, '
'Odoo Community Association (OCA)',
"name": "Employee quantity in partners",
"summary": "Know how many employees a partner has",
"version": "13.0.1.0.0",
"category": "Customer Relationship Management",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
'website': 'https://github.com/OCA/partner-contact',
'depends': [
'contacts',
],
'data': [
'security/ir.model.access.csv',
'views/res_partner_employee_quantity_range_view.xml',
'views/res_partner_view.xml',
],
'development_status': 'Mature',
'maintainers': [
'pedrobaeza',
"website": "https://github.com/OCA/partner-contact",
"depends": ["contacts"],
"data": [
"security/ir.model.access.csv",
"views/res_partner_employee_quantity_range_view.xml",
"views/res_partner_view.xml",
],
"development_status": "Mature",
"maintainers": ["pedrobaeza"],
"installable": True,
}

9
partner_employee_quantity/models/res_partner.py

@ -3,11 +3,11 @@
# Copyright 2018 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"
employee_quantity = fields.Integer()
employee_quantity_range_id = fields.Many2one(
@ -21,7 +21,4 @@ class ResPartnerEmployeeQuantityRange(models.Model):
_name = "res.partner.employee_quantity_range"
_description = "Partner employee quantity range"
name = fields.Char(
required=True,
translate=True
)
name = fields.Char(required=True, translate=True)

17
partner_employee_quantity/views/res_partner_employee_quantity_range_view.xml

@ -1,27 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="employees_range_action" model="ir.actions.act_window">
<field name="name">Ranges by quantity of employees</field>
<field name="res_model">res.partner.employee_quantity_range</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
</record>
<record id="employees_range_tree_view" model="ir.ui.view">
<field name="name">Quantity of employees ranges tree</field>
<field name="model">res.partner.employee_quantity_range</field>
<field name="arch" type="xml">
<tree string="Ranges by quantity of employees" editable="top">
<field name="name"/>
<field name="name" />
</tree>
</field>
</record>
<menuitem action="employees_range_action"
id="menu_employees_range"
parent="contacts.res_partner_menu_config"
sequence="0"
<menuitem
action="employees_range_action"
id="menu_employees_range"
parent="contacts.res_partner_menu_config"
sequence="0"
/>
</odoo>

29
partner_employee_quantity/views/res_partner_view.xml

@ -1,36 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="view_partner_form_employees">
<field name="name">Partner form with employees</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<page name="internal_notes" position="inside">
<group>
<group name="employee_quantity"
<group
name="employee_quantity"
string="Employee quantity"
attrs="{'invisible': [('is_company', '=', False)]}">
<field name="employee_quantity"/>
<field name="employee_quantity_range_id"/>
attrs="{'invisible': [('is_company', '=', False)]}"
>
<field name="employee_quantity" />
<field name="employee_quantity_range_id" />
</group>
</group>
</page>
</field>
</record>
<record model="ir.ui.view" id="view_res_partner_filter_employees">
<field name="name">Partner search with employees</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="inherit_id" ref="base.view_res_partner_filter" />
<field name="arch" type="xml">
<filter name="salesperson" position="after">
<filter name="employee_quantity"
string="Employee Quantity"
domain="[('is_company','=', True)]"
context="{'group_by': 'employee_quantity_range_id'}"/>
<filter
name="employee_quantity"
string="Employee Quantity"
domain="[('is_company','=', True)]"
context="{'group_by': 'employee_quantity_range_id'}"
/>
</filter>
</field>
</record>
</odoo>
Loading…
Cancel
Save