From 665781d5a8524e73ce2649665d1113d9e6c854d6 Mon Sep 17 00:00:00 2001
From: Yannick Tivisse <yti@odoo.com>
Date: Thu, 11 Aug 2016 11:27:27 +0530
Subject: [PATCH] [IMP] various: Move all configuration fields from res_company
 form to the related modules

=======
Purpose
=======

The company form should be heavily simplified. It's complex to have some settings on the company form, and others on the Settings menu of the related app. It would be much easier to have all settings in Settings menu (res.config) and nothing on the company, even if some of the Settings are multi company. (Stored on the company but set from the Settings menu).
---
 addons/account/__openerp__.py                 |  1 -
 addons/account/models/res_config.py           | 11 ++---
 addons/account/views/company_view.xml         | 26 ------------
 addons/account/views/res_config_view.xml      | 15 ++++++-
 addons/auth_ldap/__openerp__.py               |  4 +-
 addons/auth_ldap/models/__init__.py           |  1 +
 .../models/auth_ldap_config_settings.py       | 10 +++++
 .../views/auth_ldap_config_settings_views.xml | 42 +++++++++++++++++++
 addons/auth_ldap/views/res_company_views.xml  | 37 ----------------
 addons/base_setup/models/res_config.py        | 16 +++++++
 addons/base_setup/views/res_config_views.xml  | 42 +++++++++++++++++++
 addons/hr_timesheet_attendance/__openerp__.py |  1 +
 .../models/__init__.py                        |  1 +
 .../models/project_config_settings.py         |  9 ++++
 ...sheet_attendance_config_settings_views.xml | 18 ++++++++
 .../views/hr_timesheet_sheet_views.xml        | 18 --------
 .../hr_timesheet_sheet_config_settings.py     |  1 +
 .../hr_timesheet_sheet/models/res_company.py  |  4 --
 ..._timesheet_sheet_config_settings_views.xml |  1 +
 .../views/hr_timesheet_sheet_views.xml        | 25 -----------
 addons/l10n_fr_hr_payroll/__openerp__.py      |  1 +
 addons/l10n_fr_hr_payroll/models/__init__.py  |  1 +
 .../l10n_fr_hr_payroll_config_settings.py     | 14 +++++++
 ...0n_fr_hr_payroll_config_settings_views.xml | 34 +++++++++++++++
 .../views/l10n_fr_hr_payroll_view.xml         | 21 ----------
 addons/mrp/__openerp__.py                     |  1 -
 addons/mrp/models/mrp_config_settings.py      |  3 ++
 .../mrp/views/mrp_config_settings_views.xml   |  4 ++
 addons/mrp/views/res_company_views.xml        | 17 --------
 addons/pad/__openerp__.py                     |  4 +-
 addons/pad/models/__init__.py                 |  1 +
 addons/pad/models/res_config.py               | 11 +++++
 addons/pad/views/res_company.xml              | 16 -------
 addons/pad/views/res_config_view.xml          | 22 ++++++++++
 addons/procurement/__openerp__.py             |  1 -
 .../procurement/views/res_company_views.xml   | 20 ---------
 addons/project/models/res_config.py           |  3 ++
 addons/project/views/project_views.xml        | 14 -------
 addons/project/views/res_config_views.xml     |  8 ++++
 addons/purchase/__openerp__.py                |  1 -
 addons/purchase/models/res_config.py          |  8 ++++
 addons/purchase/views/res_company_views.xml   | 19 ---------
 addons/purchase/views/res_config_views.xml    | 13 ++++++
 addons/report/__openerp__.py                  |  4 +-
 addons/report/models/__init__.py              |  1 +
 addons/report/models/base_config_settings.py  | 19 +++++++++
 .../views/base_config_settings_views.xml      | 23 ++++++++++
 addons/report/views/res_company_views.xml     | 25 -----------
 addons/sale/models/sale_config_settings.py    |  3 ++
 .../sale/views/sale_config_settings_views.xml |  9 +++-
 addons/sale/views/sale_views.xml              | 14 -------
 addons/sale_stock/__openerp__.py              |  1 -
 .../sale_stock/models/sale_config_settings.py |  1 +
 addons/sale_stock/views/res_company_views.xml | 16 -------
 .../views/sale_config_settings_views.xml      |  3 ++
 addons/sales_team/views/res_config_view.xml   |  2 +-
 openerp/addons/base/res/res_company_view.xml  | 30 -------------
 57 files changed, 350 insertions(+), 321 deletions(-)
 delete mode 100644 addons/account/views/company_view.xml
 create mode 100644 addons/auth_ldap/models/auth_ldap_config_settings.py
 create mode 100644 addons/auth_ldap/views/auth_ldap_config_settings_views.xml
 delete mode 100644 addons/auth_ldap/views/res_company_views.xml
 create mode 100644 addons/hr_timesheet_attendance/models/project_config_settings.py
 create mode 100644 addons/hr_timesheet_attendance/views/hr_timesheet_attendance_config_settings_views.xml
 create mode 100644 addons/l10n_fr_hr_payroll/models/l10n_fr_hr_payroll_config_settings.py
 create mode 100644 addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_config_settings_views.xml
 delete mode 100644 addons/mrp/views/res_company_views.xml
 create mode 100644 addons/pad/models/res_config.py
 delete mode 100644 addons/pad/views/res_company.xml
 create mode 100644 addons/pad/views/res_config_view.xml
 delete mode 100644 addons/procurement/views/res_company_views.xml
 delete mode 100644 addons/purchase/views/res_company_views.xml
 create mode 100644 addons/report/models/base_config_settings.py
 create mode 100644 addons/report/views/base_config_settings_views.xml
 delete mode 100644 addons/report/views/res_company_views.xml
 delete mode 100644 addons/sale_stock/views/res_company_views.xml

diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 477655ac2b6d..f3699bff5858 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -38,7 +38,6 @@ You could use this simplified accounting in case you work with an (external) acc
         'views/partner_view.xml',
         'views/product_view.xml',
         'views/account_analytic_view.xml',
-        'views/company_view.xml',
         'views/res_config_view.xml',
         'views/account_tip_data.xml',
         'views/account.xml',
diff --git a/addons/account/models/res_config.py b/addons/account/models/res_config.py
index 76de3db1d256..be03ef03a0fd 100644
--- a/addons/account/models/res_config.py
+++ b/addons/account/models/res_config.py
@@ -40,13 +40,13 @@ class AccountConfigSettings(models.TransientModel):
     has_chart_of_accounts = fields.Boolean(string='Company has a chart of accounts')
     chart_template_id = fields.Many2one('account.chart.template', string='Template',
         domain="[('visible','=', True)]")
