Skip to content

Commit

Permalink
Profile Image Document Store Config added
Browse files Browse the repository at this point in the history
Signed-off-by: Lalith Kota <[email protected]>
  • Loading branch information
lalithkota committed Jan 27, 2025
1 parent b666a64 commit 6cc5d6c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions g2p_profile_image/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
],
"data": [
"data/tags.xml",
"views/res_config_settings.xml",
],
"assets": {},
"demo": [],
Expand Down
1 change: 1 addition & 0 deletions g2p_profile_image/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import res_config_settings
from . import registrant
4 changes: 4 additions & 0 deletions g2p_profile_image/models/registrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ def _profile_image_get_tags_func(self):
return self.env.ref("g2p_profile_image.document_tag_profile_image")

def _profile_image_get_sb_func(self):
IR_CONFIG = self.env["ir.config_parameter"].sudo()
image_doc_store = IR_CONFIG.get_param("g2p_profile_image.image_document_storage")
if image_doc_store:
return self.env["storage.backend"].browse(int(image_doc_store))
return self.get_registry_documents_store()
9 changes: 9 additions & 0 deletions g2p_profile_image/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

g2p_profile_image_document_store = fields.Many2one(
"storage.backend", config_parameter="g2p_profile_image.image_document_storage"
)
20 changes: 20 additions & 0 deletions g2p_profile_image/views/res_config_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res_config_settings_view_form</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base.res_config_settings_view_form" />
<field name="arch" type="xml">
<app name="g2p_config_settings" position="inside">
<block name="g2p_profile_image_settings" title="G2P Profile Image Settings">
<setting
string="Image Document Store Config"
help="Select the document store to be used for storing Profile Images. Restart Odoo after changing this."
>
<field name="g2p_profile_image_document_store" />
</setting>
</block>
</app>
</field>
</record>
</odoo>

0 comments on commit 6cc5d6c

Please sign in to comment.