[FIX] mrp: remove mrp.message
The commit cfbfaf38be283e68c5a923ff2aafd1293135c4f1 remove the views and menus related to mrp.message. This commit complete it by removing the model, all the related fields and the access rules
This commit is contained in:
committed by
Simon Lejeune
parent
c119ea40bb
commit
d3df57bf90
@@ -4,7 +4,6 @@
|
||||
from . import mrp_document
|
||||
from . import res_config_settings
|
||||
from . import mrp_bom
|
||||
from . import mrp_message
|
||||
from . import mrp_routing
|
||||
from . import mrp_workcenter
|
||||
from . import mrp_production
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import html2plaintext
|
||||
|
||||
|
||||
class MrpProductionMessage(models.Model):
|
||||
_name = "mrp.message"
|
||||
_description = "Production Message"
|
||||
|
||||
@api.model
|
||||
def _default_valid_until(self):
|
||||
return datetime.today() + relativedelta(days=7)
|
||||
|
||||
name = fields.Text(compute='_get_note_first_line', store=True)
|
||||
message = fields.Html(required=True)
|
||||
product_tmpl_id = fields.Many2one('product.template', 'Product Template')
|
||||
product_id = fields.Many2one('product.product', string="Product")
|
||||
bom_id = fields.Many2one('mrp.bom', 'Bill of Material', domain="['|', ('product_id', '=', product_id), ('product_tmpl_id.product_variant_ids','=', product_id)]")
|
||||
workcenter_id = fields.Many2one('mrp.workcenter', string='Work Center')
|
||||
valid_until = fields.Date('Validity Date', default=_default_valid_until, required=True)
|
||||
routing_id = fields.Many2one('mrp.routing', string='Routing')
|
||||
|
||||
@api.depends('message')
|
||||
def _get_note_first_line(self):
|
||||
for message in self:
|
||||
message.name = (message.message and html2plaintext(message.message) or "").strip().replace('*', '').split("\n")[0]
|
||||
|
||||
@api.multi
|
||||
def save(self):
|
||||
""" Used in a wizard-like form view, manual save button when in edit mode """
|
||||
return True
|
||||
@@ -120,7 +120,6 @@ class MrpWorkorder(models.Model):
|
||||
help="Technical field indicating whether the current user is working. ")
|
||||
working_user_ids = fields.One2many('res.users', string='Working user on this work order.', compute='_compute_working_users')
|
||||
last_working_user_id = fields.One2many('res.users', string='Last user that worked on this work order.', compute='_compute_working_users')
|
||||
production_messages = fields.Html('Workorder Message', compute='_compute_production_messages')
|
||||
|
||||
next_work_order_id = fields.Many2one('mrp.workorder', "Next Work Order")
|
||||
scrap_ids = fields.One2many('stock.scrap', 'workorder_id')
|
||||
@@ -164,21 +163,6 @@ class MrpWorkorder(models.Model):
|
||||
else:
|
||||
order.is_user_working = False
|
||||
|
||||
@api.depends('production_id', 'workcenter_id', 'production_id.bom_id')
|
||||
def _compute_production_messages(self):
|
||||
ProductionMessage = self.env['mrp.message']
|
||||
for workorder in self:
|
||||
domain = [
|
||||
('valid_until', '>=', fields.Date.today()),
|
||||
'|', ('workcenter_id', '=', False), ('workcenter_id', '=', workorder.workcenter_id.id),
|
||||
'|', '|', '|',
|
||||
('product_id', '=', workorder.product_id.id),
|
||||
'&', ('product_id', '=', False), ('product_tmpl_id', '=', workorder.product_id.product_tmpl_id.id),
|
||||
('bom_id', '=', workorder.production_id.bom_id.id),
|
||||
('routing_id', '=', workorder.operation_id.routing_id.id)]
|
||||
messages = ProductionMessage.search(domain).mapped('message')
|
||||
workorder.production_messages = "<br/>".join(messages) or False
|
||||
|
||||
@api.multi
|
||||
def _compute_scrap_move_count(self):
|
||||
data = self.env['stock.scrap'].read_group([('workorder_id', 'in', self.ids)], ['workorder_id'], ['workorder_id'])
|
||||
|
||||
@@ -54,7 +54,5 @@ access_product_pricelist_item_mrp_manager,product.pricelist.item mrp_manager,pro
|
||||
access_resource_calendar_manufacturinguser,resource.calendar manufacturing.user,resource.model_resource_calendar,mrp.group_mrp_user,1,0,0,0
|
||||
access_mrp_unbuild,mrp.unbuild,model_mrp_unbuild,group_mrp_user,1,0,0,0
|
||||
access_mrp_unbuild_manager,mrp.unbuild manager,model_mrp_unbuild,group_mrp_manager,1,1,1,1
|
||||
access_mrp_message_mrp_user,mrp.message,model_mrp_message,group_mrp_user,1,0,0,0
|
||||
access_mrp_message_mrp_manager,mrp.message,model_mrp_message,group_mrp_manager,1,1,1,1
|
||||
access_mrp_document_mrp_manager,mrp.document group_user,model_mrp_document,group_mrp_manager,1,1,1,1
|
||||
access_mrp_document_mrp_user,mrp.document group_user,model_mrp_document,group_mrp_user,1,1,1,1
|
||||
|
||||
|
@@ -134,10 +134,6 @@
|
||||
</div>
|
||||
<field name="is_produced" invisible="1"/>
|
||||
</group>
|
||||
<div class="alert alert-danger alert-dismissible text-left" role="alert" attrs="{'invisible': [('production_messages', '=', False)]}">
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">x</a>
|
||||
<field name="production_messages"/>
|
||||
</div>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Work Instruction" attrs="{'invisible': [('worksheet', '=', False)]}">
|
||||
|
||||
Reference in New Issue
Block a user