-    use_anglo_saxon = fields.Boolean(string='Use Anglo-Saxon Accounting', related='company_id.anglo_saxon_accounting')
-    code_digits = fields.Integer(string='# of Digits', related='company_id.accounts_code_digits', help="No. of digits to use for account code")
+    use_anglo_saxon = fields.Boolean(string='Use Anglo-Saxon Accounting *', related='company_id.anglo_saxon_accounting')
+    code_digits = fields.Integer(string='# of Digits *', related='company_id.accounts_code_digits', help="No. of digits to use for account code")
     tax_calculation_rounding_method = fields.Selection(
         [
         ('round_per_line', 'Round calculation of taxes per line'),
         ('round_globally', 'Round globally calculation of taxes '),
-        ], related='company_id.tax_calculation_rounding_method', string='Tax calculation rounding method',
+        ], related='company_id.tax_calculation_rounding_method', string='Tax calculation rounding method *',
         help="""If you select 'Round per line' : for each tax, the tax amount will first be
              computed and rounded for each PO/SO/invoice line and then these rounded amounts will be summed,
              leading to the total amount for that tax. If you select 'Round globally': for each tax,
@@ -58,8 +58,8 @@ class AccountConfigSettings(models.TransientModel):
     purchase_tax_id = fields.Many2one('account.tax.template', string='Default purchase tax', oldname="purchase_tax")
     sale_tax_rate = fields.Float(string='Sales tax (%)')
     purchase_tax_rate = fields.Float(string='Purchase tax (%)')
-    bank_account_code_prefix = fields.Char(string='Bank Accounts Prefix', related='company_id.bank_account_code_prefix', help='Define the code prefix for the bank accounts', oldname='bank_account_code_char')
-    cash_account_code_prefix = fields.Char(string='Cash Accounts Prefix', related='company_id.cash_account_code_prefix', help='Define the code prefix for the cash accounts')
+    bank_account_code_prefix = fields.Char(string='Bank Accounts Prefix *', related='company_id.bank_account_code_prefix', help='Define the code prefix for the bank accounts', oldname='bank_account_code_char')
+    cash_account_code_prefix = fields.Char(string='Cash Accounts Prefix *', related='company_id.cash_account_code_prefix', help='Define the code prefix for the cash accounts')
     template_transfer_account_id = fields.Many2one('account.account.template', help="Intermediary account used when moving money from a liquidity account to another")
     transfer_account_id = fields.Many2one('account.account',
         related='company_id.transfer_account_id',
@@ -143,6 +143,7 @@ class AccountConfigSettings(models.TransientModel):
     module_account_bank_statement_import_csv = fields.Boolean("Import in .csv format",
         help='Get your bank statements from your bank and import them in Odoo in the .CSV format.\n'
             '-This installs the module account_bank_statement_import_csv.')
+    overdue_msg = fields.Text(related='company_id.overdue_msg', string='Overdue Payments Message *')
 
 
     @api.model
diff --git a/addons/account/views/company_view.xml b/addons/account/views/company_view.xml
deleted file mode 100644
index a3bd3fac5fcd..000000000000
--- a/addons/account/views/company_view.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
-    <data>
-        <record model="ir.ui.view" id="view_company_inherit_form">
-            <field name="name">res.company.form.inherit</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="model">res.company</field>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='account_grp']" position="inside">
-                    <field name="anglo_saxon_accounting"/>
-                    <field name="bank_account_code_prefix" groups="base.group_no_one"/>
-                    <field name="cash_account_code_prefix" groups="base.group_no_one"/>
-                    <field name="accounts_code_digits" groups="base.group_no_one"/>
-                    <field name="tax_calculation_rounding_method" groups="base.group_no_one"/>
-                </xpath>
-                <notebook position="inside">
-                    <page string="Overdue Payments">
-                        <separator string="Overdue Payments Message" colspan="4"/>
-                        <field name="overdue_msg" nolabel="1" colspan ="4"/>
-                    </page>
-                </notebook>
-            </field>
-        </record>
-
-    </data>
-</odoo>
diff --git a/addons/account/views/res_config_view.xml b/addons/account/views/res_config_view.xml
index ba595c74aa88..5840947cf1f0 100644
--- a/addons/account/views/res_config_view.xml
+++ b/addons/account/views/res_config_view.xml
@@ -98,7 +98,7 @@
                             </div>
                         </div>
                     </group>
-                    <group string="Accounting &amp; Finance">
+                    <group string="Accounting &amp; Finance" name="accounting">
                         <label for="id" string="Options"/>
                         <div name="account_config">
                             <div>
@@ -258,6 +258,19 @@
                     <group name="analytic_account_purchase" invisible="1">
                         <label for="id" string="Purchase"/>
                     </group>
+                    <group name="followup" position="before">
+                        <field name="use_anglo_saxon"/>
+                        <field name="bank_account_code_prefix" groups="base.group_no_one"/>
+                        <field name="cash_account_code_prefix" groups="base.group_no_one"/>
+                        <field name="code_digits" groups="base.group_no_one"/>
+                        <field name="tax_calculation_rounding_method" groups="base.group_no_one"/>
+                    </group>
+                    <group string="Overdue Payments" name="followup">
+                        <field name="overdue_msg"/>
+                    </group>
+                    <div>
+                        <span>(*) This configuration value is related to the company you're logged in.</span>
+                    </div>
                 </form>
             </field>
         </record>
diff --git a/addons/auth_ldap/__openerp__.py b/addons/auth_ldap/__openerp__.py
index 494521fb7dc1..39f37e79573f 100644
--- a/addons/auth_ldap/__openerp__.py
+++ b/addons/auth_ldap/__openerp__.py
@@ -2,13 +2,13 @@
 
 {
     'name' : 'Authentication via LDAP',
-    'depends' : ['base'],
+    'depends' : ['base', 'base_setup'],
     #'description': < auto-loaded from README file
     'category' : 'Extra Tools',
     'data' : [
-        'views/res_company_views.xml',
         'views/ldap_installer_views.xml',
         'security/ir.model.access.csv',
+        'views/auth_ldap_config_settings_views.xml',
     ],
     'external_dependencies' : {
         'python' : ['ldap'],
diff --git a/addons/auth_ldap/models/__init__.py b/addons/auth_ldap/models/__init__.py
index ddc234b54b17..5ee6a1b93fb5 100644
--- a/addons/auth_ldap/models/__init__.py
+++ b/addons/auth_ldap/models/__init__.py
@@ -3,3 +3,4 @@
 import res_company
 import res_company_ldap
 import res_users
+import auth_ldap_config_settings
\ No newline at end of file
diff --git a/addons/auth_ldap/models/auth_ldap_config_settings.py b/addons/auth_ldap/models/auth_ldap_config_settings.py
new file mode 100644
index 000000000000..2d29bca1f08e
--- /dev/null
+++ b/addons/auth_ldap/models/auth_ldap_config_settings.py
@@ -0,0 +1,10 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class BaseConfigSettings(models.TransientModel):
+    _inherit = 'base.config.settings'
+
+    ldaps = fields.One2many(related='company_id.ldaps', string="LDAP Parameters *")
diff --git a/addons/auth_ldap/views/auth_ldap_config_settings_views.xml b/addons/auth_ldap/views/auth_ldap_config_settings_views.xml
new file mode 100644
index 000000000000..b4586c8945d6
--- /dev/null
+++ b/addons/auth_ldap/views/auth_ldap_config_settings_views.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+    <record id="view_general_configuration_form_inherit_auth_ldap" model="ir.ui.view">
+        <field name="name">base.config.settings.form.inherit.auth.ldap</field>
+        <field name="model">base.config.settings</field>
+        <field name="inherit_id" ref="base_setup.view_general_configuration"/>
+        <field name="arch" type="xml">
+            <xpath expr="//group[@name='google_analytics']" position="after">
+                <group string="LDAP Parameters">
+                    <label for="ldaps"/>
+                    <div class="row">
+                        <div class="col-xs-6">
+                            <field name="ldaps">
+                                <form string="LDAP Configuration">
+                                    <group col="4">
+                                        <field name="ldap_server"/>
+                                        <field name="ldap_server_port"/>
+                                        <field name="ldap_binddn"/>
+                                        <field name="ldap_password" password="True"/>
+                                        <field name="ldap_base"/>
+                                        <field name="ldap_filter"/>
+                                        <field name="create_user"/>
+                                        <field name="user"/>
+                                        <newline/>
+                                        <field name="sequence"/>
+                                        <field name="ldap_tls"/>
+                                    </group>
+                                </form>
+                                <tree string="LDAP Configuration">
+                                    <field name="sequence"/>
+                                    <field name="ldap_server"/>
+                                    <field name="ldap_server_port"/>
+                                    <field name="ldap_base"/>
+                                </tree>
+                            </field>
+                        </div>
+                    </div>
+                </group>
+            </xpath>
+        </field>
+    </record>
+</odoo>
diff --git a/addons/auth_ldap/views/res_company_views.xml b/addons/auth_ldap/views/res_company_views.xml
deleted file mode 100644
index e3668c4e0a40..000000000000
--- a/addons/auth_ldap/views/res_company_views.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
-        <record id="company_form_view" model="ir.ui.view">
-            <field name="name">res.company.form.inherit</field>
-            <field name="model">res.company</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='account_grp']" position="after">
-                    <group string="LDAP Parameters">
-                        <field name="ldaps" nolabel="1" colspan="4">
-                            <form string="LDAP Configuration">
-                                <group col="4">
-                                    <field name="ldap_server"/>
-                                    <field name="ldap_server_port"/>
-                                    <field name="ldap_binddn"/>
-                                    <field name="ldap_password" password="True"/>
-                                    <field name="ldap_base"/>
-                                    <field name="ldap_filter"/>
-                                    <field name="create_user"/>
-                                    <field name="user"/>
-                                    <newline/>
-                                    <field name="sequence"/>
-                                    <field name="ldap_tls"/>
-                                </group>
-                            </form>
-                            <tree string="LDAP Configuration">
-                                <field name="sequence"/>
-                                <field name="ldap_server"/>
-                                <field name="ldap_server_port"/>
-                                <field name="ldap_base"/>
-                            </tree>
-                        </field>
-                    </group>
-                </xpath>
-            </field>
-        </record>
-</odoo>
diff --git a/addons/base_setup/models/res_config.py b/addons/base_setup/models/res_config.py
index d30a2771a5d3..8b1d9a5e8288 100644
--- a/addons/base_setup/models/res_config.py
+++ b/addons/base_setup/models/res_config.py
@@ -11,6 +11,8 @@ class BaseConfigSettings(models.TransientModel):
     group_multi_company = fields.Boolean(string='Manage multiple companies',
         help='Work in multi-company environments, with appropriate security access between companies.',
         implied_group='base.group_multi_company')
+    company_id = fields.Many2one('res.company', string='Company', required=True,
+        default=lambda self: self.env.user.company_id)
     module_share = fields.Boolean(string='Allow documents sharing',
         help="""Share or embbed any screen of Odoo.""")
     module_portal = fields.Boolean(string='Activate the customer portal',
@@ -32,6 +34,17 @@ class BaseConfigSettings(models.TransientModel):
             implied_group='base.group_multi_currency',
             help="Allows to work in a multi currency environment")
 
+    # Report config from base/res/res_company.py
+    custom_footer = fields.Boolean(related="company_id.custom_footer", string="Custom footer *", help="Check this to define the report footer manually. Otherwise it will be filled in automatically.")
+    rml_footer = fields.Text(related="company_id.rml_footer", string='Custom Report Footer *', help="Footer text displayed at the bottom of all reports.")
+    rml_footer_readonly = fields.Text(related='rml_footer', string='Report Footer *', readonly=True)
+    rml_paper_format = fields.Selection(related="company_id.rml_paper_format", string="Paper Format *", required=True)
+    font = fields.Many2one(related='company_id.font', string="Font *", help="Set the font into the report header, it will be used as default font in the RML reports of the user company")
+    rml_header = fields.Text(related="company_id.rml_header", string="RML Header *")
+    rml_header2 = fields.Text(related="company_id.rml_header2", string='RML Internal Header *')
+    rml_header3 = fields.Text(related="company_id.rml_header3", string='RML Internal Header for Landscape Reports *')
+
+
     @api.multi
     def open_company(self):
         return {
@@ -63,3 +76,6 @@ class BaseConfigSettings(models.TransientModel):
         partner_rule = self.env.ref('base.res_partner_rule')
         for config in self:
             partner_rule.write({'active': not config.company_share_partner})
+
+    def act_discover_fonts(self):
+        self.company_id.act_discover_fonts()
diff --git a/addons/base_setup/views/res_config_views.xml b/addons/base_setup/views/res_config_views.xml
index 1996530b637a..10c55e76b902 100644
--- a/addons/base_setup/views/res_config_views.xml
+++ b/addons/base_setup/views/res_config_views.xml
@@ -13,6 +13,7 @@
                     <div>
                         <label string="You will find more options in your company details: address for the header and footer, overdue payments texts, etc."/>
                         <button type="object" name="open_company" string="Configure your company data" icon="fa-cogs" class="oe_inline oe_link"/>
+                        <field name="company_id" invisible="1"/>
                     </div>
                     <group>
                         <label for="id" string="Email" name="email_label"/>
@@ -109,6 +110,47 @@
                             </div>
                         </div>
                     </group>
+                    <group string="Report Configuration" name="report">
+                        <label for="custom_footer"/>
+                        <div>
+                            <field name="custom_footer" class="oe_inline"/>                                
+                        </div>
+                        <label for="rml_footer"/>
+                        <div>
+                            <field name="rml_footer" class="oe_inline"/>                                
+                        </div>
+                        <label for="rml_footer_readonly"/>
+                        <div>
+                            <field name="rml_footer_readonly" class="oe_inline"/>                                
+                        </div>
+                    </group>
+                    <group string="RML Report Configuration" groups="base.group_no_one">
+                        <button name="%(base.preview_rml_report)d" string="Preview RML Report" type="action" colspan="2"/>
+                        <label for="rml_paper_format"/>
+                        <div>
+                            <field name="rml_paper_format" class="oe_inline"/>                                
+                        </div>
+                        <label for="font"/>
+                        <div>
+                            <field name="font" class="oe_inline"/>
+                            <button string="(reload fonts)" name="act_discover_fonts" type="object" class="oe_link"/>
+                        </div>
+                        <label for="rml_header"/>
+                        <div>
+                            <field name="rml_header"/>                                
+                        </div>
+                        <label for="rml_header2"/>
+                        <div>
+                            <field name="rml_header2"/>                                
+                        </div>
+                        <label for="rml_header3"/>
+                        <div>
+                            <field name="rml_header3"/>                                
+                        </div>
+                    </group>
+                    <div name="company_dependent_settings_message">
+                        <span>(*) This configuration value is related to the company you're logged in.</span>
+                    </div>
                 </form>
             </field>
         </record>
diff --git a/addons/hr_timesheet_attendance/__openerp__.py b/addons/hr_timesheet_attendance/__openerp__.py
index f3af1ac4711f..a5d3e3134649 100644
--- a/addons/hr_timesheet_attendance/__openerp__.py
+++ b/addons/hr_timesheet_attendance/__openerp__.py
@@ -12,6 +12,7 @@
         'security/ir.model.access.csv',
         'report/hr_timesheet_attendance_report_view.xml',
         'views/hr_timesheet_sheet_views.xml',
+        'views/hr_timesheet_attendance_config_settings_views.xml',
     ],
     'auto_install': True,
 }
diff --git a/addons/hr_timesheet_attendance/models/__init__.py b/addons/hr_timesheet_attendance/models/__init__.py
index e9110f22b7ce..24e4387943f1 100644
--- a/addons/hr_timesheet_attendance/models/__init__.py
+++ b/addons/hr_timesheet_attendance/models/__init__.py
@@ -4,3 +4,4 @@
 import hr_attendance
 import hr_timesheet_sheet
 import res_company
+import project_config_settings
\ No newline at end of file
diff --git a/addons/hr_timesheet_attendance/models/project_config_settings.py b/addons/hr_timesheet_attendance/models/project_config_settings.py
new file mode 100644
index 000000000000..d38f3520b509
--- /dev/null
+++ b/addons/hr_timesheet_attendance/models/project_config_settings.py
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+class HrTimesheetConfiguration(models.TransientModel):
+    _inherit = 'project.config.settings'
+
+    timesheet_max_difference = fields.Float(related='company_id.timesheet_max_difference', string="Timesheet allowed difference(Hours) *")
diff --git a/addons/hr_timesheet_attendance/views/hr_timesheet_attendance_config_settings_views.xml b/addons/hr_timesheet_attendance/views/hr_timesheet_attendance_config_settings_views.xml
new file mode 100644
index 000000000000..9a0365970945
--- /dev/null
+++ b/addons/hr_timesheet_attendance/views/hr_timesheet_attendance_config_settings_views.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+
+    <record id="view_config_settings_form_inherit_hr_timesheet_attendance" model="ir.ui.view">
+        <field name="name">project.config.settings.form.inherit.timesheet.attendance</field>
+        <field name="model">project.config.settings</field>
+        <field name="inherit_id" ref="hr_timesheet_sheet.view_config_settings_form_inherit_hr_timesheet_sheet"/>
+        <field name="arch" type="xml">
+            <xpath expr="//group[@name='timesheets']/label[@for='id']" position="before">
+                <label for="timesheet_max_difference"/>
+                <div>
+                    <field name="timesheet_max_difference" required="1" class="oe_inline"/>
+                </div>
+            </xpath>
+        </field>
+    </record>
+
+</odoo>
diff --git a/addons/hr_timesheet_attendance/views/hr_timesheet_sheet_views.xml b/addons/hr_timesheet_attendance/views/hr_timesheet_sheet_views.xml
index 2417c238ed88..56cadf5e0764 100644
--- a/addons/hr_timesheet_attendance/views/hr_timesheet_sheet_views.xml
+++ b/addons/hr_timesheet_attendance/views/hr_timesheet_sheet_views.xml
@@ -140,22 +140,4 @@
             </field>
         </record>
 
-        <!--
-            Company inheritancy
-        -->
-
-        <record id="hr_timesheet_sheet_company" model="ir.ui.view">
-            <field name="name">res.company.sheet</field>
-            <field name="model">res.company</field>
-            <field name="inherit_id" ref="hr_timesheet_sheet.hr_timesheet_sheet_company"/>
-            <field name="arch" type="xml">
-                <div class="o_hr_timesheet_sheet_timesheet_range" position="after">
-                    <div>
-                        <label for="timesheet_max_difference"/>
-                        <field name="timesheet_max_difference" required="1" class="oe_inline"/>
-                    </div>
-                </div>
-            </field>
-        </record>
-
 </odoo>
diff --git a/addons/hr_timesheet_sheet/models/hr_timesheet_sheet_config_settings.py b/addons/hr_timesheet_sheet/models/hr_timesheet_sheet_config_settings.py
index f26fcfb2561e..e48a18cdbe85 100644
--- a/addons/hr_timesheet_sheet/models/hr_timesheet_sheet_config_settings.py
+++ b/addons/hr_timesheet_sheet/models/hr_timesheet_sheet_config_settings.py
@@ -8,3 +8,4 @@ class HrTimesheetConfiguration(models.TransientModel):
     _inherit = 'project.config.settings'
 
     module_project_timesheet_synchro = fields.Boolean(string="Timesheet app for Chrome/Android/iOS")
+    timesheet_range = fields.Selection(related='company_id.timesheet_range', string="Timesheet range *")
diff --git a/addons/hr_timesheet_sheet/models/res_company.py b/addons/hr_timesheet_sheet/models/res_company.py
index 46267b9b8a2a..b4a5ef24ac2b 100644
--- a/addons/hr_timesheet_sheet/models/res_company.py
+++ b/addons/hr_timesheet_sheet/models/res_company.py
@@ -9,7 +9,3 @@ class ResCompany(models.Model):
 
     timesheet_range = fields.Selection([('week', 'Week'), ('month', 'Month')],
             default='week', string='Timesheet range', help="Periodicity on which you validate your timesheets.")
-    timesheet_max_difference = fields.Float(string='Timesheet allowed difference(Hours)',
-            help="Allowed difference in hours between the sign in/out and the timesheet " \
-                 "computation for one sheet. Set this to 0 if you do not want any control.",
-            default=0.0)
diff --git a/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_config_settings_views.xml b/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_config_settings_views.xml
index 695ea0ae1523..24e309070cfb 100644
--- a/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_config_settings_views.xml
+++ b/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_config_settings_views.xml
@@ -10,6 +10,7 @@
                 <attribute name="string">Timesheets</attribute>
             </xpath>
             <xpath expr="//group[@name='timesheets']" position="inside">
+                <field name="timesheet_range" required="1" class="oe_inline"/>
                 <label for="id" string="Extra features"/>
                 <div>
                     <field name="module_project_timesheet_synchro" widget="upgrade_boolean"/>
diff --git a/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_views.xml b/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_views.xml
index c308e1ccaa5d..8418b61a9214 100644
--- a/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_views.xml
+++ b/addons/hr_timesheet_sheet/views/hr_timesheet_sheet_views.xml
@@ -192,31 +192,6 @@
         <menuitem action="act_hr_timesheet_sheet_form" id="menu_act_hr_timesheet_sheet_form" parent="menu_hr_to_approve"
              sequence="11" groups="base.group_hr_user"/>
 
-
-        <!--
-            Company inheritancy
-        -->
-
-        <record id="hr_timesheet_sheet_company" model="ir.ui.view">
-            <field name="name">res.company.sheet</field>
-            <field name="model">res.company</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='account_grp']" position="after">
-                    <group name="timesheets_grp" string="Timesheets">
-                        <div class="o_hr_timesheet_sheet_timesheet_range">
-                            <label for="timesheet_range"/>
-                            <field name="timesheet_range" required="1" class="oe_inline"/>
-                        </div>
-                        <!-- <div>
-                            <label for="timesheet_max_difference"/>
-                            <field name="timesheet_max_difference" required="1" class="oe_inline"/>
-                        </div> -->
-                    </group>
-                </xpath>
-            </field>
-        </record>
-
         <!--
             account.analytic.line inheritancy
         -->
diff --git a/addons/l10n_fr_hr_payroll/__openerp__.py b/addons/l10n_fr_hr_payroll/__openerp__.py
index 633d6f7e0c58..22845132713b 100644
--- a/addons/l10n_fr_hr_payroll/__openerp__.py
+++ b/addons/l10n_fr_hr_payroll/__openerp__.py
@@ -30,5 +30,6 @@ TODO:
         'views/l10n_fr_hr_payroll_view.xml',
         'report/report_l10n_fr_fiche_paye.xml',
         'report/l10n_fr_hr_payroll_report.xml',
+        'views/l10n_fr_hr_payroll_config_settings_views.xml',
     ],
 }
diff --git a/addons/l10n_fr_hr_payroll/models/__init__.py b/addons/l10n_fr_hr_payroll/models/__init__.py
index efba7da1eb69..caab8c46be88 100644
--- a/addons/l10n_fr_hr_payroll/models/__init__.py
+++ b/addons/l10n_fr_hr_payroll/models/__init__.py
@@ -2,3 +2,4 @@
 # Part of Odoo. See LICENSE file for full copyright and licensing details.
 
 import l10n_fr_hr_payroll
+import l10n_fr_hr_payroll_config_settings
diff --git a/addons/l10n_fr_hr_payroll/models/l10n_fr_hr_payroll_config_settings.py b/addons/l10n_fr_hr_payroll/models/l10n_fr_hr_payroll_config_settings.py
new file mode 100644
index 000000000000..9aa25a344064
--- /dev/null
+++ b/addons/l10n_fr_hr_payroll/models/l10n_fr_hr_payroll_config_settings.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class AccountConfigSettings(models.TransientModel):
+    _inherit = 'account.config.settings'
+
+    plafond_secu = fields.Float(related='company_id.plafond_secu', string="Plafond de la Securite Sociale *")
+    nombre_employes = fields.Integer(related='company_id.nombre_employes', string="Nombre d'employes *")
+    cotisation_prevoyance = fields.Float(related='company_id.cotisation_prevoyance', string='Cotisation Patronale Prevoyance *')
+    org_ss = fields.Char(related='company_id.org_ss', string="Organisme de securite sociale *")
+    conv_coll = fields.Char(related='company_id.conv_coll', string="Convention collective *")
diff --git a/addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_config_settings_views.xml b/addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_config_settings_views.xml
new file mode 100644
index 000000000000..1be56bf28b0c
--- /dev/null
+++ b/addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_config_settings_views.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+    <record id="view_account_config_settings_form_inherit_l10n_fr_hr_payroll" model="ir.ui.view">
+        <field name="name">view.account.config.form.inherit.l10n.fr.hr.payroll</field>
+        <field name="model">account.config.settings</field>
+        <field name="inherit_id" ref="account.view_account_config_settings"/>
+        <field name="arch" type="xml">
+            <xpath expr="//group[@name='followup']" position="before">
+                <group string="Paie">
+                    <label for="plafond_secu"/>
+                    <div>
+                        <field name="plafond_secu" class="oe_inline"/>
+                    </div>
+                    <label for="nombre_employes"/>
+                    <div>
+                        <field name="nombre_employes" class="oe_inline"/>
+                    </div>
+                    <label for="cotisation_prevoyance"/>
+                    <div>
+                        <field name="cotisation_prevoyance" class="oe_inline"/>
+                    </div>
+                    <label for="org_ss"/>
+                    <div>
+                        <field name="org_ss" class="oe_inline"/>
+                    </div>
+                    <label for="conv_coll"/>
+                    <div>
+                        <field name="conv_coll" class="oe_inline"/>
+                    </div>
+                </group>
+            </xpath>
+        </field>
+    </record>
+</odoo>
diff --git a/addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_view.xml b/addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_view.xml
index f2b0b89447e5..e97b918ab622 100644
--- a/addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_view.xml
+++ b/addons/l10n_fr_hr_payroll/views/l10n_fr_hr_payroll_view.xml
@@ -1,26 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <odoo>
-        <record id="res_company_form_l10n_fr_payroll" model="ir.ui.view">
-            <field name="name">res.company.form.l10n.fr.payroll</field>
-            <field name="model">res.company</field>
-            <field name="priority">20</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-            <data>
-                 <xpath expr="//group[@name='account_grp']" position="after">
-                    <group string="Paie">
-                            <field name="plafond_secu"/>
-                            <field name="nombre_employes"/>
-                            <newline/>
-                            <field name="org_ss"/>
-                            <newline/>
-                            <field name="conv_coll"/>
-                    </group>
-                 </xpath>
-            </data>
-            </field>
-        </record>
-
         <record id="hr_contract_view_form_l10n_fr_payroll" model="ir.ui.view">
             <field name="name">hr.contract.view.form.l10n.fr.payroll</field>
             <field name="model">hr.contract</field>
diff --git a/addons/mrp/__openerp__.py b/addons/mrp/__openerp__.py
index 45d9248247e2..e8b5aa798e6d 100644
--- a/addons/mrp/__openerp__.py
+++ b/addons/mrp/__openerp__.py
@@ -56,7 +56,6 @@ Dashboard / Reports for MRP will include:
         'views/stock_picking_views.xml',
         'views/mrp_unbuild_views.xml',
         'views/ir_attachment_view.xml',
-        'views/res_company_views.xml',
         'views/mrp_config_settings_views.xml',
         'views/mrp_templates.xml',
         'views/stock_scrap_views.xml',
diff --git a/addons/mrp/models/mrp_config_settings.py b/addons/mrp/models/mrp_config_settings.py
index df7d4ac75833..02d609c7ea0c 100644
--- a/addons/mrp/models/mrp_config_settings.py
+++ b/addons/mrp/models/mrp_config_settings.py
@@ -8,6 +8,9 @@ class MrpConfigSettings(models.TransientModel):
     _name = 'mrp.config.settings'
     _inherit = 'res.config.settings'
 
+    company_id = fields.Many2one('res.company', string='Company', required=True,
+        default=lambda self: self.env.user.company_id)
+    manufacturing_lead = fields.Float(related='company_id.manufacturing_lead', string="Manufacturing Lead Time *")
     group_product_variant = fields.Selection([
         (0, "No variants on products"),
         (1, 'Products can have several attributes, defining variants (Example: size, color,...)')], "Product Variants",
diff --git a/addons/mrp/views/mrp_config_settings_views.xml b/addons/mrp/views/mrp_config_settings_views.xml
index 1d5399097356..148a99cbd483 100644
--- a/addons/mrp/views/mrp_config_settings_views.xml
+++ b/addons/mrp/views/mrp_config_settings_views.xml
@@ -10,6 +10,10 @@
                         <button string="Apply" type="object" name="execute" class="oe_highlight"/>
                         <button string="Cancel" type="object" name="cancel" class="oe_link"/>
                     </header>
+                    <group string="Logistics" name="logistics">
+                        <field name="company_id" invisible="1"/>
+                        <field name="manufacturing_lead"/>
+                    </group>
                     <group string="Manufacturing Order">
                         <field name="group_product_variant" widget="radio"/>
                         <field name="module_mrp_byproduct" widget="radio"/>
diff --git a/addons/mrp/views/res_company_views.xml b/addons/mrp/views/res_company_views.xml
deleted file mode 100644
index fb83243ca863..000000000000
--- a/addons/mrp/views/res_company_views.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" ?>
-<odoo>
-    <data>
-        <record id="mrp_company" model="ir.ui.view">
-            <field name="name">res.company.mrp.config</field>
-            <field name="model">res.company</field>
-            <field name="priority">22</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='logistics_grp']" position="inside">
-                   <field name="manufacturing_lead"/>
-                </xpath>
-            </field>
-        </record>
-
-    </data>
-</odoo>
diff --git a/addons/pad/__openerp__.py b/addons/pad/__openerp__.py
index ceb027bf5926..3d68dcb22331 100644
--- a/addons/pad/__openerp__.py
+++ b/addons/pad/__openerp__.py
@@ -13,10 +13,10 @@ Lets the company customize which Pad installation should be used to link to new
 pads (by default, http://etherpad.com/).
     """,
     'website': 'https://www.odoo.com/page/notes',
