Browse Source
Merge pull request #724 from tschanzt/add_partner_company_group
[12.0][Add] partner_company_group
pull/722/head
Alexandre Fayolle
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with
163 additions and
0 deletions
partner_company_group/README.rst
partner_company_group/__init__.py
partner_company_group/__manifest__.py
partner_company_group/models/__init__.py
partner_company_group/models/account_invoice.py
partner_company_group/models/crm_lead.py
partner_company_group/models/res_partner.py
partner_company_group/models/sale_order.py
partner_company_group/readme/CONTRIBUTORS.rst
partner_company_group/readme/DESCRIPTION.rst
partner_company_group/views/account_invoice_view.xml
partner_company_group/views/contact_view.xml
partner_company_group/views/opportunity_view.xml
partner_company_group/views/sale_order_view.xml
@ -0,0 +1 @@
from . import models
@ -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 ,
}
@ -0,0 +1,4 @@
from . import res_partner
from . import crm_lead
from . import sale_order
from . import account_invoice
@ -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
)
@ -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
)
@ -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 ' ]
@ -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
)
@ -0,0 +1 @@
Timon Tschanz <timon.tschanz@camptocamp.com>
@ -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.
@ -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>
@ -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>
@ -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>
@ -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>