Skip to content
Snippets Groups Projects
Commit 665781d5 authored by Yannick Tivisse's avatar Yannick Tivisse
Browse files

[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).
parent fb0cb419
No related branches found
No related tags found
No related merge requests found
Showing
with 164 additions and 119 deletions
......@@ -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',
......
......@@ -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
......
<?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>
......@@ -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>
......
......@@ -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'],
......
......@@ -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
# -*- 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 *")
<?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>
<?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>
......@@ -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()
......@@ -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>
......
......@@ -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,
}
......@@ -4,3 +4,4 @@
import hr_attendance
import hr_timesheet_sheet
import res_company
import project_config_settings
\ No newline at end of file
# -*- 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) *")
<?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>
......@@ -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>
......@@ -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 *")
......@@ -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)
......@@ -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"/>
......
......@@ -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
-->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment