[FIX] : System Parameter.
This commit is contained in:
parent
60cb6efd5e
commit
9d6734d9a7
@ -2,6 +2,7 @@
|
|||||||
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
from flectra import api, fields, models, _
|
from flectra import api, fields, models, _
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
class ResConfigSettings(models.TransientModel):
|
class ResConfigSettings(models.TransientModel):
|
||||||
@ -35,17 +36,26 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
help="Allows to work in a multi currency environment")
|
help="Allows to work in a multi currency environment")
|
||||||
paperformat_id = fields.Many2one(related="company_id.paperformat_id", string='Paper format')
|
paperformat_id = fields.Many2one(related="company_id.paperformat_id", string='Paper format')
|
||||||
external_report_layout = fields.Selection(related="company_id.external_report_layout")
|
external_report_layout = fields.Selection(related="company_id.external_report_layout")
|
||||||
|
send_statistics = fields.Boolean(
|
||||||
|
"Send Statistics")
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def get_values(self):
|
def get_values(self):
|
||||||
res = super(ResConfigSettings, self).get_values()
|
res = super(ResConfigSettings, self).get_values()
|
||||||
params = self.env['ir.config_parameter'].sudo()
|
params = self.env['ir.config_parameter'].sudo()
|
||||||
default_external_email_server = params.get_param('base_setup.default_external_email_server', default=False)
|
default_external_email_server = params.get_param('base_setup.default_external_email_server', default=False)
|
||||||
|
send_statistics = params._get_param(
|
||||||
|
'base_setup.send_statistics')
|
||||||
|
if send_statistics is None:
|
||||||
|
send_statistics = 'true'
|
||||||
|
if send_statistics in ['true', 'false']:
|
||||||
|
send_statistics = json.loads(send_statistics)
|
||||||
default_user_rights = params.get_param('base_setup.default_user_rights', default=False)
|
default_user_rights = params.get_param('base_setup.default_user_rights', default=False)
|
||||||
default_custom_report_footer = params.get_param('base_setup.default_custom_report_footer', default=False)
|
default_custom_report_footer = params.get_param('base_setup.default_custom_report_footer', default=False)
|
||||||
res.update(
|
res.update(
|
||||||
default_external_email_server=default_external_email_server,
|
default_external_email_server=default_external_email_server,
|
||||||
default_user_rights=default_user_rights,
|
default_user_rights=default_user_rights,
|
||||||
|
send_statistics=send_statistics,
|
||||||
default_custom_report_footer=default_custom_report_footer,
|
default_custom_report_footer=default_custom_report_footer,
|
||||||
company_share_partner=not self.env.ref('base.res_partner_rule').active,
|
company_share_partner=not self.env.ref('base.res_partner_rule').active,
|
||||||
)
|
)
|
||||||
@ -57,6 +67,11 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
self.env['ir.config_parameter'].sudo().set_param("base_setup.default_external_email_server", self.default_external_email_server)
|
self.env['ir.config_parameter'].sudo().set_param("base_setup.default_external_email_server", self.default_external_email_server)
|
||||||
self.env['ir.config_parameter'].sudo().set_param("base_setup.default_user_rights", self.default_user_rights)
|
self.env['ir.config_parameter'].sudo().set_param("base_setup.default_user_rights", self.default_user_rights)
|
||||||
self.env['ir.config_parameter'].sudo().set_param("base_setup.default_custom_report_footer", self.default_custom_report_footer)
|
self.env['ir.config_parameter'].sudo().set_param("base_setup.default_custom_report_footer", self.default_custom_report_footer)
|
||||||
|
send_statistics = 'true'
|
||||||
|
if not self.send_statistics:
|
||||||
|
send_statistics = 'false'
|
||||||
|
self.env['ir.config_parameter'].sudo().set_param(
|
||||||
|
"base_setup.send_statistics", send_statistics)
|
||||||
self.env.ref('base.res_partner_rule').write({'active': not self.company_share_partner})
|
self.env.ref('base.res_partner_rule').write({'active': not self.company_share_partner})
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
@ -218,6 +218,20 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h2>System Parameter</h2>
|
||||||
|
<div class="row mt16 o_settings_container" id="send_statistics">
|
||||||
|
<div class="col-xs-12 col-md-6 o_setting_box">
|
||||||
|
<div class="o_setting_left_pane">
|
||||||
|
<field name="send_statistics" />
|
||||||
|
</div>
|
||||||
|
<div class="o_setting_right_pane">
|
||||||
|
<label for="send_statistics"/>
|
||||||
|
<div class="text-muted">
|
||||||
|
Enable/disable sending statistics to Flectra's Warranty Server.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
@ -2,14 +2,6 @@
|
|||||||
<flectra>
|
<flectra>
|
||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
|
|
||||||
|
|
||||||
<!-- System Parameter for update_notification -->
|
|
||||||
|
|
||||||
<record id="config_update_notification" model="ir.config_parameter">
|
|
||||||
<field name="key">Base statistics</field>
|
|
||||||
<field name="value">True</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<!-- Thread: 1 incoming email -->
|
<!-- Thread: 1 incoming email -->
|
||||||
<record id="msg_discus5" model="mail.message">
|
<record id="msg_discus5" model="mail.message">
|
||||||
<field name="subject">Plan to install backup servers</field>
|
<field name="subject">Plan to install backup servers</field>
|
||||||
|
@ -96,8 +96,8 @@ class PublisherWarrantyContract(AbstractModel):
|
|||||||
try:
|
try:
|
||||||
# Code will be execute only if parameter value 'True'
|
# Code will be execute only if parameter value 'True'
|
||||||
parameter_id = self.env['ir.config_parameter'].sudo().get_param(
|
parameter_id = self.env['ir.config_parameter'].sudo().get_param(
|
||||||
"send_statistics")
|
'base_setup.send_statistics')
|
||||||
if parameter_id != 'True':
|
if parameter_id != 'true':
|
||||||
return True
|
return True
|
||||||
try:
|
try:
|
||||||
result = self._get_sys_logs()
|
result = self._get_sys_logs()
|
||||||
|
@ -20,7 +20,6 @@ _default_parameters = {
|
|||||||
"database.uuid": lambda: pycompat.text_type(uuid.uuid1()),
|
"database.uuid": lambda: pycompat.text_type(uuid.uuid1()),
|
||||||
"database.create_date": fields.Datetime.now,
|
"database.create_date": fields.Datetime.now,
|
||||||
"web.base.url": lambda: "http://localhost:%s" % config.get('http_port'),
|
"web.base.url": lambda: "http://localhost:%s" % config.get('http_port'),
|
||||||
"send_statistics": lambda: "True",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user