Browse Source

publish muk_utils - 12.0

pull/9/head
MuK IT GmbH 6 years ago
parent
commit
f01ff0477b
  1. 2
      muk_utils/__manifest__.py
  2. 19
      muk_utils/models/res_config_settings.py
  3. 9
      muk_utils/views/res_config_settings_view.xml

2
muk_utils/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Utils",
"summary": """Utility Features""",
"version": '12.0.1.1.10',
"version": '12.0.1.1.11',
"category": 'Extra Tools',
"license": "AGPL-3",
"author": "MuK IT",

19
muk_utils/models/res_config_settings.py

@ -41,6 +41,11 @@ class ResConfigSettings(models.TransientModel):
required=True,
help="Attachment storage location.")
attachment_location_changed = fields.Boolean(
compute='_compute_attachment_location_changed',
string='Storage Location Changed')
#----------------------------------------------------------
# Functions
#----------------------------------------------------------
@ -59,6 +64,16 @@ class ResConfigSettings(models.TransientModel):
res.update(attachment_location=params.get_param('ir_attachment.location', 'file'))
return res
@api.multi
def attachment_force_storage(self):
self.env['ir.attachment'].force_storage()
self.env['ir.attachment'].force_storage()
#----------------------------------------------------------
# Read
#----------------------------------------------------------
@api.depends('attachment_location')
def _compute_attachment_location_changed(self):
params = self.env['ir.config_parameter'].sudo()
attachment_location = params.get_param('ir_attachment.location', 'file')
for record in self:
record.attachment_location_changed = attachment_location != self.attachment_location

9
muk_utils/views/res_config_settings_view.xml

@ -26,7 +26,7 @@
<field name="arch" type="xml">
<div name="integration" position="after">
<h2>Storage</h2>
<div class="row mt16 o_settings_container" name="web_client">
<div class="row mt16 o_settings_container" name="storage">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane"></div>
<div class="o_setting_right_pane">
@ -35,9 +35,12 @@
Attachment storage location.
</div>
<div class="mt8">
<field name="attachment_location"
class="o_light_label"/>
<field name="attachment_location" class="o_light_label"/>
</div>
<div class="mt8 text-warning" attrs="{'invisible': [('attachment_location_changed','=',False)]}">
<field name="attachment_location_changed" invisible="1"/>
<strong>Save</strong> this page before triggering the migration.
</div>
<div class="mt8">
<button name="attachment_force_storage"
string="Force Storage Migration"

Loading…
Cancel
Save