Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All fields as selection type on Odoo 12 and Odoo 13 #4

Open
Rafaellinos opened this issue May 20, 2020 · 2 comments
Open

All fields as selection type on Odoo 12 and Odoo 13 #4

Rafaellinos opened this issue May 20, 2020 · 2 comments

Comments

@Rafaellinos
Copy link

I tried on Odoo 12 and 13:
erro_fields
And with PM 3.3.4 and 3.2.3, both have this problem.

@Rafaellinos
Copy link
Author

Rafaellinos commented May 22, 2020

I don't know if that's the best approach.
Here's my solution:
On syd_process_maker/models/process_object.py:

def _get_odoo_type(self, pm_type, pm_accepted_values):
    try:
        if isinstance(pm_accepted_values, str):
            pm_accepted_values = eval(pm_accepted_values)
        pm_type = pm_type.lower()
        if bool(pm_accepted_values):
            return 'selection'
        if pm_type == 'string':
            return 'char'
        if pm_type == 'integer':
            return 'integer'
        if pm_type == 'float':
            return 'float'
        if pm_type == 'boolean':
            return 'boolean'
        if pm_type == 'datetime':
            return 'datetime'
        else:
            return False
    except Exception:
        return False

Also, replace some partss of the code where update individually, instead of update the whole thing:
Example:
Replace this:
process_object_id.name = pvariable['var_name'] process_object_id.pm_accepted_values = pvariable['var_accepted_values'] process_object_id.pm_type = pvariable['var_field_type']
For this:
process_object_id.write({ 'name': pvariable['var_name'], 'pm_accepted_values': pvariable['var_accepted_values'], 'pm_type': pvariable['var_field_type'] })

@mah007
Copy link

mah007 commented Oct 13, 2021

seem that they abandon the project

feitas referenced this issue in feitas/odoo_bpm Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants