Skip to content

Commit

Permalink
[MOD]
Browse files Browse the repository at this point in the history
--> Module Migrate
	+ activity_validation
	+ plm_automated_convertion
--> add pdf view in plm_pdf_workorder
  • Loading branch information
jayraj-omnia committed Jan 3, 2025
1 parent 67c803a commit fbd328d
Show file tree
Hide file tree
Showing 89 changed files with 1,382 additions and 9,307 deletions.
15 changes: 3 additions & 12 deletions activity_validation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
##############################################################################
# -*- encoding: utf-8 -*-
# ##############################################################################
#
# OmniaSolutions, Open Source Management Solution
# Copyright (C) 2010-2019 OmniaSolutions (<https://www.omniasolutions.website>).
Expand All @@ -19,7 +20,7 @@
##############################################################################
{
"name": "Activity Validation",
"version": "18.0.0.1",
"version": "18.0.1.0.0",
"author": "OmniaSolutions",
"website": "https://github.com/OmniaGit/odooplm",
"category": "Custom",
Expand All @@ -31,23 +32,13 @@
],
"license": "AGPL-3",
"data": [
# security
"security/security.xml",
# data
"data/mail_activity_data.xml",
# views
"views/mail_activity_type.xml",
"views/mail_activity.xml",
"views/mail_activity_children_rel.xml",
],
"demo": [],
"test": [],
"qweb": ["static/src/xml/*.xml"],
'assets': {
'web.assets_backend': [
#"activity_validation/static/src/js/systray_activity_menu.js",
]
},
"installable": True,
"application": False,
"auto_install": False,
Expand Down
61 changes: 32 additions & 29 deletions activity_validation/models/mail_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,9 @@
##############################################################################
'''
Created on Nov 16, 2019
@author: mboscolo
'''
import logging
from odoo import models
from odoo import fields
from odoo import api
from odoo import _
from odoo import _, api, fields, models
from odoo.exceptions import UserError


Expand All @@ -41,9 +36,7 @@ class MailActivity(models.Model):
('done', _('Done')),
('cancel', _('Cancel')),
('exception', _('Exception')),
],
default='draft',
string=_('Plm State'))
], default='draft', string=_('Plm State'))
children_ids = fields.One2many('mail.activity.children.rel',
'mail_parent_activity_id',
_('ECR Activities'))
Expand All @@ -52,18 +45,19 @@ class MailActivity(models.Model):
has_parent = fields.Boolean(_('Has parent ECR'), compute="_compute_has_parent_ecr", store=True)
has_parent_eco = fields.Boolean(_('Has parent ECO'), compute="_compute_has_parent_eco", store=True)
eco_child_ids = fields.One2many('mail.activity',
'mail_parent_eco_activity_id',
_('ECO Activities'))
'mail_parent_eco_activity_id',
_('ECO Activities'))
mail_parent_eco_activity_id = fields.Many2one('mail.activity', _('ECO Parent Activity'))
default_plm_activity = fields.Many2one('mail.activity.type', compute='_compute_mail_activity_type')
is_eco = fields.Boolean(_('Is ECO'))

def _compute_mail_activity_type(self):
for activity_id in self:
activity_id.default_plm_activity = self.env.ref('plm.mail_activity_plm_activity')

def getParentECRActivity(self, activity_id):
parent_activity = self.env['mail.activity.children.rel'].search([('mail_children_activity_id', '=', activity_id.id)])
parent_activity = self.env['mail.activity.children.rel'].search(
[('mail_children_activity_id', '=', activity_id.id)])
return parent_activity.mapped('mail_parent_activity_id')

def getParentECOActivity(self, activity_id):
Expand Down Expand Up @@ -97,12 +91,12 @@ def changeActivityTypeId(self):
'name': '%s - %s' % (activity_id.activity_type_id.name, user_id.name),
'user_id': user_id.id,
'mail_children_activity_id': False,
}
}
rel_id = self.env['mail.activity.children.rel'].create(vals)
activity_ids.append(rel_id.id)
activity_id.write({
'children_ids': [(6, False, activity_ids)]
})
})

def write(self, vals):
ret = super(MailActivity, self).write(vals)
Expand Down Expand Up @@ -162,7 +156,7 @@ def isCustomType(self):
if activity_id.activity_type_id.change_activity_type in ['request', 'plm_activity']:
return True
return False

def unlink(self):
for activity_id in self:
if activity_id.isCustomType():
Expand All @@ -173,8 +167,8 @@ def unlink(self):
def clearChildrenActivities(self):
for child_id in self.children_ids:
for child_rel in child_id.mail_children_activity_id.sudo():
if child_rel.mail_children_activity_id.plm_state == 'draft':
child_rel.mail_children_activity_id.unlink()
if child_rel.plm_state == 'draft':
child_rel.unlink()
child_rel.unlink()

def action_to_draft(self):
Expand Down Expand Up @@ -265,7 +259,7 @@ def action_in_progress(self):
'note': line_id.name,
'res_model_id': activity_id.res_model_id.id,
'res_id': activity_id.res_id,
}
}
new_activity_id = self.create(activity_vals)
line_id.mail_children_activity_id = new_activity_id.id
line_id.mail_parent_activity_id = activity_id.id
Expand All @@ -284,19 +278,28 @@ def reopenActivity(self, res_id):