-    'depends': ['web'],
+    'depends': ['web', 'base_setup'],
     'data': [
         'views/pad.xml',
-        'views/res_company.xml',
+        'views/res_config_view.xml',
     ],
     'demo': ['data/pad_demo.xml'],
     'web': True,
diff --git a/addons/pad/models/__init__.py b/addons/pad/models/__init__.py
index 53c307d5e759..8782ea601402 100644
--- a/addons/pad/models/__init__.py
+++ b/addons/pad/models/__init__.py
@@ -3,3 +3,4 @@
 
 import pad
 import res_company
+import res_config
diff --git a/addons/pad/models/res_config.py b/addons/pad/models/res_config.py
new file mode 100644
index 000000000000..304ee9263587
--- /dev/null
+++ b/addons/pad/models/res_config.py
@@ -0,0 +1,11 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class BaseConfigSettings(models.TransientModel):
+    _inherit = 'base.config.settings'
+
+    pad_server = fields.Char(related='company_id.pad_server', string="Pad Server *")
+    pad_key = fields.Char(related='company_id.pad_key', string="Pad Api Key *")
diff --git a/addons/pad/views/res_company.xml b/addons/pad/views/res_company.xml
deleted file mode 100644
index 852aedd75931..000000000000
--- a/addons/pad/views/res_company.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
-    <record id="view_company_form_inherit_pad" model="ir.ui.view">
-        <field name="name">res.company.form.inherit</field>
-        <field name="model">res.company</field>
-        <field name="inherit_id" ref="base.view_company_form" />
-        <field name="arch" type="xml">
-            <xpath expr="//group[@name='account_grp']" position="after">
-                <group string="Pads">
-                    <field name="pad_server" placeholder="e.g. beta.primarypad.com" />
-                    <field name="pad_key" />
-                </group>
-            </xpath>
-        </field>
-    </record>
-</odoo>
diff --git a/addons/pad/views/res_config_view.xml b/addons/pad/views/res_config_view.xml
new file mode 100644
index 000000000000..29056eeb282c
--- /dev/null
+++ b/addons/pad/views/res_config_view.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+    <record id="view_general_configuration_form_inherit_pad" model="ir.ui.view">
+        <field name="name">base.config.settings.form.inherit</field>
+        <field name="model">base.config.settings</field>
+        <field name="inherit_id" ref="base_setup.view_general_configuration"/>
+        <field name="arch" type="xml">
+            <xpath expr="//group[@name='google']" position="before">
+                <group string="Pads">
+                    <label for="pad_server"/>
+                    <div>
+                        <field name="pad_server" placeholder="e.g. beta.primarypad.com" class="oe_inline"/>
+                    </div>
+                    <label for="pad_key"/>
+                    <div>
+                        <field name="pad_key" class="oe_inline"/>
+                    </div>
+                </group>
+            </xpath>
+        </field>
+    </record>
+</odoo>
diff --git a/addons/procurement/__openerp__.py b/addons/procurement/__openerp__.py
index 44e30dfda943..0c53385701bf 100644
--- a/addons/procurement/__openerp__.py
+++ b/addons/procurement/__openerp__.py
@@ -34,7 +34,6 @@ Procurements in exception should be checked manually and can be re-run.
         'data/procurement_data.xml',
         'wizard/procurement_order_compute_all_views.xml',
         'views/procurement_views.xml',
