Browse Source

[12.0][Add] partner_company_group

pull/724/head
Timon Tschanz 6 years ago
parent
commit
6d63bdc063
  1. 0
      partner_company_group/README.rst
  2. 1
      partner_company_group/__init__.py
  3. 24
      partner_company_group/__manifest__.py
  4. 4
      partner_company_group/models/__init__.py
  5. 13
      partner_company_group/models/account_invoice.py
  6. 13
      partner_company_group/models/crm_lead.py
  7. 17
      partner_company_group/models/res_partner.py
  8. 13
      partner_company_group/models/sale_order.py
  9. 1
      partner_company_group/readme/CONTRIBUTORS.rst
  10. 1
      partner_company_group/readme/DESCRIPTION.rst
  11. 17
      partner_company_group/views/account_invoice_view.xml
  12. 27
      partner_company_group/views/contact_view.xml
  13. 16
      partner_company_group/views/opportunity_view.xml
  14. 16
      partner_company_group/views/sale_order_view.xml

0
partner_company_group/README.rst

1
partner_company_group/__init__.py

@ -0,0 +1 @@
from . import models

24
partner_company_group/__manifest__.py

@ -0,0 +1,24 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Partner Company Group',
'summary': 'Adds the possibility to add a company group to a company',
'version': '12.0.1.0.0',
'category': 'Sales',
'author': 'Camptocamp SA, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'depends': [
'base',
'account',
'crm',
'sale',
],
'website': 'https://github.com/OCA/partner-contact',
'data': [
'views/opportunity_view.xml',
'views/contact_view.xml',
'views/sale_order_view.xml',
'views/account_invoice_view.xml',
],
'installable': True,
}

4
partner_company_group/models/__init__.py

@ -0,0 +1,4 @@
from . import res_partner
from . import crm_lead
from . import sale_order
from . import account_invoice

13
partner_company_group/models/account_invoice.py

@ -0,0 +1,13 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
company_group_id = fields.Many2one(
related='partner_id.company_group_id',
store=True
)

13
partner_company_group/models/crm_lead.py

@ -0,0 +1,13 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
class CrmLead(models.Model):
_inherit = 'crm.lead'
company_group_id = fields.Many2one(
related='partner_id.company_group_id',
store=True
)

17
partner_company_group/models/res_partner.py

@ -0,0 +1,17 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
class Contact(models.Model):
_inherit = 'res.partner'
company_group_id = fields.Many2one(
'res.partner',
'Company group',
domain=[('is_company', '=', True)]
)
def _commercial_fields(self):
return super(Contact, self)._commercial_fields() + ['company_group_id']

13
partner_company_group/models/sale_order.py

@ -0,0 +1,13 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
class SaleOrder(models.Model):
_inherit = 'sale.order'
company_group_id = fields.Many2one(
related='partner_id.company_group_id',
store=True
)

1
partner_company_group/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
Timon Tschanz <timon.tschanz@camptocamp.com>

1
partner_company_group/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This Module adds a company group field to companies, which is also propagated to contacts and allows to search and group for the company group in contact, leads, sale orders and invoices.

17
partner_company_group/views/account_invoice_view.xml

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="account_invoice_search_view" model="ir.ui.view">
<field name="name">account.invoice.select</field>
<field name="model">account.invoice</field>
<field name="priority">2</field>
<field name="inherit_id" ref="account.view_account_invoice_filter"/>
<field name="arch" type="xml">
<field name="number" position="before">
<field name="company_group_id" />
</field>
<filter name="group_by_partner_id" position="before">
<filter name="group_company_group" string="Company Group" context="{'group_by': 'company_group_id'}"/>
</filter>
</field>
</record>
</odoo>

27
partner_company_group/views/contact_view.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="vat" position="before">
<field name="company_group_id" attrs="{'invisible': [('is_company','=', False)]}" />
</field>
</field>
</record>
<record id="view_res_partner_filter" model="ir.ui.view">
<field name="name">res.partner.select</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter" />
<field name="arch" type="xml">
<field name="name" position="before">
<field name="company_group_id" />
</field>
<filter name="group_company" position="before">
<filter name="group_company_group" string="Company Group" context="{'group_by': 'company_group_id'}"/>
</filter>
</field>
</record>
</odoo>

16
partner_company_group/views/opportunity_view.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_crm_case_opportunities_filter" model="ir.ui.view">
<field name="name">crm.lead.search.opportunity</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.view_crm_case_opportunities_filter" />
<field name="arch" type="xml">
<field name="name" position="before">
<field name="company_group_id" />
</field>
<filter name="salesperson" position="before">
<filter name="group_company_group" string="Company Group" context="{'group_by': 'company_group_id'}"/>
</filter>
</field>
</record>
</odoo>

16
partner_company_group/views/sale_order_view.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_sales_order_filter" model="ir.ui.view">
<field name="name">sale.order.list.select</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter" />
<field name="arch" type="xml">
<field name="name" position="before">
<field name="company_group_id" />
</field>
<filter name="customer" position="before">
<filter name="group_company_group" string="Company Group" context="{'group_by': 'company_group_id'}"/>
</filter>
</field>
</record>
</odoo>
Loading…
Cancel
Save