diff --git a/multi_level_mrp/README.rst b/multi_level_mrp/README.rst new file mode 100644 index 000000000..0706853f5 --- /dev/null +++ b/multi_level_mrp/README.rst @@ -0,0 +1,75 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +=============== +Multi Level MRP +=============== + +This module allows you to calculate, based in known inventory, demand, and +supply, and based on parameters set at product variant level, the new +procurements for each product. + +To do this, the calculation starts at top level of the bill of material +and explodes this down to the lowest level. + +Key Features +------------ +* MRP parameters at product variant level +* Basic forecast system +* Cron job to calculate the MRP demand +* Manually calculate the MRP demand +* Confirm the calculated MRP demand and create BID's, PO's, or MO's +* View to see the products for which action is needed + + +Installation +============ + + +Usage +===== + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/129/11.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Original Odoo icons. + + +Contributors +------------ + +* Wim Audenaert +* Jordi Ballester + + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/multi_level_mrp/__init__.py b/multi_level_mrp/__init__.py new file mode 100644 index 000000000..aee8895e7 --- /dev/null +++ b/multi_level_mrp/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/multi_level_mrp/__manifest__.py b/multi_level_mrp/__manifest__.py new file mode 100644 index 000000000..f7aac27b8 --- /dev/null +++ b/multi_level_mrp/__manifest__.py @@ -0,0 +1,31 @@ +{ + 'name': 'Multi Level MRP', + 'version': '11.0.1.0.0', + 'author': 'Ucamco, ' + 'Eficent, ' + 'Odoo Community Association (OCA)', + 'summary': 'Adds an MRP Scheduler', + 'website': 'https://github.com/OCA/manufacture', + 'category': 'Manufacturing', + 'depends': [ + 'mrp', + 'stock', + 'purchase', + ], + 'data': [ + 'security/ir.model.access.csv', + 'views/mrp_forecast_view.xml', + 'views/mrp_area_view.xml', + 'views/product_view.xml', + 'views/stock_location_view.xml', + 'views/mrp_product_view.xml', + 'wizards/mrp_inventory_create_procurement_view.xml', + 'views/mrp_inventory_view.xml', + 'wizards/multi_level_mrp_view.xml', + 'wizards/mrp_move_create_po_view.xml', + 'views/mrp_menuitem.xml', + 'data/multi_level_mrp_cron.xml', + ], + 'installable': True, + 'application': True, +} diff --git a/multi_level_mrp/data/multi_level_mrp_cron.xml b/multi_level_mrp/data/multi_level_mrp_cron.xml new file mode 100755 index 000000000..96b16d8ab --- /dev/null +++ b/multi_level_mrp/data/multi_level_mrp_cron.xml @@ -0,0 +1,19 @@ + + + + + + Multi Level MRP + + + 1 + days + -1 + + + + + + + + diff --git a/multi_level_mrp/models/__init__.py b/multi_level_mrp/models/__init__.py new file mode 100644 index 000000000..ca00b054e --- /dev/null +++ b/multi_level_mrp/models/__init__.py @@ -0,0 +1,7 @@ +from . import mrp_area +from . import stock_location +from . import mrp_forecast +from . import product +from . import mrp_product +from . import mrp_move +from . import mrp_inventory diff --git a/multi_level_mrp/models/mrp_area.py b/multi_level_mrp/models/mrp_area.py new file mode 100644 index 000000000..2111dcd4a --- /dev/null +++ b/multi_level_mrp/models/mrp_area.py @@ -0,0 +1,19 @@ +# © 2016 Ucamco - Wim Audenaert +# © 2016 Eficent Business and IT Consulting Services S.L. +# - Jordi Ballester Alomar +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class MrpArea(models.Model): + _name = 'mrp.area' + + name = fields.Char('Name') + warehouse_id = fields.Many2one( + comodel_name='stock.warehouse', string='Warehouse', + required=True) + location_id = fields.Many2one( + comodel_name='stock.location', string='Location', + required=True) + active = fields.Boolean(default=True) diff --git a/multi_level_mrp/models/mrp_forecast.py b/multi_level_mrp/models/mrp_forecast.py new file mode 100644 index 000000000..6ada2492b --- /dev/null +++ b/multi_level_mrp/models/mrp_forecast.py @@ -0,0 +1,197 @@ +# © 2016 Ucamco - Wim Audenaert +# © 2016 Eficent Business and IT Consulting Services S.L. +# - Jordi Ballester Alomar +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import api, fields, models +from datetime import date, datetime + + +class MrpForecastForecast(models.Model): + _name = 'mrp.forecast.forecast' + + date = fields.Date('Date') + forecast_product_id = fields.Many2one('mrp.forecast.product', 'Product', + select=True) + name = fields.Char('Description') + qty_forecast = fields.Float('Quantity') + + _order = 'forecast_product_id, date' + + +class MrpForecastProduct(models.Model): + _name = 'mrp.forecast.product' + + @api.one + @api.depends('product_id') + def _function_name(self): + if self.product_id: + self.name = "[%s] %s" % (self.product_id.default_code, + self.product_id.name_template, ) + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_m0(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + fcmonth = (datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).year * 100) + \ + datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).month + tmonth = (date.today().year * 100) + date.today().month + if not(datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')) < date.today()) \ + and fcmonth == tmonth: + qty += fc.qty_forecast + self.qty_forecast_m0 = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_m1(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + fcmonth = (datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).year * 100) + datetime.date( + datetime.strptime(fc.date, '%Y-%m-%d')).month + tdyear = date.today().year + tdmonth = date.today().month + 1 + if tdmonth > 12: + tdmonth -= 12 + tdyear += 1 + tmonth = (tdyear * 100) + tdmonth + if fcmonth == tmonth: + qty += fc.qty_forecast + self.qty_forecast_m1 = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_m2(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + fcmonth = (datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).year * 100) + datetime.date( + datetime.strptime(fc.date, '%Y-%m-%d')).month + tdyear = date.today().year + tdmonth = date.today().month + 2 + if tdmonth > 12: + tdmonth -= 12 + tdyear += 1 + tmonth = (tdyear * 100) + tdmonth + if fcmonth == tmonth: + qty += fc.qty_forecast + self.qty_forecast_m2 = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_m3(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + fcmonth = (datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).year * 100) + datetime.date( + datetime.strptime(fc.date, '%Y-%m-%d')).month + tdyear = date.today().year + tdmonth = date.today().month + 3 + if tdmonth > 12: + tdmonth -= 12 + tdyear += 1 + tmonth = (tdyear * 100) + tdmonth + if fcmonth == tmonth: + qty += fc.qty_forecast + self.qty_forecast_m3 = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_m4(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + fcmonth = (datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).year * 100) + datetime.date( + datetime.strptime(fc.date, '%Y-%m-%d')).month + tdyear = date.today().year + tdmonth = date.today().month + 4 + if tdmonth > 12: + tdmonth -= 12 + tdyear += 1 + tmonth = (tdyear * 100) + tdmonth + if fcmonth == tmonth: + qty += fc.qty_forecast + self.qty_forecast_m4 = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_m5(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + fcmonth = (datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).year * 100) + datetime.date( + datetime.strptime(fc.date, '%Y-%m-%d')).month + tdyear = date.today().year + tdmonth = date.today().month + 5 + if tdmonth > 12: + tdmonth -= 12 + tdyear += 1 + tmonth = (tdyear * 100) + tdmonth + if fcmonth == tmonth: + qty += fc.qty_forecast + self.qty_forecast_m5 = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_m6(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + fcmonth = (datetime.date(datetime.strptime( + fc.date, '%Y-%m-%d')).year * 100) + datetime.date( + datetime.strptime(fc.date, '%Y-%m-%d')).month + tdyear = date.today().year + tdmonth = date.today().month + 6 + if tdmonth > 12: + tdmonth -= 12 + tdyear += 1 + tmonth = (tdyear * 100) + tdmonth + if fcmonth == tmonth: + qty += fc.qty_forecast + self.qty_forecast_m6 = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_past(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + if datetime.date( + datetime.strptime(fc.date, '%Y-%m-%d')) < date.today(): + qty += fc.qty_forecast + self.qty_forecast_past = qty + + @api.one + @api.depends('mrp_forecast_ids') + def _function_forecast_total(self): + qty = 0.00 + for fc in self.mrp_forecast_ids: + qty += fc.qty_forecast + self.qty_forecast_total = qty + + mrp_forecast_ids = fields.One2many('mrp.forecast.forecast', + 'forecast_product_id', + 'Forecast') + name = fields.Char(compute='_function_name', string='Description') + product_id = fields.Many2one('product.product', 'Product', select=True) + mrp_area_id = fields.Many2one('mrp.area', 'MRP Area') + qty_forecast_m0 = fields.Float(compute='_function_forecast_m0', + string='This Month Forecast') + qty_forecast_m1 = fields.Float(compute='_function_forecast_m1', + string='Month+1 Forecast') + qty_forecast_m2 = fields.Float(compute='_function_forecast_m2', + string='Month+2 Forecast') + qty_forecast_m3 = fields.Float(compute='_function_forecast_m3', + string='Month+3 Forecast') + qty_forecast_m4 = fields.Float(compute='_function_forecast_m4', + string='Month+4 Forecast') + qty_forecast_m5 = fields.Float(compute='_function_forecast_m5', + string='Month+5 Forecast') + qty_forecast_m6 = fields.Float(compute='_function_forecast_m6', + string='Month+6 Forecast') + qty_forecast_past = fields.Float(compute='_function_forecast_past', + string='Past Forecast') + qty_forecast_total = fields.Float(compute='_function_forecast_total', + string='Total Forecast') diff --git a/multi_level_mrp/models/mrp_inventory.py b/multi_level_mrp/models/mrp_inventory.py new file mode 100644 index 000000000..dbd4d3857 --- /dev/null +++ b/multi_level_mrp/models/mrp_inventory.py @@ -0,0 +1,23 @@ +# © 2016 Ucamco - Wim Audenaert +# © 2016 Eficent Business and IT Consulting Services S.L. +# - Jordi Ballester Alomar +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class MrpInventory(models.Model): + _name = 'mrp.inventory' + + mrp_area_id = fields.Many2one('mrp.area', 'MRP Area', + related='mrp_product_id.mrp_area_id') + mrp_product_id = fields.Many2one('mrp.product', 'Product', + select=True) + date = fields.Date('Date') + demand_qty = fields.Float('Demand') + supply_qty = fields.Float('Supply') + initial_on_hand_qty = fields.Float('Starting Inventory') + final_on_hand_qty = fields.Float('Forecasted Inventory') + to_procure = fields.Float('To procure') + + _order = 'mrp_product_id, date' diff --git a/multi_level_mrp/models/mrp_move.py b/multi_level_mrp/models/mrp_move.py new file mode 100644 index 000000000..e4ed859ba --- /dev/null +++ b/multi_level_mrp/models/mrp_move.py @@ -0,0 +1,186 @@ +# © 2016 Ucamco - Wim Audenaert +# © 2016 Eficent Business and IT Consulting Services S.L. +# - Jordi Ballester Alomar +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models, fields, api, _ +from odoo import exceptions + + +class MrpMove(models.Model): + _name = 'mrp.move' + + mrp_area_id = fields.Many2one('mrp.area', 'MRP Area') + current_date = fields.Date('Current Date') + current_qty = fields.Float('Current Qty') + mrp_action = fields.Selection((('mo', 'Manufacturing Order'), + ('po', 'Purchase Order'), + ('pr', 'Purchase Request'), + ('so', 'Sale Order'), + ('push', 'Push'), + ('pull', 'Pull'), + ('cancel', 'Cancel'), + ('none', 'None')), + 'Action') + mrp_action_date = fields.Date('MRP Action Date') + mrp_date = fields.Date('MRP Date') + mrp_move_down_ids = fields.Many2many('mrp.move', 'mrp_move_rel', + 'move_up_id', 'move_down_id', + 'MRP Move DOWN') + mrp_move_up_ids = fields.Many2many('mrp.move', 'mrp_move_rel', + 'move_down_id', 'move_up_id', + 'MRP Move UP') + mrp_minimum_stock = fields.Float(string='Minimum Stock', + related='product_id.mrp_minimum_stock') + mrp_order_number = fields.Char('Order Number') + mrp_origin = fields.Selection((('mo', 'Manufacturing Order'), + ('po', 'Purchase Order'), + ('pr', 'Purchase Request'), + ('so', 'Sale Order'), ('mv','Move'), + ('fc', 'Forecast'), ('mrp', 'MRP')), + 'Origin') + mrp_processed = fields.Boolean('Processed') + mrp_product_id = fields.Many2one('mrp.product', 'Product', select=True) + mrp_qty = fields.Float('MRP Quantity') + mrp_type = fields.Selection((('s', 'Supply'), ('d', 'Demand')), 'Type') + name = fields.Char('Description') + parent_product_id = fields.Many2one('product.product', + 'Parent Product', select=True) + product_id = fields.Many2one('product.product', + 'Product', select=True) + production_id = fields.Many2one('mrp.production', + 'Manufacturing Order', select=True) + purchase_line_id = fields.Many2one('purchase.order.line', + 'Purchase Order Line', select=True) + purchase_order_id = fields.Many2one('purchase.order', + 'Purchase Order', select=True) + running_availability = fields.Float('Running Availability') + sale_line_id = fields.Many2one('sale.order.line', + 'Sale Order Line', select=True) + sale_order_id = fields.Many2one('sale.order', 'Sale Order', select=True) + state = fields.Selection((('draft', 'Draft'), + ('assigned', 'Assigned'), + ('confirmed', 'Confirmed'), + ('waiting', 'Waiting'), + ('ready', 'Ready'), + ('in_production', 'In Production'), + ('picking_except', 'Picking Exception'), + ('sent', 'Sent'), ('approved', 'Approved'), + ('except_invoice', 'Invoice Exception')), + 'State') + stock_move_id = fields.Many2one('stock.move', 'Stock Move', select=True) + + _order = 'mrp_product_id, mrp_date, mrp_type desc, id' + + @api.model + def mrp_production_prepare(self, bom_id, routing_id): + return { + 'product_uos_qty': 0.00, + 'product_uom': self.product_id.product_tmpl_id.uom_id.id, + 'product_qty': self.mrp_qty, + 'product_id': self.product_id.id, + 'location_src_id': 12, + 'date_planned': self.mrp_date, + 'cycle_total': 0.00, + 'company_id': 1, + 'state': 'draft', + 'hour_total': 0.00, + 'bom_id': bom_id, + 'routing_id': routing_id, + 'allow_reorder': False + } + + @api.model + def mrp_process_mo(self): + if self.mrp_action != 'mo': + return True + bom_id = False + routing_id = False + mrp_boms = self.env['mrp.bom'].search( + [('product_id', '=', self.product_id.id), + ('type', '=', 'normal')], limit=1) + for mrp_bom in mrp_boms: + bom_id = mrp_bom.id + routing_id = mrp_bom.routing_id.id + + if self.product_id.track_production and self.mrp_qty > 1: + raise exceptions.Warning(_('Not allowed to create ' + 'manufacturing order with ' + 'quantity higher than 1 ' + 'for serialized product')) + else: + production_data = self.mrp_production_prepare(bom_id, routing_id) + pr = self.env['mrp.production'].create(production_data) + self.production_id = pr.id + self.current_qty = self.mrp_qty + self.current_date = self.mrp_date + self.mrp_processed = True + self.name = pr.name + + @api.model + def mrp_process_pr(self): + if self.mrp_action != 'pr': + return True + seq = self.env['ir.sequence'].search( + [('code', '=', 'purchase.order.requisition')]) + seqnbr = self.env['ir.sequence'].next_by_id(seq.id) + self.env['purchase.requisition'].create({ + 'origin': 'MRP - [' + self.product_id.default_code + '] ' + + self.product_id.name_template, + 'exclusive': 'exclusive', + 'message_follower_ids': False, + 'date_end': False, + 'date_start': self.mrp_date, + 'company_id': 1, + 'warehouse_id': 1, + 'state': 'draft', + 'line_ids': [[0, False, + {'product_uom_id': + self.product_id.product_tmpl_id.uom_id.id, + 'product_id': self.product_id.id, + 'product_qty': self.mrp_qty, + 'name': self.product_id.name_template}]], + 'message_ids': False, + 'description': False, + 'name': seqnbr + }) + self.current_qty = self.mrp_qty + self.current_date = self.mrp_date + self.mrp_processed = True + self.name = seqnbr + + @api.one + def mrp_process(self): + self.mrp_process_mo() + self.mrp_process_pr() + return True + + @api.v7 + def mrp_process_po(self, cr, uid, ids, context=None): + view_id = self.pool.get('ir.ui.view').search( + cr, uid, [('model', '=', 'mrp.move.create.po'), + ('name', '=', 'mrp.move.create.po.form')]) + move = self.browse(cr, uid, ids)[0] + context['move_id'] = move.id + context['default_move_id'] = move.id + context['default_mrp_qty'] = move.mrp_qty + context['default_mrp_date'] = move.mrp_date + context['default_qty_po'] = move.mrp_qty + context['default_date_po'] = move.mrp_date + context['default_main_supplier_id'] = \ + move.mrp_product_id.main_supplier_id.id + context['default_product_id'] = move.mrp_product_id.product_id.id + context['default_purchase_line_warn_msg'] = \ + move.mrp_product_id.product_id.purchase_line_warn_msg + context['default_purchase_line_warn'] = \ + move.mrp_product_id.product_id.purchase_line_warn + return { + 'type': 'ir.actions.act_window', + 'name': 'Create PO', + 'view_mode': 'form', + 'view_type': 'form', + 'view_id': view_id[0], + 'res_model': 'mrp.move.create.po', + 'target': 'new', + 'context': context, + } diff --git a/multi_level_mrp/models/mrp_product.py b/multi_level_mrp/models/mrp_product.py new file mode 100644 index 000000000..497791768 --- /dev/null +++ b/multi_level_mrp/models/mrp_product.py @@ -0,0 +1,47 @@ +# © 2016 Ucamco - Wim Audenaert +# © 2016 Eficent Business and IT Consulting Services S.L. +# - Jordi Ballester Alomar +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class MrpProduct(models.Model): + _name = 'mrp.product' + + mrp_area_id = fields.Many2one('mrp.area', 'MRP Area') + current_qty_available = fields.Float(string='Current Qty Available', + related='product_id.qty_available') + main_supplier_id = fields.Many2one('res.partner', 'Main Supplier', + select=True) + mrp_inspection_delay = fields.Integer( + string='Inspection Delay', related='product_id.mrp_inspection_delay') + mrp_lead_time = fields.Integer(string='Lead Time', + related='product_id.mrp_lead_time') + mrp_llc = fields.Integer('Low Level Code', select=True) + mrp_maximum_order_qty = fields.Float( + string='Maximum Order Qty', related='product_id.mrp_maximum_order_qty') + mrp_minimum_order_qty = fields.Float( + string='Minimum Order Qty', related='product_id.mrp_minimum_order_qty') + mrp_minimum_stock = fields.Float(string='Minimum Stock', + related='product_id.mrp_minimum_stock') + mrp_move_ids = fields.One2many('mrp.move', 'mrp_product_id', 'MRP Moves') + mrp_nbr_days = fields.Integer( + string='Nbr. Days', related='product_id.mrp_nbr_days') + mrp_qty_available = fields.Float('MRP Qty Available') + mrp_qty_multiple = fields.Float(string='Qty Multiple', + related='product_id.mrp_qty_multiple') + mrp_transit_delay = fields.Integer(mrp_move_ids) + mrp_verified = fields.Boolean(string='MRP Verified', + related='product_id.mrp_verified') + name = fields.Char('Description') + nbr_mrp_actions = fields.Integer('Nbr Actions', select=True) + nbr_mrp_actions_4w = fields.Integer('Nbr Actions 4 Weeks', select=True) + product_id = fields.Many2one('product.product', 'Product', select=True) + product_tmpl_id = fields.Many2one('product.template', 'Product Template', + related='product_id.product_tmpl_id') + purchase_requisition = fields.Boolean(string='Purchase Requisition', + related='product_id.purchase_requisition') + supply_method = fields.Selection((('buy', 'Buy'), + ('produce', 'Produce')), + 'Supply Method') diff --git a/multi_level_mrp/models/product.py b/multi_level_mrp/models/product.py new file mode 100644 index 000000000..8a9da769b --- /dev/null +++ b/multi_level_mrp/models/product.py @@ -0,0 +1,41 @@ +# © 2016 Ucamco - Wim Audenaert +# © 2016 Eficent Business and IT Consulting Services S.L. +# - Jordi Ballester Alomar +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class Product(models.Model): + _inherit = 'product.product' + + llc = fields.Integer('Low Level Code', default=0) + manufacturing_order_ids = fields.One2many('mrp.production', + 'product_id', + 'Manufacturing Orders', + domain=[('state', '=', 'draft')]) + mrp_applicable = fields.Boolean('MRP Applicable') + mrp_exclude = fields.Boolean('Exclude from MRP') + mrp_inspection_delay = fields.Integer('Inspection Delay', default=0) + mrp_lead_time = fields.Integer('Lead Time', default=1) + mrp_maximum_order_qty = fields.Float('Maximum Order Qty', default=0.00) + mrp_minimum_order_qty = fields.Float('Minimum Order Qty', default=0.00) + mrp_minimum_stock = fields.Float('Minimum Stock') + mrp_nbr_days = fields.Integer('Nbr. Days', default=0, + help="Number of days to group demand for " + "this product during the MRP run, " + "in order to determine the quantity " + "to order.") + mrp_product_ids = fields.One2many('mrp.product', + 'product_id', 'MRP Product data') + mrp_qty_multiple = fields.Float('Qty Multiple', default=1.00) + mrp_transit_delay = fields.Integer('Transit Delay', default=0) + mrp_verified = fields.Boolean('Verified for MRP', + help="Identifies that this product has " + "been verified to be valid for the " + "MRP.") + purchase_order_line_ids = fields.One2many('purchase.order.line', + 'product_id', 'Purchase Orders') + purchase_requisition_ids = fields.One2many('purchase.requisition.line', + 'product_id', + 'Purchase Requisitions') diff --git a/multi_level_mrp/models/stock_location.py b/multi_level_mrp/models/stock_location.py new file mode 100644 index 000000000..30ce00409 --- /dev/null +++ b/multi_level_mrp/models/stock_location.py @@ -0,0 +1,15 @@ +# © 2016 Ucamco - Wim Audenaert +# © 2016 Eficent Business and IT Consulting Services S.L. +# - Jordi Ballester Alomar +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class StockLocation(models.Model): + _inherit = 'stock.location' + + mrp_area_id = fields.Many2one('mrp.area', string='MRP Area', + help="Requirements for a particular MRP " + "area are combined for the purposes " + "of procurement by the MRP.") diff --git a/multi_level_mrp/security/ir.model.access.csv b/multi_level_mrp/security/ir.model.access.csv new file mode 100644 index 000000000..971f0b8ba --- /dev/null +++ b/multi_level_mrp/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mrp_inventory_user,mrp.inventory,model_mrp_inventory,mrp.group_mrp_user,1,0,0,0 +access_mrp_move_user,mrp.move,model_mrp_move,mrp.group_mrp_user,1,0,0,0 +access_mrp_product,mrp.product,model_mrp_product,base.group_user,1,0,0,0 diff --git a/multi_level_mrp/static/src/img/icon.png b/multi_level_mrp/static/src/img/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/multi_level_mrp/static/src/img/icon.png differ diff --git a/multi_level_mrp/views/mrp_area_view.xml b/multi_level_mrp/views/mrp_area_view.xml new file mode 100644 index 000000000..fca2c22ab --- /dev/null +++ b/multi_level_mrp/views/mrp_area_view.xml @@ -0,0 +1,63 @@ + + + + + + mrp.area.tree + mrp.area + form + + + + + + + + + + + mrp.area.form + mrp.area + form + +
+ + + + + + + + + + +
+
+
+ + + + MRP Area + mrp.area + ir.actions.act_window + form + tree,form + + + + + + form + + + + + + tree + + + + +
+
+ diff --git a/multi_level_mrp/views/mrp_forecast_view.xml b/multi_level_mrp/views/mrp_forecast_view.xml new file mode 100644 index 000000000..ab041d9f9 --- /dev/null +++ b/multi_level_mrp/views/mrp_forecast_view.xml @@ -0,0 +1,77 @@ + + + + + + mrp.forecast.tree + mrp.forecast.product + form + + + + + + + + + + + + + + + + + + + mrp.forecast.form + mrp.forecast.product + form + +
+ + + + + + + + + + + + + + + + +
+
+
+ + + + MRP Forecast + mrp.forecast.product + ir.actions.act_window + form + tree,form + + + + + + form + + + + + + tree + + + + +
+
+ diff --git a/multi_level_mrp/views/mrp_inventory_view.xml b/multi_level_mrp/views/mrp_inventory_view.xml new file mode 100644 index 000000000..b522b2f58 --- /dev/null +++ b/multi_level_mrp/views/mrp_inventory_view.xml @@ -0,0 +1,97 @@ + + + + + + mrp.inventory.form + mrp.inventory + form + +
+ + + + + + + + + + +
+
+
+ + + mrp.inventory.tree + mrp.inventory + form + + + + + + + + + + +