From 3f9f0e4d4ed70e4c77f3b7f3c7afe4f6b9010195 Mon Sep 17 00:00:00 2001 From: Janik von Rotz Date: Mon, 19 Jul 2021 18:33:21 +0200 Subject: [PATCH] delete commented code --- __manifest__.py | 2 +- models/aircraft_type.py | 6 ------ models/bom.py | 2 +- models/change.py | 14 -------------- models/change_id.py | 8 -------- models/document.py | 9 +-------- models/document_revision_state.py | 7 ------- models/document_type.py | 14 -------------- models/part.py | 8 -------- models/specification.py | 6 ------ 10 files changed, 3 insertions(+), 73 deletions(-) diff --git a/__manifest__.py b/__manifest__.py index e867661..8bb97e8 100644 --- a/__manifest__.py +++ b/__manifest__.py @@ -9,7 +9,7 @@ 'website': "https://www.mint-system.ch", 'category': 'Operations', - 'version': '13.0.2.2.0', + 'version': '13.0.2.2.1', 'license': 'AGPL-3', # any module necessary for this one to work correctly diff --git a/models/aircraft_type.py b/models/aircraft_type.py index 0d00f78..0d2c10c 100644 --- a/models/aircraft_type.py +++ b/models/aircraft_type.py @@ -7,14 +7,8 @@ class AircraftType(models.Model): # fields name = fields.Char(required=True, string="Title") - #certificate_ids = fields.One2many("certificate_planer.certificate", "aircraft_type_id", string="Certificates") # constraints _sql_constraints = [ ('name_unique', 'unique (name)', "Aircraft Type with this Title already exists."), ] - - # def unlink(self): - # if len(self.certificate_ids) != 0: - # raise UserError(_('You cannot delete a Aircraft Type as long it is referenced by a Certificate.')) - # return super(AircraftType, self).unlink() diff --git a/models/bom.py b/models/bom.py index 994c55f..6100dce 100644 --- a/models/bom.py +++ b/models/bom.py @@ -7,7 +7,7 @@ class Bom(models.Model): # fields part_id = fields.Many2one("certificate_planer.part", string="Part") - part_ids = fields.Many2many("certificate_planer.part", string="Child Parts") + part_ids = fields.Many2many("certificate_planer.part", string="Child Parts", ondelete="restrict") # constraints _sql_constraints = [ diff --git a/models/change.py b/models/change.py index b1e6012..a0a4e43 100644 --- a/models/change.py +++ b/models/change.py @@ -20,24 +20,10 @@ class Change(models.Model): part_ids = fields.Many2many("certificate_planer.part", string="Parts", ondelete="restrict") revision_ids = fields.One2many("certificate_planer.document_revision", "change_id", string="Document Revisions") - # document_ids = fields.One2many("certificate_planer.document", "change_id", string="Documents") item_ids = fields.One2many("certificate_planer.post_certification_item", "change_id", string="Post Certification Items") - # defaults - # def unlink(self): - # if len(self.document_ids) != 0: - # raise UserError(_('You cannot delete an Change as long it is referenced by a Document.')) - # if len(self.revision_ids) != 0: - # raise UserError(_('You cannot delete an Change as long it is referenced by a Document Revision.')) - # return super(Change, self).unlink() - def name_get(self): res = [] for rec in self: res.append((rec.id, _('%s (%s)') % (rec.change_id_id.name, rec.certificate_id.part_id.name))) return res - - # @api.model - # def _read_group_status_ids(self, statuses, domain, order): - # statuse_ids = statuses._search([], order=order) - # return statuses.browse(statuse_ids) \ No newline at end of file diff --git a/models/change_id.py b/models/change_id.py index 33c9425..285c4f7 100644 --- a/models/change_id.py +++ b/models/change_id.py @@ -10,15 +10,7 @@ class ChangeID(models.Model): name = fields.Char(required=True, string="Title") sequence = fields.Integer() - # change_ids = fields.One2many("certificate_planer.change", "change_id_id", string="Changes") - # constraints _sql_constraints = [ ('name_unique', 'unique (name)', "Change ID with this Title already exists."), ] - - # defaults - # def unlink(self): - # if len(self.change_ids) != 0: - # raise UserError(_('You cannot delete an Change ID as long it is referenced by a Change.')) - # return super(ChangeID, self).unlink() \ No newline at end of file diff --git a/models/document.py b/models/document.py index f097737..a932324 100644 --- a/models/document.py +++ b/models/document.py @@ -26,15 +26,8 @@ class Document(models.Model): _sql_constraints = [ ('name_unique', 'unique (name)', "Document with this Document ID already exists."), ] - - # defaults - # def unlink(self): - # if len(self.part_ids) != 0: - # raise UserError(_('You cannot delete a Document as long it is referenced by a Part.')) - # if len(self.revision_ids) != 0: - # raise UserError(_('You cannot delete a Document as long it is referenced by a Document Revision.')) - # return super(Document, self).unlink() + # compute def _compute_revision_count(self): for record in self: record.revision_count = self.env['certificate_planer.document_revision'].search_count([('document_id', '=', self.id)]) diff --git a/models/document_revision_state.py b/models/document_revision_state.py index 56ce531..89b4a73 100644 --- a/models/document_revision_state.py +++ b/models/document_revision_state.py @@ -9,19 +9,12 @@ class DocumentRevisionState(models.Model): name = fields.Char(required=True, string="Title") active = fields.Boolean(default=True) - # revision_ids = fields.One2many("certificate_planer.document_revision", "state_id", string="Document Revisions") - # constraints _sql_constraints = [ ('name_unique', 'unique (name)', "Document Revision State with this Title already exists."), ] # defaults - # def unlink(self): - # if len(self.revision_ids) != 0: - # raise UserError(_('You cannot delete a Document Revision State as long it is referenced by a Document Revision.')) - # return super(DocumentRevisionState, self).unlink() - @api.model def name_search(self, name, args=None, operator="ilike", limit=100): args = args or [] diff --git a/models/document_type.py b/models/document_type.py index 8edbbd1..0802016 100644 --- a/models/document_type.py +++ b/models/document_type.py @@ -11,21 +11,7 @@ class DocumentType(models.Model): identification = fields.Char(required=True) description = fields.Char(help="Document ID Assignment") - # document_ids = fields.One2many("certificate_planer.document", "type_id", string="Documents") - # constraints _sql_constraints = [ ('name_unique', 'unique (name)', "Document Type with this Title already exists."), ] - - # defaults - # def unlink(self): - # if len(self.document_ids) != 0: - # raise UserError(_('You cannot delete a Document Type as long it is referenced by a Document.')) - # return super(DocumentType, self).unlink() - - # def name_get(self): - # res = [] - # for rec in self: - # res.append((rec.id, _('%s (%s)') % (rec.identification, rec.name))) - # return res \ No newline at end of file diff --git a/models/part.py b/models/part.py index 007cf02..f5997b1 100644 --- a/models/part.py +++ b/models/part.py @@ -24,14 +24,6 @@ class Part(models.Model): ('name_unique', 'unique (name)', "Part with this Partnumber already exists."), ] - # defaults - # def unlink(self): - # if len(self.bom_ids) != 0: - # raise UserError(_('You cannot delete a BoM/Part as long it is referenced by a parent BoM.')) - # if len(self.document_ids) != 0: - # raise UserError(_('You cannot delete a BoM/Part as long it is referenced by a document.')) - # return super(Part, self).unlink() - def name_get(self): res = [] for rec in self: diff --git a/models/specification.py b/models/specification.py index d0cf0a1..3c10cb0 100644 --- a/models/specification.py +++ b/models/specification.py @@ -7,14 +7,8 @@ class Specification(models.Model): # fields name = fields.Char(required=True, string="Title") - # certificate_ids = fields.One2many("certificate_planer.certificate", "specification_id", string="Certificates") # constraints _sql_constraints = [ ('name_unique', 'unique (name)', "Specification with this Title already exists."), ] - - # def unlink(self): - # if len(self.certificate_ids) != 0: - # raise UserError(_('You cannot delete a Specification as long it is referenced by a Certificate.')) - # return super(Specification, self).unlink() \ No newline at end of file