-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287 from OpenG2P/17.0-1.2
Merge back 1.2 to develop
- Loading branch information
Showing
122 changed files
with
4,559 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<!-- Inherit and modify the existing record --> | ||
<record id="formio.config_param_formio_builder_js_options_default" model="ir.config_parameter"> | ||
<field | ||
name="value" | ||
eval="ref('formio_storage_filestore.formio_builder_js_options_storage_filestore')" | ||
/> | ||
</record> | ||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,60 @@ | ||
from odoo import fields, models | ||
import json | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class G2PProgram(models.Model): | ||
_inherit = "g2p.program" | ||
|
||
self_service_portal_form = fields.Many2one("formio.builder", string="Program Form") | ||
portal_form_builder_id = fields.Many2one( | ||
"formio.builder", string="Program Form", domain="[('is_form_mapped_with_program', '=', False)]" | ||
) | ||
|
||
is_multiple_form_submission = fields.Boolean(default=False) | ||
|
||
@api.constrains("portal_form_builder_id") | ||
def _constrain_portal_form_mapping(self): | ||
self.ensure_one() | ||
|
||
if self.portal_form_builder_id: | ||
formio_builder = self.portal_form_builder_id | ||
|
||
try: | ||
# Parse the JSON string into a dictionary | ||
js_options = json.loads(formio_builder.formio_js_options) | ||
|
||
if "editForm" in js_options and "file" in js_options["editForm"]: | ||
file_components = js_options["editForm"]["file"][0]["components"] | ||
|
||
for component in file_components: | ||
if "defaultValue" in component and component["key"] == "url": | ||
component["defaultValue"] = f"/v1/selfservice/uploadDocument/{self.id}" | ||
|
||
# Convert back to JSON string and update the builder | ||
formio_builder.write( | ||
{ | ||
"formio_js_options": json.dumps(js_options, indent=4), | ||
"is_form_mapped_with_program": True, | ||
} | ||
) | ||
else: | ||
formio_builder.write({"is_form_mapped_with_program": False}) | ||
|
||
except (json.JSONDecodeError, KeyError, IndexError): | ||
# Handle potential JSON parsing errors or missing keys | ||
formio_builder.write({"is_form_mapped_with_program": False}) | ||
|
||
@api.onchange("portal_form_builder_id") | ||
def _onchange_portal_form_unmapping(self): | ||
# Check if there was a previous form that is now being removed | ||
previous_form = self._origin.portal_form_builder_id | ||
current_form = self.portal_form_builder_id | ||
|
||
if previous_form and not current_form: | ||
previous_form.write({"is_form_mapped_with_program": False}) | ||
|
||
|
||
class G2PProgramFomio(models.Model): | ||
_inherit = "formio.builder" | ||
|
||
is_form_mapped_with_program = fields.Boolean(string="Is Form Mapped", default=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Part of Newlogic G2P. See LICENSE file for full copyright and licensing details. | ||
|
||
from . import odk_client | ||
from . import odk_config | ||
from . import odk_import |
Oops, something went wrong.