Files
odoo_source/addons/mrp/models/mrp_message.py
T
Josse Colpaert 2ddc35a530 [REF][NEWPIE] mrp: new MRP
This commit contains the core of the new MRP. It contains a whole refactoring
of the MRP application, with improved and new features, written in new API.
Among other here are the main manufacturing workflow improvements :

 - Picking type not only for pickings but also for manufacturing orders
 - Properties replaced by picking type
 - BoM can only be produced with its routing (no other)
 - Either produce without routing with only production orders, or produce with
   routing
 - By default, there is an order in the work orders (serially), but you can
   override it to be able to work in parallel
 - Time clocking on work orders and block time on work centers with reporting
   on OEE, performance, losses, ...
 - Real-time adaptation of timings on operations
 - Lots/serial numbers can be inputted like in the pickings on manufacturing
   orders.  It is also possible to input them in the work orders.
 - Material availability independent of production order state (possibility to
   start production when only part of it is there)
 - Work sheets on work orders
 - Put messages on work orders to make your workers pay attention to something
 - Full traceability link to see for each produced piece of stock, the
   consumed pieces, ...
 - Separate scrap object (a scrap is not done based on an original move
   anymore)
 - Separate unbuild system (if you want to unbuild into its original
   components)

Thanks to all people that helped during this development, notably but not
limited to Chirag A Dodiya (cod@odoo.com), Gaurav Panchal (gan@odoo.com),
Jignesh Rathod (jir@odoo.com), Mansi Trivedi (mtr@odoo.com), Pariket Trivedi
(ptr@odoo.com).
2016-07-04 16:22:37 +02:00

37 lines
1.4 KiB
Python

# -*- 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)]")
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