@ -0,0 +1,60 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Simple Manufacturing Orders |
|||
=========================== |
|||
This module will help you to create manufacturing order in few steps. |
|||
|
|||
Configuration |
|||
============= |
|||
- For the user who needs access to this module, select 'Administrator' under the 'Simple Manufacturing' category. |
|||
|
|||
Features |
|||
======== |
|||
* Warning will appear if the quantity is not available |
|||
|
|||
Installation |
|||
============ |
|||
- www.odoo.com/documentation/18.0/setup/install.html |
|||
- Install our custom addon |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: |
|||
(V14) Mehjabin Farsana, |
|||
(V15) Pranav T V, |
|||
(V16) Pranav T V, |
|||
(V17) Mruthul Raj, |
|||
(V18) Farook Al Ameen, |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
For support and more information, please visit https://www.cybrosys.com |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Mruthul Raj(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import models |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Mruthul Raj(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Simple Manufacturing Orders', |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Manufacturing', |
|||
'summary': 'Create Manufacturing Orders Easily', |
|||
'description': """This module allow you to create manufacturing orders |
|||
with out taking the work orders or work centers.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['mail', 'stock'], |
|||
'data': [ |
|||
'security/simple_mrp_order_security.xml', |
|||
'security/ir.model.access.csv', |
|||
'data/ir_sequence_data.xml', |
|||
'data/stock_location_data.xml', |
|||
'views/mrp_order_views.xml', |
|||
'views/simple_mrp_bom_views.xml', |
|||
'views/product_product_views.xml', |
|||
'views/product_template_views.xml', |
|||
], |
|||
'images': ['static/description/banner.gif'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': True, |
|||
} |
@ -0,0 +1,14 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<odoo> |
|||
<data> |
|||
<!--Sequence number for the model mrp.order--> |
|||
<record id="sequence_simple_mrp" model="ir.sequence"> |
|||
<field name="name">Simple MRP</field> |
|||
<field name="code">mrp.order</field> |
|||
<field name="prefix">MRP/</field> |
|||
<field name="padding">5</field> |
|||
<field name="number_next">1</field> |
|||
<field name="number_increment">1</field> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<!--Creating new location for Simple production--> |
|||
<record id="location_simple_mrp" model="stock.location"> |
|||
<field name="name">Simple Production</field> |
|||
<field name="location_id" |
|||
ref="stock.stock_location_locations_virtual"/> |
|||
<field name="usage">inventory</field> |
|||
<field name="company_id"/> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,6 @@ |
|||
## Module <simple_mrp_order> |
|||
|
|||
#### 04.03.2024 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Simple Manufacturing Orders |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Mruthul Raj(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import mrp_order |
|||
from . import simple_mrp_bom |
|||
from . import simple_mrp_bom_line |
|||
from . import mrp_order_line |
@ -0,0 +1,263 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Mruthul Raj(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, models, fields, _ |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class MRPOrder(models.Model): |
|||
"""Creates the model named mrp.order""" |
|||
_name = 'mrp.order' |
|||
_description = "Manufacturing Order" |
|||
_inherit = ["mail.thread", "mail.activity.mixin"] |
|||
|
|||
@api.model |
|||
def _get_default_location_src_id(self): |
|||
""""Method _get_default_location_src_id to assign the value to the field |
|||
location_src_id by default""" |
|||
location = False |
|||
company_id = self.env.context.get('default_company_id', |
|||
self.env.company.id) |
|||
if self.env.context.get('default_picking_type_id'): |
|||
location = self.env['stock.picking.type'].browse(self.env.context[ |
|||
'default_picking_type_id']).default_location_src_id |
|||
if not location: |
|||
location = self.env['stock.warehouse'].search( |
|||
[('company_id', '=', company_id)], limit=1).lot_stock_id |
|||
return location and location.id or False |
|||
|
|||
location_src_id = fields.Many2one('stock.location', |
|||
default=_get_default_location_src_id, |
|||
string='Default Location', |
|||
help='Default source location of the ' |
|||
'mrp order') |
|||
product_id = fields.Many2one('product.product', string="Product", |
|||
required=True, domain="""[ |
|||
('type', 'in', ['product', 'consu']),'|',('company_id', '=', False), |
|||
('company_id', '=', company_id)]""", help='Product to be created') |
|||
name = fields.Char( |
|||
string='Reference', copy=False, readonly=True, |
|||
default=lambda x: _('New'), help='Name of the MRP order') |
|||
product_qty = fields.Float(string="Quantity To Manufacture", default=1.0, |
|||
tracking=True, |
|||
help='Quantity of the product to manufacture') |
|||
user_id = fields.Many2one('res.users', string='Responsible', |
|||
default=lambda self: self.env.user, |
|||
states={'done': [('readonly', True)]}, |
|||
help='User responsible for the mrp order') |
|||
company_id = fields.Many2one('res.company', string='Company', |
|||
default=lambda self: self.env.company, |
|||
index=True, required=True, |
|||
help='Company corresponding to the order') |
|||
uom_id = fields.Many2one('uom.uom', string='Product Unit of Measure', |
|||
required=True, |
|||
help='Unit of Measurement of the product to ' |
|||
'manufacture') |
|||
uom_categ_id = fields.Many2one(related='product_id.uom_id.category_id') |
|||
date_planned = fields.Datetime('Scheduled Date', copy=False, |
|||
default=fields.Datetime.now, |
|||
help="Date at which production start.", |
|||
index=True, required=True) |
|||
bom_id = fields.Many2one('simple.mrp.bom', string="Bills of Material", |
|||
help='Bill of Material of the product') |
|||
line_ids = fields.One2many('mrp.order.line', 'mrp_id', string="Components", |
|||
help='Components needed to create the product') |
|||
stock_line_ids = fields.One2many('stock.move', 'mrp_id', string='Products', |
|||
help='Stock move lines of the mrp order') |
|||
stock_move_id = fields.Many2one('stock.move', string='Stock Move', |
|||
help='Stock move of the mrp order') |
|||
state = fields.Selection([ |
|||
('draft', 'Draft'), |
|||
('confirmed', 'Confirmed'), |
|||
('done', 'Done'), |
|||
('cancel', 'Cancelled')], string='State', |
|||
copy=False, index=True, readonly=True, |
|||
store=True, tracking=True, default='draft', |
|||
help='State of the mrp order') |
|||
|
|||
@api.onchange('product_id') |
|||
def onchange_product_id(self): |
|||
""" Update the Uom for the product """ |
|||
self.uom_id = self.product_id.uom_id.id |
|||
bom_id = self.env['simple.mrp.bom'].search([ |
|||
('product_id', '=', self.product_id.id) |
|||
], limit=1) |
|||
if self.product_id: |
|||
self.bom_id = bom_id or False |
|||
|
|||
@api.onchange('uom_id') |
|||
def _onchange_uom_id(self): |
|||
""" Update the Uom for the product """ |
|||
multiple = 1 |
|||
if self.uom_id.uom_type == 'bigger': |
|||
multiple = self.uom_id.factor_inv |
|||
elif self.uom_id.uom_type == 'smaller': |
|||
multiple = 1 / self.uom_id.factor |
|||
self.stock_line_ids = False |
|||
self.line_ids = False |
|||
vals = [] |
|||
for rec in self.bom_id.line_ids: |
|||
vals.append((0, 0, { |
|||
'product_id': rec.product_id.id, |
|||
'product_qty': rec.product_qty * self.product_qty * multiple, |
|||
'uom_id': rec.uom_id.id, |
|||
})) |
|||
self.line_ids = vals |
|||
destination = self.env.ref('simple_mrp_order.location_simple_mrp') |
|||
for line in self.bom_id.line_ids: |
|||
val = { |
|||
'product_id': line.product_id.id, |
|||
'product_uom_qty': line.product_qty * self.product_qty * multiple, |
|||
'name': line.product_id.name, |
|||
'company_id': self.company_id.id, |
|||
'location_id': self.location_src_id.id, |
|||
'location_dest_id': destination.id, |
|||
'product_uom': line.uom_id.id, |
|||
'state': 'draft', |
|||
'product_uom_category_id': line.uom_id.category_id, |
|||
} |
|||
self.stock_line_ids = [fields.Command.create(val)] |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
"""Supering the already existing create method to add the sequence |
|||
for the mrp order""" |
|||
location_id = self.env['stock.warehouse'].search( |
|||
[('company_id', '=', self.env.company.id)], limit=1).lot_stock_id.id |
|||
destination_id = self.env.ref('simple_mrp_order.location_simple_mrp').id |
|||
if vals.get('stock_line_ids'): |
|||
for item in vals.get('stock_line_ids'): |
|||
product_name = self.env['product.product'].browse( |
|||
item[2].get('product_id')).name |
|||
item[2]['location_id'] = location_id |
|||
item[2]['location_dest_id'] = destination_id |
|||
item[2]['name'] = product_name |
|||
if "name" not in vals or vals["name"] == _("New"): |
|||
vals["name"] = self.env["ir.sequence"].next_by_code( |
|||
"mrp.order" |
|||
) or _("New") |
|||
return super().create(vals) |
|||
|
|||
@api.onchange('bom_id', 'product_qty') |
|||
def onchange_bom_id(self): |
|||
""" Update the Components for the MRP Order """ |
|||
self.line_ids = False |
|||
self.stock_line_ids = False |
|||
self.product_id = self.bom_id.product_id.id |
|||
vals = [] |
|||
for line in self.bom_id.line_ids: |
|||
vals.append((0, 0, { |
|||
'product_id': line.product_id.id, |
|||
'product_qty': line.product_qty * self.product_qty, |
|||
'uom_id': line.uom_id.id, |
|||
})) |
|||
val = [] |
|||
destination = self.env.ref('simple_mrp_order.location_simple_mrp') |
|||
for line in self.bom_id.line_ids: |
|||
val.append((0, 0, { |
|||
'product_id': line.product_id.id, |
|||
'product_uom_qty': line.product_qty * self.product_qty, |
|||
'name': line.product_id.name, |
|||
'company_id': self.company_id.id, |
|||
'location_id': self.location_src_id.id, |
|||
'location_dest_id': destination.id, |
|||
'product_uom': line.uom_id.id, |
|||
'state': 'draft', |
|||
'product_uom_category_id': line.uom_id.category_id, |
|||
'quantity': self.product_qty, |
|||
'picked': True |
|||
})) |
|||
self.stock_line_ids = val |
|||
self.line_ids = vals |
|||
if self.bom_id: |
|||
self.uom_id.category_id = self.uom_categ_id.id |
|||
|
|||
def action_confirm(self): |
|||
"""Method action_confirm to confirm the mrp order""" |
|||
for line in self.stock_line_ids: |
|||
if line.product_qty > line.product_id.qty_available : |
|||
raise ValidationError('Only %s quantity available for %s' % |
|||
(str(line.product_id.qty_available), |
|||
str(line.product_id.name))) |
|||
self.write({ |
|||
'state': 'confirmed', |
|||
}) |
|||
|
|||
def action_done(self): |
|||
"""Method action_done to make the mrp order done""" |
|||
self.write({ |
|||
'state': 'done' |
|||
}) |
|||
for move in self.stock_line_ids: |
|||
move._action_confirm() |
|||
move._action_assign() |
|||
move.move_line_ids.write({'quantity': move.product_uom_qty}) |
|||
move.picked = True |
|||
move._action_done() |
|||
source = self.env.ref('simple_mrp_order.location_simple_mrp') |
|||
move_id = self.env['stock.move'].create({ |
|||
'product_id': self.product_id.id, |
|||
'product_uom_qty': self.product_qty, |
|||
'name': self.product_id.name, |
|||
'company_id': self.company_id.id, |
|||
'location_id': source.id, |
|||
'location_dest_id': self.location_src_id.id, |
|||
'product_uom': self.uom_id.id, |
|||
'state': 'draft', |
|||
'product_uom_category_id': self.uom_id.category_id, |
|||
'origin': self.name, |
|||
'quantity': self.product_qty, |
|||
'picked': True |
|||
}) |
|||
move_id._action_confirm() |
|||
move_id._action_assign() |
|||
move_id.move_line_ids.write({'quantity': move_id.product_uom_qty}) |
|||
move_id._action_done() |
|||
self.stock_move_id = move_id |
|||
|
|||
def action_cancel(self): |
|||
"""Method action_cancel to cancel the mrp order""" |
|||
self.write({ |
|||
'state': 'cancel' |
|||
}) |
|||
|
|||
def action_view_move(self): |
|||
"""Method action_view_move to view the stock moves from the smart |
|||
button""" |
|||
ids = [stock.id for stock in self.stock_line_ids] |
|||
ids.append(self.stock_move_id.id) |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'stock.move', |
|||
'domain': [('id', 'in', ids)], |
|||
'name': _("Product Stock Move"), |
|||
'target': 'current', |
|||
'view_mode': 'tree', |
|||
} |
|||
|
|||
|
|||
class StockMove(models.Model): |
|||
"""Inherits the already existing model stock.move to add mrp_id field to the |
|||
model for the working of this module""" |
|||
_inherit = 'stock.move' |
|||
|
|||
mrp_id = fields.Many2one('mrp.order', string="MRP Order", |
|||
help="MRP Order related to the stock move") |
@ -0,0 +1,41 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Mruthul Raj(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import fields, models |
|||
|
|||
|
|||
class MRPOrderLine(models.Model): |
|||
"""Creates the model mrp.order.line """ |
|||
_name = 'mrp.order.line' |
|||
_description = "Bills of Materials Components" |
|||
_inherit = ["mail.thread", "mail.activity.mixin"] |
|||
|
|||
product_id = fields.Many2one('product.product', string="Product", |
|||
help="Component Product", |
|||
required=True) |
|||
product_qty = fields.Float(string="Quantity", default=1.0, tracking=True, |
|||
help="Quantity of products to be consumed") |
|||
uom_id = fields.Many2one('uom.uom', string='Product Unit of Measure', |
|||
required=True, |
|||
help="Unit of Measure of the product to be " |
|||
"consumed") |
|||
mrp_id = fields.Many2one('mrp.order', string='MRP Order', |
|||
help="MRP Order of the product") |
@ -0,0 +1,50 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Mruthul Raj(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class SimpleMRPBom(models.Model): |
|||
"""Creates the model simple.mrp.bom""" |
|||
_name = 'simple.mrp.bom' |
|||
_description = "Bills of Materials" |
|||
_inherit = ["mail.thread", "mail.activity.mixin"] |
|||
_rec_name = 'product_id' |
|||
|
|||
product_id = fields.Many2one('product.product', string="Product", |
|||
required=True, help="Name of the product") |
|||
product_qty = fields.Float(string="Quantity", default=1.0, tracking=True, |
|||
help="Quantity of products") |
|||
uom_id = fields.Many2one('uom.uom', string='Product Unit of Measure', |
|||
required=True, |
|||
help="Unit of measurement for product") |
|||
company_id = fields.Many2one('res.company', string='Company', |
|||
default=lambda self: self.env.company, |
|||
index=True, required=True, |
|||
help="Company corresponding to the product") |
|||
line_ids = fields.One2many('simple.mrp.bom.line', 'bom_id', |
|||
string="Components", |
|||
help="Components used to create the product") |
|||
|
|||
@api.onchange('product_id') |
|||
def onchange_product_id(self): |
|||
""" Update the Uom for the product """ |
|||
self.uom_id = self.product_id.uom_id.id |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Mruthul Raj(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from odoo import api, models, fields |
|||
|
|||
|
|||
class SimpleMRPBomLine(models.Model): |
|||
"""Creates the model simple.mrp.bom line""" |
|||
_name = 'simple.mrp.bom.line' |
|||
_description = "Bills of Materials Components" |
|||
_inherit = ["mail.thread", "mail.activity.mixin"] |
|||
|
|||
product_id = fields.Many2one('product.product', string="Product", |
|||
required=True, help="Product Name") |
|||
product_qty = fields.Float(string="Quantity", default=1.0, tracking=True, |
|||
help="Quantity of products") |
|||
uom_id = fields.Many2one('uom.uom', string='Product Unit of Measure', |
|||
required=True, |
|||
help="Unit of measure of the product") |
|||
bom_id = fields.Many2one('simple.mrp.bom', string="Bill of Material", |
|||
help="Corresponding Bill of Material") |
|||
|
|||
@api.onchange('product_id') |
|||
def onchange_product_id(self): |
|||
""" Update the Uom for the product """ |
|||
self.uom_id = self.product_id.uom_id.id |
|
@ -0,0 +1,34 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!--User group category of the module simple manufacturing--> |
|||
<record id="simple_mrp_order_category" |
|||
model="ir.module.category"> |
|||
<field name="name">Simple Manufacturing</field> |
|||
<field name="sequence" eval="5"/> |
|||
</record> |
|||
<!--Manager user group--> |
|||
<record id="simple_mrp_order_group_manager" model="res.groups"> |
|||
<field name="name">Administrator</field> |
|||
<field name="category_id" ref="simple_mrp_order_category"/> |
|||
</record> |
|||
<!-- MRP Orders Multi Company rule --> |
|||
<record id="mrp_order_rule_multi_company" model="ir.rule"> |
|||
<field name="name">MRP Order multi company rule</field> |
|||
<field name="model_id" ref="simple_mrp_order.model_mrp_order"/> |
|||
<field name="global" eval="True"/> |
|||
<field name="domain_force"> |
|||
['|',('company_id','=',False),('company_id', |
|||
'in', company_ids)] |
|||
</field> |
|||
</record> |
|||
<!-- Simple Bill of Material Multi Company rule --> |
|||
<record id="simple_mrp_bom_rule_multi_company" model="ir.rule"> |
|||
<field name="name">Simple MRP BOM multi company rule</field> |
|||
<field name="model_id" ref="simple_mrp_order.model_simple_mrp_bom"/> |
|||
<field name="global" eval="True"/> |
|||
<field name="domain_force"> |
|||
['|',('company_id','=',False),('company_id', |
|||
'in', company_ids)] |
|||
</field> |
|||
</record> |
|||
</odoo> |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 79 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,113 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!-- View for the Manufacturing Order form --> |
|||
<record id="mrp_order_view_form" model="ir.ui.view"> |
|||
<field name="name">mrp.order.view.form</field> |
|||
<field name="model">mrp.order</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Manufacturing Order"> |
|||
<header> |
|||
<button string="Confirm" invisible="state not in ('draft')" |
|||
class="oe_highlight" |
|||
name="action_confirm" type="object"/> |
|||
<button string="Done" invisible="state not in ('confirmed')" |
|||
class="oe_highlight" |
|||
name="action_done" type="object"/> |
|||
<button string="Cancel" |
|||
invisible="state not in ('confirmed')" |
|||
name="action_cancel" type="object"/> |
|||
<field name="state" widget="statusbar" |
|||
statusbar_visible="draft,confirmed,done"/> |
|||
</header> |
|||
<sheet> |
|||
<div class="oe_button_box" name="button_box"> |
|||
<button name="action_view_move" |
|||
type="object" |
|||
class="oe_stat_button" |
|||
invisible="stock_move_id == 'false'" |
|||
icon="fa-stock icon"> |
|||
<div class="o_field_widget o_stat_info"> |
|||
<span class="o_stat_text">Product</span> |
|||
<span class="o_stat_text">Move</span> |
|||
</div> |
|||
</button> |
|||
</div> |
|||
<group> |
|||
<group> |
|||
<field name="product_id" |
|||
readonly="state not in ('draft')"/> |
|||
<label for="product_qty"/> |
|||
<div class="o_row no-gutters d-flex"> |
|||
<field name="product_qty" class="oe_inline" |
|||
readonly="state not in ('draft')"/> |
|||
<field name="uom_categ_id" invisible="1"/> |
|||
<field name="stock_move_id" invisible="1"/> |
|||
<field name="uom_id" |
|||
readonly="state not in ('draft')"/> |
|||
<span class='text-bf'>To Produce</span> |
|||
</div> |
|||
</group> |
|||
<group> |
|||
<field name="company_id" |
|||
readonly="state not in ('draft')"/> |
|||
</group> |
|||
</group> |
|||
<group> |
|||
<group> |
|||
<field name="bom_id" |
|||
readonly="state not in ('draft')"/> |
|||
</group> |
|||
</group> |
|||
<notebook> |
|||
<page string="Components"> |
|||
<field name="stock_line_ids" readonly="1" |
|||
force_save="1" style="pointer-events:none;"> |
|||
<list editable="bottom"> |
|||
<field name="product_id"/> |
|||
<field name="product_uom_qty" |
|||
string="Quantity"/> |
|||
<field name="product_uom"/> |
|||
</list> |
|||
</field> |
|||
</page> |
|||
</notebook> |
|||
</sheet> |
|||
<chatter/> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<!--list view of the model mrp.order--> |
|||
<record id="mrp_order_view_list" model="ir.ui.view"> |
|||
<field name="name">mrp.order.view.list</field> |
|||
<field name="model">mrp.order</field> |
|||
<field name="arch" type="xml"> |
|||
<list> |
|||
<field name="product_id"/> |
|||
<field name="name"/> |
|||
<field name="product_qty"/> |
|||
<field name="state" widget="badge"/> |
|||
</list> |
|||
</field> |
|||
</record> |
|||
<!--Windows action for the model mrp.order--> |
|||
<record id="mrp_order_action" model="ir.actions.act_window"> |
|||
<field name="name">Manufacturing Orders</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">mrp.order</field> |
|||
<field name="view_mode">list,form</field> |
|||
<field name="help" type="html"> |
|||
<p class="o_view_nocontent_smiling_face"> |
|||
Create a new Manufacturing Order |
|||
</p> |
|||
</field> |
|||
</record> |
|||
<!--Root menu for the module--> |
|||
<menuitem id="mrp_order_menu_root" |
|||
groups="simple_mrp_order.simple_mrp_order_group_manager" |
|||
web_icon="simple_mrp_order,static/description/icon.png" |
|||
name="Simple Manufacturing"/> |
|||
<!--Menu to show the manufacturing orders--> |
|||
<menuitem id="menu_mrp_order" name="Manufacturing Orders" sequence="10" |
|||
parent="mrp_order_menu_root" |
|||
action="mrp_order_action"/> |
|||
</odoo> |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!--Windows action for the model product.product for the model --> |
|||
<record id="product_product_action_simple_mrp_order" |
|||
model="ir.actions.act_window"> |
|||
<field name="name">Product Variants</field> |
|||
<field name="res_model">product.product</field> |
|||
<field name="view_mode">list,form,kanban</field> |
|||
<field name="context">{"search_default_consumable": 1} |
|||
</field> |
|||
<field name="help" type="html"> |
|||
<p class="o_view_nocontent_smiling_face"> |
|||
No product found. Let's create one! |
|||
</p> |
|||
<p> |
|||
Define the components and finished products you wish to use in |
|||
bill of materials and manufacturing orders. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
<!--Menu to show the product variants in the module simple manufacturing order--> |
|||
<menuitem id="menu_simple_mrp_product_variants_form" |
|||
name="Product Variants" |
|||
action="product_product_action_simple_mrp_order" |
|||
parent="menu_mrp_products" sequence="2"/> |
|||
</odoo> |
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!--Windows action for the model product template in the module simple mrp order--> |
|||
<record id="product_template_action_simple_mrp_order" |
|||
model="ir.actions.act_window"> |
|||
<field name="name">Products</field> |
|||
<field name="res_model">product.template</field> |
|||
<field name="view_mode">kanban,list,form</field> |
|||
<field name="context">{"search_default_consumable": 1} |
|||
</field> |
|||
<field name="help" type="html"> |
|||
<p class="o_view_nocontent_smiling_face"> |
|||
No product found. Let's create one! |
|||
</p> |
|||
<p> |
|||
Define the components and finished products you wish to use in |
|||
bill of materials and manufacturing orders. |
|||
</p> |
|||
</field> |
|||
</record> |
|||
<!--Menu to show the products in the module--> |
|||
<menuitem id="menu_simple_mrp_product_form" |
|||
name="Products" |
|||
action="product_template_action_simple_mrp_order" |
|||
parent="menu_mrp_products" sequence="1"/> |
|||
</odoo> |
@ -0,0 +1,59 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!--Form view of the model simple mrp bom--> |
|||
<record id="simple_mrp_bom_view_form" model="ir.ui.view"> |
|||
<field name="name">simple.mrp.bom.view.form</field> |
|||
<field name="model">simple.mrp.bom</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Bills of Materials"> |
|||
<sheet> |
|||
<group> |
|||
<group> |
|||
<field name="product_id" widget="mui"/> |
|||
<label for="product_qty"/> |
|||
<div class="o_row no-gutters d-flex"> |
|||
<field name="product_qty" class="oe_inline"/> |
|||
<field name="uom_id"/> |
|||
</div> |
|||
</group> |
|||
<group> |
|||
<field name="company_id"/> |
|||
</group> |
|||
</group> |
|||
<notebook> |
|||
<page name="bom_line_ids" string="Components"> |
|||
<field name="line_ids"> |
|||
<list editable="bottom"> |
|||
<field name="product_id"/> |
|||
<field name="product_qty"/> |
|||
<field name="uom_id"/> |
|||
</list> |
|||
</field> |
|||
</page> |
|||
</notebook> |
|||
</sheet> |
|||
<chatter/> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<!--Windows action of the model simple mrp bom--> |
|||
<record id="simple_mrp_bom_action" model="ir.actions.act_window"> |
|||
<field name="name">Bills of Materials</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">simple.mrp.bom</field> |
|||
<field name="view_mode">list,form</field> |
|||
<field name="help" type="html"> |
|||
<p class="o_view_nocontent_smiling_face"> |
|||
Create a new Bills of Materials |
|||
</p> |
|||
</field> |
|||
</record> |
|||
<!--Root menu to show the products and Bill of materials--> |
|||
<menuitem id="menu_mrp_products" |
|||
parent="mrp_order_menu_root" name="Products" |
|||
sequence="20"/> |
|||
<!--Menu to show the bill of materials--> |
|||
<menuitem id="menu_mrp_bom" name="Bills of Materials" sequence="30" |
|||
parent="menu_mrp_products" |
|||
action="simple_mrp_bom_action"/> |
|||
</odoo> |