-        'views/res_company_views.xml',
         'views/product_views.xml',
     ],
     'demo': [],
diff --git a/addons/procurement/views/res_company_views.xml b/addons/procurement/views/res_company_views.xml
deleted file mode 100644
index c3c69eb84200..000000000000
--- a/addons/procurement/views/res_company_views.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" ?>
-<odoo>
-    <data>
-
-        <record id="mrp_company" model="ir.ui.view">
-            <field name="name">res.company.mrp.config</field>
-            <field name="model">res.company</field>
-            <field name="priority">17</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='account_grp']" position="after">
-                    <group name="logistics_grp" string="Logistics">
-                        <!-- This group will be filled by other modules like sale_stock, mrp, purchase... -->
-                    </group>
-                </xpath>
-            </field>
-       </record>
-    
-    </data>
-</odoo>
diff --git a/addons/project/models/res_config.py b/addons/project/models/res_config.py
index f7092a024da6..a5588d87620a 100644
--- a/addons/project/models/res_config.py
+++ b/addons/project/models/res_config.py
@@ -8,6 +8,9 @@ class ProjectConfiguration(models.TransientModel):
     _name = 'project.config.settings'
     _inherit = 'res.config.settings'
 
+    company_id = fields.Many2one('res.company', string='Company', required=True,
+        default=lambda self: self.env.user.company_id)
+    project_time_mode_id = fields.Many2one(related='company_id.project_time_mode_id', string="Project Time Unit *")
     module_pad = fields.Selection([
         (0, "Task description is a plain text"),
         (1, "Collaborative rich text on task description")
diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml
index aa3994902eec..dc8013c4e157 100644
--- a/addons/project/views/project_views.xml
+++ b/addons/project/views/project_views.xml
@@ -685,20 +685,6 @@ action = model.activate_sample_project()
         <menuitem action="open_view_project_all" id="menu_projects" name="Dashboard" parent="base.menu_main_pm" sequence="1"/>
         <menuitem action="open_view_project_all_config" id="menu_projects_config" name="Projects" parent="menu_project_config" sequence="10"/>
 
-
-        <record id="task_company" model="ir.ui.view">
-            <field name="name">res.company.task.config</field>
-            <field name="model">res.company</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='account_grp']" position="after">
-                    <group name="project_grp" string="Projects">
-                        <field name="project_time_mode_id" domain="[('category_id','=', %(product.uom_categ_wtime)d)]" groups="base.group_no_one"/>
-                    </group>
-                </xpath>
-            </field>
-        </record>
-
         <!-- User Form -->
         <act_window context="{'search_default_user_id': [active_id], 'default_user_id': active_id}"
                     id="act_res_users_2_project_task_opened" name="Assigned Tasks"
diff --git a/addons/project/views/res_config_views.xml b/addons/project/views/res_config_views.xml
index 73c8551e0bab..3a7abe453e1c 100644
--- a/addons/project/views/res_config_views.xml
+++ b/addons/project/views/res_config_views.xml
@@ -11,6 +11,11 @@
                         <button string="Cancel" type="object" name="cancel" class="oe_link"/>
                     </header>
                     <group string="Project Management" name="project_management">
+                        <field name="company_id" invisible="1"/>
+                        <label for="project_time_mode_id" groups="base.group_no_one"/>
+                        <div groups="base.group_no_one">
+                            <field name="project_time_mode_id" domain="[('category_id','=', %(product.uom_categ_wtime)d)]" class="oe_inline"/>
+                        </div>
                         <field name="module_pad" widget="radio"/>
                         <label for="id" string="Forecasts"/>
                         <div>
@@ -23,6 +28,9 @@
                         <field name="module_rating_project" widget="radio"/>
                     </group>
                     <group name="timesheets"/>
+                    <div>
+                        <span>(*) This configuration value is related to the company you're logged in.</span>
+                    </div>
                 </form>
             </field>
         </record>
diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py
index 5002fd853c2e..3c3470196e3b 100644
--- a/addons/purchase/__openerp__.py
+++ b/addons/purchase/__openerp__.py
@@ -30,7 +30,6 @@ Dashboard / Reports for Purchase Management will include:
         'security/purchase_security.xml',
         'security/ir.model.access.csv',
         'views/account_invoice_views.xml',
-        'views/res_company_views.xml',
         'data/purchase_data.xml',
         'data/purchase_data.yml',
         'report/purchase_reports.xml',
diff --git a/addons/purchase/models/res_config.py b/addons/purchase/models/res_config.py
index ce5244466d0e..1a359e40b3bc 100644
--- a/addons/purchase/models/res_config.py
+++ b/addons/purchase/models/res_config.py
@@ -8,6 +8,14 @@ class PurchaseConfigSettings(models.TransientModel):
     _name = 'purchase.config.settings'
     _inherit = 'res.config.settings'
 
+    company_id = fields.Many2one('res.company', string='Company', required=True,
+        default=lambda self: self.env.user.company_id)
+    po_lead = fields.Float(related='company_id.po_lead', string="Purchase Lead Time *")
+    po_lock = fields.Selection(related='company_id.po_lock', string="Purchase Order Modification *")
+    po_double_validation = fields.Selection(related='company_id.po_double_validation', string="Levels of Approvals *")
+    po_double_validation_amount = fields.Monetary(related='company_id.po_double_validation_amount', string="Double validation amount *", currency_field='company_currency_id')
+    company_currency_id = fields.Many2one('res.currency', related='company_id.currency_id', readonly=True,
+        help='Utility field to express amount currency')
     group_product_variant = fields.Selection([
         (0, "No variants on products"),
         (1, 'Products can have several attributes, defining variants (Example: size, color,...)')
diff --git a/addons/purchase/views/res_company_views.xml b/addons/purchase/views/res_company_views.xml
deleted file mode 100644
index 2b94a56a32b4..000000000000
--- a/addons/purchase/views/res_company_views.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
-
-        <record id="mrp_company" model="ir.ui.view">
-            <field name="name">res.company.mrp.config</field>
-            <field name="model">res.company</field>
-            <field name="priority">19</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='logistics_grp']" position="inside">
-                        <field name="po_lead"/>
-                        <field name="po_lock" widget="radio"/>
-                        <field name="po_double_validation" widget="radio"/>
-                        <field name="po_double_validation_amount" attrs="{'invisible': [('po_double_validation', '=', 'one_step')]}"/>
-                </xpath>
-            </field>
-        </record>
-
-</odoo>
diff --git a/addons/purchase/views/res_config_views.xml b/addons/purchase/views/res_config_views.xml
index ecdf91bf0f99..83dffcef86bb 100644
--- a/addons/purchase/views/res_config_views.xml
+++ b/addons/purchase/views/res_config_views.xml
@@ -9,6 +9,16 @@
                         <button string="Apply" type="object" name="execute" class="oe_highlight"/>
                         <button string="Cancel" type="object" name="cancel" class="oe_link"/>
                     </header>
+                    <group string="Logistics">
+                        <group>
+                            <field name="company_id" invisible="1"/>
+                            <field name="company_currency_id" invisible="1"/>
+                            <field name="po_lead"/>
+                            <field name="po_lock" widget="radio"/>
+                            <field name="po_double_validation" widget="radio"/>
+                            <field name="po_double_validation_amount" attrs="{'invisible': [('po_double_validation', '=', 'one_step')]}"/>
+                        </group>
+                    </group>
                     <group string="Purchase Order">
                         <field name="group_product_variant" widget="radio"/>
                         <field name="group_uom" widget="radio"/>
@@ -20,6 +30,9 @@
                     <group string="Location &amp; Warehouse">
                         <field name="module_stock_dropshipping" widget="radio"/>
                     </group>
+                    <div>
+                        <span>(*) This configuration value is related to the company you're logged in.</span>
+                    </div>
                 </form>
             </field>
         </record>
diff --git a/addons/report/__openerp__.py b/addons/report/__openerp__.py
index 5ef4ba42d54c..aa2f81daa26a 100644
--- a/addons/report/__openerp__.py
+++ b/addons/report/__openerp__.py
@@ -8,14 +8,14 @@
     'description': """
 Report
         """,
-    'depends': ['base', 'web'],
+    'depends': ['base', 'web', 'base_setup'],
     'data': [
         'data/report_paperformat_data.xml',
         'security/ir.model.access.csv',
         'views/layout_templates.xml',
         'views/report_paperformat_views.xml',
         'views/report_templates.xml',
-        'views/res_company_views.xml',
+        'views/base_config_settings_views.xml',
         'views/ir_actions_report_views.xml',
     ],
     'qweb' : [
diff --git a/addons/report/models/__init__.py b/addons/report/models/__init__.py
index cc85d6af6a2f..930243398333 100644
--- a/addons/report/models/__init__.py
+++ b/addons/report/models/__init__.py
@@ -2,6 +2,7 @@
 # Part of Odoo. See LICENSE file for full copyright and licensing details.
 
 import abstract_report
+import base_config_settings
 import ir_actions_report_xml
 import ir_http
 import ir_qweb
diff --git a/addons/report/models/base_config_settings.py b/addons/report/models/base_config_settings.py
new file mode 100644
index 000000000000..16e2e0142f5d
--- /dev/null
+++ b/addons/report/models/base_config_settings.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models
+
+
+class BaseConfigSettings(models.TransientModel):
+    _inherit = 'base.config.settings'
+
+    paperformat_id = fields.Many2one(related="company_id.paperformat_id", string='Paper format *')
+
+    def edit_external_header(self):
+        return self.company_id.edit_external_header()
+
+    def edit_external_footer(self):
+        return self.company_id.edit_external_footer()
+
+    def edit_internal_header(self):
+        return self.company_id.edit_internal_header()
diff --git a/addons/report/views/base_config_settings_views.xml b/addons/report/views/base_config_settings_views.xml
new file mode 100644
index 000000000000..5e2766736f79
--- /dev/null
+++ b/addons/report/views/base_config_settings_views.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+    <record id="base_config_settings_inherited" model="ir.ui.view">
+        <field name="name">base.config.settings.inherited</field>
+        <field name="inherit_id" ref="base_setup.view_general_configuration"/>
+        <field name="model">base.config.settings</field>
+        <field name="arch" type="xml">
+            <data>
+                <group name="report" position="inside">
+                    <label for="paperformat_id"/>
+                    <div>
+                        <field name="paperformat_id" class="oe_inline"/>
+                        <button name="%(action_report_internalpreview)d" string="Preview Internal Report" type="action"/>
+                        <button name="%(action_report_externalpreview)d" string="Preview External Report" type="action"/>
+                        <button name="edit_external_header" string="Edit external header" type="object" class="oe_link"/>
+                        <button name="edit_external_footer" string="Edit external footer" type="object" class="oe_link"/>
+                        <button name="edit_internal_header" string="Edit internal header" type="object" class="oe_link"/>
+                    </div>
+                </group>
+            </data>
+        </field>
+    </record>
+</odoo>
diff --git a/addons/report/views/res_company_views.xml b/addons/report/views/res_company_views.xml
deleted file mode 100644
index d5ecab58bd92..000000000000
--- a/addons/report/views/res_company_views.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
-        <record id="reporting_settings_form_inherited" model="ir.ui.view">
-            <field name="name">view_company_form_inherited</field>
-            <field name="inherit_id" ref="base.view_company_form" />
-            <field name="model">res.company</field>
-            <field name="arch" type="xml">
-                <data>
-                    <xpath expr="//page[@name='report']/group[1]" position="inside">
-                        <group col="2" colspan="2">
-                            <field name="paperformat_id" />
-                        </group>
-                        <group col="1" colspan="2" groups="base.group_no_one">
-                            <button name="%(action_report_internalpreview)d" string="Preview Internal Report" type="action"/>
-                            <button name="%(action_report_externalpreview)d" string="Preview External Report" type="action"/>
-                            <button name="edit_external_header" string="Edit external header" type="object" class="oe_link"/>
-                            <button name="edit_external_footer" string="Edit external footer" type="object" class="oe_link"/>
-                            <button name="edit_internal_header" string="Edit internal header" type="object" class="oe_link"/>
-                        </group>
-                    </xpath>
-                </data>
-            </field>
-        </record>
-
-</odoo>
diff --git a/addons/sale/models/sale_config_settings.py b/addons/sale/models/sale_config_settings.py
index 9b98af88c14d..7c407354070d 100644
--- a/addons/sale/models/sale_config_settings.py
+++ b/addons/sale/models/sale_config_settings.py
@@ -11,6 +11,9 @@ _logger = logging.getLogger(__name__)
 class SaleConfiguration(models.TransientModel):
     _inherit = 'sale.config.settings'
 
+    company_id = fields.Many2one('res.company', string='Company', required=True,
+        default=lambda self: self.env.user.company_id)
+    sale_note = fields.Text(related='company_id.sale_note', string="Default Terms and Conditions *")
     group_product_variant = fields.Selection([
         (0, "No variants on products"),
         (1, 'Products can have several attributes, defining variants (Example: size, color,...)')
diff --git a/addons/sale/views/sale_config_settings_views.xml b/addons/sale/views/sale_config_settings_views.xml
index d384552babc3..500aa9bc191f 100644
--- a/addons/sale/views/sale_config_settings_views.xml
+++ b/addons/sale/views/sale_config_settings_views.xml
@@ -27,6 +27,8 @@
                         </div>
                     </group>
                     <group string="Quotations &amp; Sales" id="sale" name="quotations_sales">
+                        <field name="company_id" invisible="1"/>
+                        <field name="sale_note"/>
                         <field name="group_sale_delivery_address" widget="radio"/>
                         <field name="group_discount_per_so_line" widget="radio"/>
                         <field name="module_product_visible_discount" widget="radio" attrs="{'invisible': [('group_discount_per_so_line', '=', False)]}"/>
@@ -47,10 +49,15 @@
                             <a href="https://www.odoo.com/page/subscriptions" target="_blank"> More Info</a>
                         </div>
                     </group>
-                    <group string="Customers">
+                    <group string="Customers" name="customers">
                         <field name="module_website_quote" widget="radio"/>
                     </group>
                 </div>
+                <form name="sale_config_form" position="inside">
+                    <div>
+                        <span>(*) This configuration value is related to the company you're logged in.</span>
+                    </div>
+                </form>
             </field>
         </record>
 
diff --git a/addons/sale/views/sale_views.xml b/addons/sale/views/sale_views.xml
index 76610f000115..33389e9359a4 100644
--- a/addons/sale/views/sale_views.xml
+++ b/addons/sale/views/sale_views.xml
@@ -631,20 +631,6 @@
         </record>
 
 
-
-        <record model="ir.ui.view" id="view_company_inherit_form2">
-            <field name="name">res.company.form.inherit</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="model">res.company</field>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='account_grp']" position="after">
-                    <group name="sale_grp" string="Sales">
-                        <field name="sale_note" nolabel="1" placeholder="Default terms &amp; conditions..."/>
-                    </group>
-                </xpath>
-            </field>
-        </record>
-
         <!-- Update account invoice search view!-->
         <record id="account_invoice_groupby_inherit" model="ir.ui.view">
             <field name="name">account.invoice.groupby</field>
diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py
index 6acfb6a50b92..c467dbbedda0 100644
--- a/addons/sale_stock/__openerp__.py
+++ b/addons/sale_stock/__openerp__.py
@@ -29,7 +29,6 @@ You can choose flexible invoicing methods:
     'data': [
         'security/sale_stock_security.xml',
         'security/ir.model.access.csv',
-        'views/res_company_views.xml',
         'views/sale_order_views.xml',
         'views/stock_views.xml',
         'views/sale_config_settings_views.xml',
diff --git a/addons/sale_stock/models/sale_config_settings.py b/addons/sale_stock/models/sale_config_settings.py
index 992541ac7811..5f7f7a8510bf 100644
--- a/addons/sale_stock/models/sale_config_settings.py
+++ b/addons/sale_stock/models/sale_config_settings.py
@@ -7,6 +7,7 @@ from odoo import api, fields, models
 class SaleConfiguration(models.TransientModel):
     _inherit = 'sale.config.settings'
 
+    security_lead = fields.Float(related='company_id.security_lead', string="Sales Safety Days *")
     module_delivery = fields.Selection([
         (0, 'No shipping costs on sales orders'),
         (1, 'Allow adding shipping costs')
diff --git a/addons/sale_stock/views/res_company_views.xml b/addons/sale_stock/views/res_company_views.xml
deleted file mode 100644
index 96b29e66925e..000000000000
--- a/addons/sale_stock/views/res_company_views.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" ?>
-<odoo>
-    <data>
-        <record id="view_company_form_inherit_sale_stock" model="ir.ui.view">
-            <field name="name">res.company.mrp.config</field>
-            <field name="model">res.company</field>
-            <field name="priority">24</field>
-            <field name="inherit_id" ref="base.view_company_form"/>
-            <field name="arch" type="xml">
-                <xpath expr="//group[@name='logistics_grp']" position="inside">
-                   <field name="security_lead"/>
-                </xpath>
-            </field>
-        </record>
-    </data>
-</odoo>
diff --git a/addons/sale_stock/views/sale_config_settings_views.xml b/addons/sale_stock/views/sale_config_settings_views.xml
index 6909308bf6fa..efb287fefd6a 100644
--- a/addons/sale_stock/views/sale_config_settings_views.xml
+++ b/addons/sale_stock/views/sale_config_settings_views.xml
@@ -5,6 +5,9 @@
         <field name="model">sale.config.settings</field>
         <field name="inherit_id" ref="sale.view_sales_config"/>
         <field name="arch" type="xml">
+            <group name="customers" position="inside">
+                <field name="security_lead"/>
+            </group>
             <xpath expr="//div[@id='main']" position="inside">
                 <group string="Shipping">
                     <field name="module_delivery" widget="radio"/>
diff --git a/addons/sales_team/views/res_config_view.xml b/addons/sales_team/views/res_config_view.xml
index 53eabbe07f11..73475d196c4a 100644
--- a/addons/sales_team/views/res_config_view.xml
+++ b/addons/sales_team/views/res_config_view.xml
@@ -5,7 +5,7 @@
         <field name="name">sale settings</field>
         <field name="model">sale.config.settings</field>
         <field name="arch" type="xml">
-            <form string="Configure Sales" class="oe_form_configuration">
+            <form string="Configure Sales" class="oe_form_configuration" name="sale_config_form">
                 <header>
                     <button string="Apply" type="object" name="execute" class="oe_highlight"/>
                     <button string="Cancel" type="object" name="cancel" class="oe_link"/>
diff --git a/openerp/addons/base/res/res_company_view.xml b/openerp/addons/base/res/res_company_view.xml
index 8dcbcfae4a5b..852aede6658e 100644
--- a/openerp/addons/base/res/res_company_view.xml
+++ b/openerp/addons/base/res/res_company_view.xml
@@ -48,36 +48,6 @@
                                 </group>
                             </group>
                         </page>
-                        <page name="configuration" string="Configuration">
-                            <group>
-                                <group name="account_grp" string="Accounting"/>
-                            </group>
-                        </page>
-                        <page name="report" string="Report Configuration">
-                            <group string="Configuration">
-                                <group col="2" colspan="2">
-                                    <field name="custom_footer"/>
-                                    <field name="rml_footer" attrs="{'invisible': [('custom_footer','=',False)]}"/>
-                                    <field name="rml_footer_readonly" attrs="{'invisible': [('custom_footer','=',True)]}"/>
-                                </group>
-                            </group>
-
-                            <group string="Configuration (RML)" groups="base.group_no_one">
-                                <group col="2" colspan="2">
-                                    <button name="%(preview_rml_report)d" string="Preview RML Report" type="action" colspan="2"/>
-                                    <field name="rml_paper_format"/>
-                                </group>
-                                <group col="3" colspan="2">
-                                    <field name="font" class="oe_inline"/>
-                                    <button string="(reload fonts)" name="act_discover_fonts" type="object" class="oe_link"/>
-                                </group>
-                                <group col="1" colspan="2">
-                                    <field name="rml_header"/>
-                                    <field name="rml_header2"/>
-                                    <field name="rml_header3"/>
-                                </group>
-                            </group>
-                        </page>
                     </notebook>
                     </sheet>
                 </form>
-- 
GitLab