def action_open_releted_ent(self):
for activity in self:
return {'name': activity.display_name,
'view_type': 'form',
'target': 'new',
'res_model': activity.res_model,
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_id': activity.res_id}
if activity.res_id:
return {'name': activity.display_name,
'view_type': 'form',
'target': 'new',
'res_model': activity.res_model,
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_id': activity.res_id}
else:
raise UserError(
"Activity Not created yet, to open Related entity Create Activity first"
)

return {}



def name_get(self):
out = []
for activity in self:
name = '%s | %s' % (activity.summary or activity.activity_type_id.display_name, activity.user_id.display_name or '')
name = '%s | %s' % (
activity.summary or activity.activity_type_id.display_name, activity.user_id.display_name or '')
out.append((activity.id, name))
return out



11 changes: 1 addition & 10 deletions activity_validation/models/mail_activity_children_rel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,9 @@
##############################################################################
'''
Created on Nov 16, 2019
@author: mboscolo
'''
import logging
import datetime
from odoo import models
from odoo import fields
from odoo import api
from odoo import _
from odoo.exceptions import UserError
from datetime import timedelta
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
from odoo import fields, models


class MailActivityChildrenRel(models.Model):
Expand Down
53 changes: 29 additions & 24 deletions activity_validation/models/mail_activity_shedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,23 @@
##############################################################################
'''
Created on Nov 16, 2019
@author: mboscolo
'''
import logging
import datetime
from odoo import models
from odoo import fields
from odoo import api
from odoo import _
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from datetime import timedelta
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT


class MailActivitySchedule(models.TransientModel):
_inherit = 'mail.activity.schedule'



plm_state = fields.Selection([
('draft', _('draft')),
('in_progress', _('In Progress')),
('eco', _('Change Order')),
('done', _('Done')),
('cancel', _('Cancel')),
('exception', _('Exception')),
],
],
default='draft',
string=_('Plm State'))
children_ids = fields.One2many('mail.activity.children.rel.shedule',
Expand All @@ -56,18 +47,32 @@ class MailActivitySchedule(models.TransientModel):
has_parent = fields.Boolean(_('Has parent ECR'), compute="_compute_has_parent_ecr", store=True)
has_parent_eco = fields.Boolean(_('Has parent ECO'), compute="_compute_has_parent_eco", store=True)
eco_child_ids = fields.One2many('mail.activity.schedule',
'mail_parent_eco_activity_id',
_('ECO Activities'))
'mail_parent_eco_activity_id',
_('ECO Activities'))
mail_parent_eco_activity_id = fields.Many2one('mail.activity.schedule', _('ECO Parent Activity'))
default_plm_activity = fields.Many2one('mail.activity.type', compute='_compute_mail_activity_type')
is_eco = fields.Boolean(_('Is ECO'))

def _action_schedule_activities(self):
res = super()._action_schedule_activities()
res.write({
'children_ids': [
(0, 0, {
'name': self.children_ids.name,
'user_id': self.children_ids.user_id.id,
'mail_children_activity_id' : res.id
}),
]
})
return res

def _compute_mail_activity_type(self):
for activity_id in self:
activity_id.default_plm_activity = self.env.ref('plm.mail_activity_plm_activity')

def getParentECRActivity(self, activity_id):
parent_activity = self.env['mail.activity.children.rel.shedule'].search([('mail_children_activity_id', '=', activity_id.id)])
parent_activity = self.env['mail.activity.children.rel.shedule'].search(
[('mail_children_activity_id', '=', activity_id.id)])
return parent_activity.mapped('mail_parent_activity_id')

def getParentECOActivity(self, activity_id):
Expand Down Expand Up @@ -101,12 +106,12 @@ def changeActivityTypeId(self):
'name': '%s - %s' % (activity_id.activity_type_id.name, user_id.name),
'user_id': user_id.id,
'mail_children_activity_id': False,
}
}
rel_id = self.env['mail.activity.children.rel.shedule'].create(vals)
activity_ids.append(rel_id.id)
activity_id.write({
'children_ids': [(6, False, activity_ids)]
})
})

def write(self, vals):
ret = super(MailActivitySchedule, self).write(vals)
Expand Down Expand Up @@ -166,7 +171,7 @@ def isCustomType(self):
if activity_id.activity_type_id.change_activity_type in ['request', 'plm_activity']:
return True
return False

def unlink(self):
for activity_id in self:
if activity_id.isCustomType():
Expand Down Expand Up @@ -269,7 +274,7 @@ def action_in_progress(self):
'note': line_id.name,
'res_model_id': activity_id.res_model_id.id,
'res_id': activity_id.res_id,
}
}
new_activity_id = self.create(activity_vals)
line_id.mail_children_activity_id = new_activity_id.id
line_id.mail_parent_activity_id = activity_id.id
Expand All @@ -296,11 +301,11 @@ def action_open_releted_ent(self):
'view_mode': 'form',
'res_id': activity.res_id}
return {}



def name_get(self):
out = []
for activity in self:
name = '%s | %s' % (activity.summary or activity.activity_type_id.display_name, activity.user_id.display_name or '')
name = '%s | %s' % (
activity.summary or activity.activity_type_id.display_name, activity.user_id.display_name or '')
out.append((activity.id, name))
return out
return out
14 changes: 5 additions & 9 deletions activity_validation/models/mail_activity_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,16 @@
##############################################################################
'''
Created on Nov 16, 2019
@author: mboscolo
'''
from odoo import models
from odoo import fields
from odoo import _
from odoo import _, fields, models


class MailActivityType(models.Model):
_inherit = 'mail.activity.type'

activity_user_ids = fields.Many2many('res.users',
'activity_type_user_rel',
'activity_type_id',
'user_id',
_('Template Documents'))

'activity_type_user_rel',
'activity_type_id',
'user_id',
_('Template Documents'))
Loading

0 comments on commit fbd328d

Please sign in to comment.