From d7fef991351144891cd3cb5c4c8d5d6ad9d966a3 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Fri, 6 Apr 2012 14:36:03 +0530 Subject: [PATCH 001/239] [IMP]hr_recruitment: Improved a state field based on stage bzr revid: mma@tinyerp.com-20120406090603-nr79b6vzy8u6mlp9 --- addons/hr_recruitment/hr_recruitment.py | 13 ++++++----- addons/hr_recruitment/hr_recruitment_view.xml | 23 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index d1a4ba2c285..0b4e116ed7e 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -69,10 +69,16 @@ class hr_recruitment_stage(osv.osv): 'name': fields.char('Name', size=64, required=True, translate=True), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of stages."), 'department_id':fields.many2one('hr.department', 'Specific to a Department', help="Stages of the recruitment process may be different per department. If this stage is common to all departments, keep tempy this field."), + 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, + help='The state is set to \'Draft\', when a case is created.\ + \nIf the case is in progress the state is set to \'Open\'.\ + \nWhen the case is over, the state is set to \'Done\'.\ + \nIf the case needs to be reviewed then the state is set to \'Pending\'.'), 'requirements': fields.text('Requirements') } _defaults = { 'sequence': 1, + 'state': lambda *a: 'draft', } hr_recruitment_stage() @@ -144,11 +150,7 @@ class hr_applicant(crm.crm_case, osv.osv): 'create_date': fields.datetime('Creation Date', readonly=True, select=True), 'write_date': fields.datetime('Update Date', readonly=True), 'stage_id': fields.many2one ('hr.recruitment.stage', 'Stage'), - 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True, - help='The state is set to \'Draft\', when a case is created.\ - \nIf the case is in progress the state is set to \'Open\'.\ - \nWhen the case is over, the state is set to \'Done\'.\ - \nIf the case needs to be reviewed then the state is set to \'Pending\'.'), + 'state': fields.related('stage_id','state', type='char', selection=AVAILABLE_STATES, string="State", store=True, readonly=True), 'company_id': fields.many2one('res.company', 'Company'), 'user_id': fields.many2one('res.users', 'Responsible'), # Applicant Columns @@ -169,7 +171,6 @@ class hr_applicant(crm.crm_case, osv.osv): 'partner_mobile': fields.char('Mobile', size=32), 'type_id': fields.many2one('hr.recruitment.degree', 'Degree'), 'department_id': fields.many2one('hr.department', 'Department'), - 'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True), 'survey': fields.related('job_id', 'survey_id', type='many2one', relation='survey', string='Survey'), 'response': fields.integer("Response"), 'reference': fields.char('Refered By', size=128), diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index d47ff2b9986..517a66698e3 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -61,7 +61,7 @@ - +
+ - +
+
@@ -1495,7 +1495,7 @@
- +
@@ -1512,7 +1512,7 @@ - -
-
- +
+
+

M Custom Filters

+
    +
+
+

Save current search

+
+

+

+

+ +
+

Advanced Search

@@ -1512,7 +1516,7 @@

+

+

+ + +
-

Save current search

-
-

-

-

