From 75c6b71c714bf773b8826f94984978f4100573e4 Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Mon, 8 Mar 2021 15:39:11 +0530 Subject: [PATCH] code for hide fields from export --- field_hide/.idea/custom_project.iml | 11 + field_hide/.idea/misc.xml | 4 + field_hide/.idea/modules.xml | 8 + field_hide/.idea/vcs.xml | 6 + field_hide/.idea/workspace.xml | 327 +++++++++++++++++++++ field_hide/__init__.py | 3 + field_hide/__manifest__.py | 12 + field_hide/models/__init__.py | 3 + field_hide/models/field_hide.py | 25 ++ field_hide/static/src/js/field_remove.js | 20 ++ field_hide/views/field_remove_template.xml | 10 + 11 files changed, 429 insertions(+) create mode 100755 field_hide/.idea/custom_project.iml create mode 100755 field_hide/.idea/misc.xml create mode 100755 field_hide/.idea/modules.xml create mode 100755 field_hide/.idea/vcs.xml create mode 100755 field_hide/.idea/workspace.xml create mode 100755 field_hide/__init__.py create mode 100755 field_hide/__manifest__.py create mode 100755 field_hide/models/__init__.py create mode 100755 field_hide/models/field_hide.py create mode 100755 field_hide/static/src/js/field_remove.js create mode 100755 field_hide/views/field_remove_template.xml diff --git a/field_hide/.idea/custom_project.iml b/field_hide/.idea/custom_project.iml new file mode 100755 index 0000000..6711606 --- /dev/null +++ b/field_hide/.idea/custom_project.iml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file diff --git a/field_hide/.idea/misc.xml b/field_hide/.idea/misc.xml new file mode 100755 index 0000000..6c993b7 --- /dev/null +++ b/field_hide/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/field_hide/.idea/modules.xml b/field_hide/.idea/modules.xml new file mode 100755 index 0000000..272f62f --- /dev/null +++ b/field_hide/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/field_hide/.idea/vcs.xml b/field_hide/.idea/vcs.xml new file mode 100755 index 0000000..6c0b863 --- /dev/null +++ b/field_hide/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/field_hide/.idea/workspace.xml b/field_hide/.idea/workspace.xml new file mode 100755 index 0000000..7a2a3b6 --- /dev/null +++ b/field_hide/.idea/workspace.xml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fix + def create + test_field + _issue_open_count + issue_open_count + reopem + za + bug_find_time + tot + chatt + fixt + total_time + get_total_fixture_time + fixture_time + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1554196611759 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/field_hide/__init__.py b/field_hide/__init__.py new file mode 100755 index 0000000..5305644 --- /dev/null +++ b/field_hide/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models \ No newline at end of file diff --git a/field_hide/__manifest__.py b/field_hide/__manifest__.py new file mode 100755 index 0000000..4fd8372 --- /dev/null +++ b/field_hide/__manifest__.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +{ + 'name': "SunArc Field Hide", + 'author': "SunArc Technologies", + 'website': "http://www.sunarctechnologies.com", + 'sequence': 3, + 'category': 'Other', + 'version': '14.0.1.1', + 'depends': ['base','crm', 'project'], + 'data': ['views/field_remove_template.xml',], + 'application': False +} diff --git a/field_hide/models/__init__.py b/field_hide/models/__init__.py new file mode 100755 index 0000000..a8de247 --- /dev/null +++ b/field_hide/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- +from . import field_hide + diff --git a/field_hide/models/field_hide.py b/field_hide/models/field_hide.py new file mode 100755 index 0000000..188a78f --- /dev/null +++ b/field_hide/models/field_hide.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models, tools, SUPERUSER_ID, _ + +class ProjectFields(models.Model): + _inherit = "project.project" + + @api.model + def get_fields_to_ignore_in_export_in_project(self): + # this function is mainly used for to hide filter from group by + return ['resource_calendar_id', 'website_message_ids', 'warning_employee_rate', 'privacy_visibility'] + + @api.model + def fields_get(self, allfields=None, attributes=None): + # This function mainly use for hide below field from export + res = super(ProjectFields, self).fields_get(allfields) + for field in self.get_fields_to_ignore_in_export_in_project(): + if res.get(field): + res.get(field)['exportable'] = False + return res + + + + + + diff --git a/field_hide/static/src/js/field_remove.js b/field_hide/static/src/js/field_remove.js new file mode 100755 index 0000000..fd23b60 --- /dev/null +++ b/field_hide/static/src/js/field_remove.js @@ -0,0 +1,20 @@ +odoo.define('module.ControlPanel', function (require) { + 'use strict'; + var ControlPanel = require('web.ControlPanel'); + /* Below function is mainly used for hide field from project export section*/ + ControlPanel.include({ + _update_search_view: function(searchview, is_hidden) { + this._super.apply(this, arguments); + if(searchview){ + this._rpc({ + model: 'project.project', + method: 'get_fields_to_ignore_in_export_in_project', + }).then(function (result) { + for(var i=0;i + + +