- -
From 9c06cfc98b683c97ed7d27566040e8a3c2e63dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 31 May 2012 14:44:45 +0200 Subject: [PATCH 221/239] [FIX] project.task: fixed buggy _read_group_stage_ids and _stage_find. bzr revid: tde@openerp.com-20120531124445-2jhdr118y883i3t3 --- addons/project/project.py | 35 ++++++++++++++++++++------------- addons/project/project_view.xml | 13 +++++++----- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 4d3d4dec499..d581a828471 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -548,16 +548,15 @@ class task(base_stage, osv.osv): if read_group_order == 'stage_id desc': order = '%s desc' % order # retrieve section_id from the context and write the domain + # - ('id', 'in', 'ids'): add columns that should be present + # - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded + # - OR ('project_ids', 'in', project_id), ('fold', '=', False) if project_id: add project columns that are not folded search_domain = [] project_id = self._resolve_project_id_from_context(cr, uid, context=context) if project_id: - search_domain += ['|', '&', ('project_ids', '=', project_id), ('fold', '=', True)] - else: - domain = ['|', ('id','in',ids), ('case_default','=',1)] - search_domain += ['|', ('id', 'in', ids), '&', ('case_default', '=', 1), ('fold', '=', False)] - print search_domain - stage_ids = stage_obj._search(cr, uid, domain, order=order, access_rights_uid=access_rights_uid, context=context) - print stage_ids + search_domain += ['|', '&', ('project_ids', '=', project_id), ('fold', '=', False)] + search_domain += ['|', ('id', 'in', ids), '&', ('case_default', '=', True), ('fold', '=', False)] + stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) # restore order of the search result.sort(lambda x,y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0]))) @@ -866,15 +865,23 @@ class task(base_stage, osv.osv): """ if isinstance(cases, (int, long)): cases = self.browse(cr, uid, cases, context=context) - domain = list(domain) + # collect all section_ids + section_ids = [] if section_id: - domain += ['|', ('project_ids', '=', section_id)] - domain.append(('case_default', '=', True)) + section_ids.append(section_id) for task in cases: - task_project_id = task.project_id.id if task.project_id else None - if task_project_id: - domain += ['|', ('project_ids', '=', task_project_id), ('case_default', '=', True)] - stage_ids = self.pool.get('project.task.type').search(cr, uid, domain, order=order, context=context) + if task.project_id: + section_ids.append(task.project_id.id) + # OR all section_ids + search_domain = [] + if section_ids: + search_domain += [('|')] * (len(section_ids) - 1) + for section_id in section_ids: + search_domain += [('|'), ('project_ids', '=', section_id), ('case_default', '=', True)] + # AND with the domain in parameter + search_domain += list(domain) + # perform search, return the first found + stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context) if stage_ids: return stage_ids[0] return False diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 3bfda696abd..e85c3a71e1e 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -683,11 +683,14 @@ form
- - - - - + + + + + + + + From eb6a0a4ac6980d61e1b6d5dde3dfdc15d14b21c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 31 May 2012 15:16:26 +0200 Subject: [PATCH 222/239] [FIX] crm_lead, hr_recruitment, project_issue: fixed _read_group_stage_ids methods. bzr revid: tde@openerp.com-20120531131626-o5geqtp9ig5fnj87 --- addons/crm/crm_lead.py | 9 ++++++--- addons/hr_recruitment/hr_recruitment.py | 5 ++++- addons/project_issue/project_issue.py | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index d82bc0e5c29..3d9c14bb860 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -82,14 +82,17 @@ class crm_lead(base_stage, osv.osv): # lame hack to allow reverting search, should just work in the trivial case if read_group_order == 'stage_id desc': order = "%s desc" % order - # retrieve type from the context (if set: choose 'type' or 'both') - type = self._resolve_type_from_context(cr, uid, context=context) # retrieve section_id from the context and write the domain + # - ('id', 'in', 'ids'): add columns that should be present + # - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded + # - OR ('section_ids', '=', section_id), ('fold', '=', False) if section_id: add section columns that are not folded search_domain = [] section_id = self._resolve_section_id_from_context(cr, uid, context=context) if section_id: search_domain += ['|', '&', ('section_ids', '=', section_id), ('fold', '=', False)] - search_domain += ['|', ('id', 'in', ids), '&', ('case_default', '=', 1), ('fold', '=', False)] + search_domain += ['|', ('id', 'in', ids), '&', ('case_default', '=', True), ('fold', '=', False)] + # retrieve type from the context (if set: choose 'type' or 'both') + type = self._resolve_type_from_context(cr, uid, context=context) if type: search_domain += ['|', ('type', '=', type), ('type', '=', 'both')] # perform search diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 6c361cf0bfd..d4fe6325917 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -131,7 +131,10 @@ class hr_applicant(base_stage, osv.Model): # lame hack to allow reverting search, should just work in the trivial case if read_group_order == 'stage_id desc': order = "%s desc" % order - # get department_id from context + # retrieve section_id from the context and write the domain + # - ('id', 'in', 'ids'): add columns that should be present + # - OR ('department_id', '=', False), ('fold', '=', False): add default columns that are not folded + # - OR ('department_id', 'in', department_id), ('fold', '=', False) if department_id: add department columns that are not folded department_id = self._resolve_department_id_from_context(cr, uid, context=context) search_domain = [] if department_id: diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 2aa9195ce19..a94a12add6e 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -84,11 +84,14 @@ class project_issue(base_stage, osv.osv): if read_group_order == 'stage_id desc': order = "%s desc" % order # retrieve section_id from the context and write the domain + # - ('id', 'in', 'ids'): add columns that should be present + # - OR ('case_default', '=', True), ('fold', '=', False): add default columns that are not folded + # - OR ('project_ids', 'in', project_id), ('fold', '=', False) if project_id: add project columns that are not folded search_domain = [] project_id = self._resolve_project_id_from_context(cr, uid, context=context) if project_id: - search_domain += ['|', '&', ('project_ids', '=', project_id), ('fold', '=', True)] - search_domain += ['|', ('id', 'in', ids), '&', ('case_default', '=', 1), ('fold', '=', False)] + search_domain += ['|', '&', ('project_ids', '=', project_id), ('fold', '=', False)] + search_domain += ['|', ('id', 'in', ids), '&', ('case_default', '=', True), ('fold', '=', False)] # perform search stage_ids = stage_obj._search(cr, uid, search_domain, order=order, access_rights_uid=access_rights_uid, context=context) result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) From 7d0196053867ef2bef9d9929d8c4cf3e4a70cde6 Mon Sep 17 00:00:00 2001 From: Minh Tran Date: Thu, 31 May 2012 15:41:50 +0200 Subject: [PATCH 223/239] searchview fixes bzr revid: mit@openerp.com-20120531134150-nqxas33g0ow27ciy --- addons/web/static/src/css/base.css | 14 ++++++++++---- addons/web/static/src/css/base.sass | 11 +++++++---- addons/web/static/src/js/search.js | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 6510793a2d1..ab5f261dbf2 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -99,10 +99,6 @@ list-style-type: none; } .openerp input, .openerp textarea { - height: 14px; - padding: 3px; - font-size: 11px; - line-height: 18px; border: 1px solid #cccccc; -moz-border-radius: 3px; -webkit-border-radius: 3px; @@ -1186,6 +1182,16 @@ -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset; -box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset; } +.openerp .oe_searchview input, .openerp .oe_searchview textarea { + padding: 3px; + height: 14px; + font-size: 11px; + line-height: 18px; + border: 1px solid #cccccc; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} .openerp .oe_searchview.oe_focused { border-color: #a6a6fe; -moz-box-shadow: 0 1px 2px #a6a6fe inset; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 5feabf83628..75c351a8558 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -140,10 +140,6 @@ $colour4: #8a89ba li list-style-type: none input, textarea - height: 14px - padding: 3px - font-size: 11px - line-height: 18px border: 1px solid #ccc @include radius(3px) @@ -938,6 +934,13 @@ $colour4: #8a89ba background: white @include radius(13px) @include box-shadow(0 1px 2px rgba(0,0,0,0.2) inset) + input, textarea + padding: 3px + height: 14px + font-size: 11px + line-height: 18px + border: 1px solid #ccc + @include radius(3px) &.oe_focused border-color: $facets-border-selected @include box-shadow(0 1px 2px $facets-border-selected inset) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 9ccb41e1c3f..f9e737471ae 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1642,7 +1642,7 @@ instance.web.search.Filters = instance.web.search.Input.extend({ var col1 = [], col2 = _(this.view.controls).map(function (inputs, group) { var filters = _(inputs).filter(is_group); return { - name: group === 'null' ? _t("q Filters") : "w " + group, + name: group === 'null' ? "q " + _t("Filters") : "w " + group, filters: filters, length: _(filters).chain().map(function (i) { return i.filters.length; }).sum().value() From 214ba531041a9077567bc10267fe09cb1bd77354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 31 May 2012 16:19:30 +0200 Subject: [PATCH 224/239] [FIX] crm_lead, project, project_issue, hr_recruitment: fixed stage_find method. bzr revid: tde@openerp.com-20120531141930-svw4ax9mfwvnyv07 --- addons/crm/crm_lead.py | 29 ++++++++++++++++++------- addons/hr_recruitment/hr_recruitment.py | 20 ++++++++++++----- addons/project/project.py | 8 +++---- addons/project_issue/project_issue.py | 24 ++++++++++++++------ 4 files changed, 56 insertions(+), 25 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 3d9c14bb860..ee6b9835f02 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -313,16 +313,29 @@ class crm_lead(base_stage, osv.osv): """ if isinstance(cases, (int, long)): cases = self.browse(cr, uid, cases, context=context) - domain = list(domain) + # collect all section_ids + section_ids = [] + types = ['both'] if section_id: - domain += ['|', ('section_ids', '=', section_id)] - domain.append(('case_default', '=', True)) + section_ids.append(section_id) for lead in cases: - domain += ['|', ('type', '=', lead.type), ('type', '=', 'both')] - lead_section_id = lead.section_id.id if lead.section_id else None - if lead_section_id: - domain += ['|', ('section_ids', '=', lead_section_id), ('case_default', '=', True)] - stage_ids = self.pool.get('crm.case.stage').search(cr, uid, domain, order=order, context=context) + if lead.section_id: + section_ids.append(lead.section_id.id) + if lead.type not in types: + types.append(lead.type) + # OR all section_ids and OR with case_default + search_domain = [] + if section_ids: + search_domain += [('|')] * len(section_ids) + for section_id in section_ids: + search_domain.append(('section_ids', '=', section_id)) + search_domain.append(('case_default', '=', True)) + # AND with cases types + search_domain.append(('type', 'in', types)) + # AND with the domain in parameter + search_domain += list(domain) + # perform search, return the first found + stage_ids = self.pool.get('crm.case.stage').search(cr, uid, search_domain, order=order, context=context) if stage_ids: return stage_ids[0] return False diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index d4fe6325917..d9acba96331 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -273,14 +273,22 @@ class hr_applicant(base_stage, osv.Model): """ if isinstance(cases, (int, long)): cases = self.browse(cr, uid, cases, context=context) - domain = list(domain) + # collect all section_ids + department_ids = [] if section_id: - domain += ['|', ('department_id', '=', section_id), ('department_id', '=', False)] + department_ids.append(section_id) for case in cases: - case_section_id = case.department_id.id if case.department_id else None - if case_section_id: - domain += ['|', ('department_id', '=', case_section_id), ('department_id', '=', False)] - stage_ids = self.pool.get('hr.recruitment.stage').search(cr, uid, domain, order=order, context=context) + if case.department_id: + department_ids.append(case.department_id.id) + # OR all section_ids and OR with case_default + search_domain = [] + if department_ids: + search_domain += ['|', ('department_id', 'in', department_ids)] + search_domain.append(('department_id', '=', False)) + # AND with the domain in parameter + search_domain += list(domain) + # perform search, return the first found + stage_ids = self.pool.get('hr.recruitment.stage').search(cr, uid, search_domain, order=order, context=context) if stage_ids: return stage_ids[0] return False diff --git a/addons/project/project.py b/addons/project/project.py index d581a828471..dcaed0de5d7 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -858,7 +858,6 @@ class task(base_stage, osv.osv): def stage_find(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None): """ Override of the base.stage method Parameter of the stage search taken from the lead: - - type: stage type must be the same or 'both' - section_id: if set, stages must belong to this section or be a default stage; if not set, stages must be default stages @@ -872,12 +871,13 @@ class task(base_stage, osv.osv): for task in cases: if task.project_id: section_ids.append(task.project_id.id) - # OR all section_ids + # OR all section_ids and OR with case_default search_domain = [] if section_ids: - search_domain += [('|')] * (len(section_ids) - 1) + search_domain += [('|')] * len(section_ids) for section_id in section_ids: - search_domain += [('|'), ('project_ids', '=', section_id), ('case_default', '=', True)] + search_domain.append(('project_ids', '=', section_id)) + search_domain.append(('case_default', '=', True)) # AND with the domain in parameter search_domain += list(domain) # perform search, return the first found diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index a94a12add6e..ced444f34bb 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -422,14 +422,24 @@ class project_issue(base_stage, osv.osv): """ if isinstance(cases, (int, long)): cases = self.browse(cr, uid, cases, context=context) - domain = list(domain) + # collect all section_ids + section_ids = [] if section_id: - domain += ['|', ('project_ids', '=', section_id), ('case_default', '=', True)] - for issue in cases: - issue_project_id = issue.project_id.id if issue.project_id else None - if issue_project_id: - domain += ['|', ('project_ids', '=', issue_project_id), ('case_default', '=', True)] - stage_ids = self.pool.get('project.task.type').search(cr, uid, domain, order=order, context=context) + section_ids.append(section_id) + for task in cases: + if task.project_id: + section_ids.append(task.project_id.id) + # OR all section_ids and OR with case_default + search_domain = [] + if section_ids: + search_domain += [('|')] * len(section_ids) + for section_id in section_ids: + search_domain.append(('project_ids', '=', section_id)) + search_domain.append(('case_default', '=', True)) + # AND with the domain in parameter + search_domain += list(domain) + # perform search, return the first found + stage_ids = self.pool.get('project.task.type').search(cr, uid, search_domain, order=order, context=context) if stage_ids: return stage_ids[0] return False From e979794103f32ef229ad6186c272db544b9926bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 31 May 2012 16:26:47 +0200 Subject: [PATCH 225/239] [FIX] crm_claim: fixed stage_find method. bzr revid: tde@openerp.com-20120531142647-p4hichnd5lorv9z4 --- addons/crm_claim/crm_claim.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py index f4b934f7490..6e2138720da 100644 --- a/addons/crm_claim/crm_claim.py +++ b/addons/crm_claim/crm_claim.py @@ -132,20 +132,29 @@ class crm_claim(base_stage, osv.osv): def stage_find(self, cr, uid, cases, section_id, domain=[], order='sequence', context=None): """ Override of the base.stage method Parameter of the stage search taken from the lead: - - type: stage type must be the same or 'both' - section_id: if set, stages must belong to this section or be a default case """ if isinstance(cases, (int, long)): cases = self.browse(cr, uid, cases, context=context) - domain = list(domain) + # collect all section_ids + section_ids = [] if section_id: - domain += ['|', ('section_ids', '=', section_id), ('case_default', '=', True)] - for lead in cases: - lead_section_id = lead.section_id.id if lead.section_id else None - if lead_section_id: - domain += ['|', ('section_ids', '=', lead_section_id), ('case_default', '=', True)] - stage_ids = self.pool.get('crm.claim.stage').search(cr, uid, domain, order=order, context=context) + section_ids.append(section_id) + for claim in cases: + if claim.section_id: + section_ids.append(claim.section_id.id) + # OR all section_ids and OR with case_default + search_domain = [] + if section_ids: + search_domain += [('|')] * len(section_ids) + for section_id in section_ids: + search_domain.append(('section_ids', '=', section_id)) + search_domain.append(('case_default', '=', True)) + # AND with the domain in parameter + search_domain += list(domain) + # perform search, return the first found + stage_ids = self.pool.get('crm.claim.stage').search(cr, uid, search_domain, order=order, context=context) if stage_ids: return stage_ids[0] return False From 3cb2fb85349fb75f10e6a1c76fa28f224f5fd8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 31 May 2012 16:28:54 +0200 Subject: [PATCH 226/239] [IMP] FieldStatus for selection get_selection now always return a true deferred; for a selection it is resolved, because nothing asynchronous has to be done. bzr revid: tde@openerp.com-20120531142854-qrr3zlh5m5wrjtcf --- addons/web/static/src/js/view_form.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index e5cb5d34593..9dfcb6c77ce 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4126,8 +4126,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ render_list: function() { var self = this; // get selection values, filter them and render them - var selection_done = this.get_selection(); - return $.when(selection_done).pipe(self.proxy('filter_selection')).pipe(self.proxy('render_elements')); + var selection_done = this.get_selection().pipe(self.proxy('filter_selection')).pipe(self.proxy('render_elements')); }, /** Get the selection list to be displayed in the statusbar widget. @@ -4166,7 +4165,7 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ } else { this.selection = this.field.selection; - var read_defer = true; + var read_defer = new $.Deferred().resolve(); } return read_defer; }, From 0a2718cce8327355f47855ef5d83e93f6c3f11fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 31 May 2012 16:39:44 +0200 Subject: [PATCH 227/239] [CLEAN] FieldStatud widget: added missing ';' and '{}'. bzr revid: tde@openerp.com-20120531143944-q41ktw0kahiryvnj --- addons/web/static/src/js/view_form.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 9dfcb6c77ce..52614527111 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4149,10 +4149,11 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ // get fold information from widget var fold = ((this.node.attrs || {}).statusbar_fold || true); // build final domain: if fold option required, add the - if (fold == true) - var domain = new instance.web.CompoundDomain(['|'], ['&'], self.build_domain(), [['fold', '=', false]], [['id', '=', self.selected_value]]) + if (fold == true) { + var domain = new instance.web.CompoundDomain(['|'], ['&'], self.build_domain(), [['fold', '=', false]], [['id', '=', self.selected_value]]); + } else { - var domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.selected_value]]) + var domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.selected_value]]); } // get a DataSetSearch on the current field relation (ex: crm.lead.stage_id -> crm.case.stage) var model_ext = new instance.web.DataSetSearch(this, this.field.relation, self.build_context(), domain); From 8d5aae51f64114cc24cb3bf0b13e62a750ac9455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 31 May 2012 17:15:56 +0200 Subject: [PATCH 228/239] [CLEAN] project, project_issue: removed next_type and prev_type, now using stage_previous and stage_next; cleaned views accordingly. bzr revid: tde@openerp.com-20120531151556-duyy6ryyw6fiup3o --- addons/project/project.py | 30 ------------ addons/project/project_view.xml | 21 ++++---- addons/project/test/task_process.yml | 6 +-- .../board_project_issue_view.xml | 22 +++++---- addons/project_issue/project_issue.py | 27 ---------- addons/project_issue/project_issue_view.xml | 49 +++++++++++-------- addons/project_scrum/project_scrum_view.xml | 2 +- 7 files changed, 56 insertions(+), 101 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index dcaed0de5d7..e2bc73e6dc6 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1100,36 +1100,6 @@ class task(base_stage, osv.osv): def set_kanban_state_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'kanban_state': 'done'}, context=context) - def _change_type(self, cr, uid, ids, next, context=None): - """ - go to the next stage - if next is False, go to previous stage - """ - for task in self.browse(cr, uid, ids): - if task.project_id.type_ids: - typeid = task.stage_id.id - types_seq={} - for type in task.project_id.type_ids : - types_seq[type.id] = type.sequence - if next: - types = sorted(types_seq.items(), lambda x, y: cmp(x[1], y[1])) - else: - types = sorted(types_seq.items(), lambda x, y: cmp(y[1], x[1])) - sorted_types = [x[0] for x in types] - if not typeid: - self.write(cr, uid, task.id, {'stage_id': sorted_types[0]}) - elif typeid and typeid in sorted_types and sorted_types.index(typeid) != len(sorted_types)-1: - index = sorted_types.index(typeid) - self.write(cr, uid, task.id, {'stage_id': sorted_types[index+1]}) - self.state_change_send_note(cr, uid, [task.id], context) - return True - - def next_type(self, cr, uid, ids, context=None): - return self._change_type(cr, uid, ids, True, context=context) - - def prev_type(self, cr, uid, ids, context=None): - return self._change_type(cr, uid, ids, False, context=context) - def _store_history(self, cr, uid, ids, context=None): for task in self.browse(cr, uid, ids, context=context): self.pool.get('project.task.history').create(cr, uid, { diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index e85c3a71e1e..55dcd38da2a 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -517,20 +517,21 @@ +
@@ -482,7 +482,7 @@ - +
@@ -518,16 +518,16 @@
@@ -325,11 +326,11 @@ attrs="{'invisible': [('stage_id','=', False)]}"/>