@ -0,0 +1,54 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Make MRP Orders from POS |
||||
|
======================== |
||||
|
This module enables to create automatic MRP orders after selling through POS. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed. |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Affero General Public License, Version 3 (AGPL v3) |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers : (V10) Nikhil Krishnan, |
||||
|
(V12) Akshay Babu, |
||||
|
(V13) Vaishnavi B, |
||||
|
(V14) Sagarika B, |
||||
|
(V15) Sagarika B, |
||||
|
(V16) Athira Premanand, |
||||
|
(V17) Aysha Shalin, |
||||
|
(V18) Gayathri V, |
||||
|
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 `Our Website <https://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: Gayathri V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# you can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from . import models |
@ -0,0 +1,48 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Gayathri V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# you can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
{ |
||||
|
'name': 'Make MRP Orders from POS', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Point of Sale', |
||||
|
'summary': """Generate Automatic MRP orders from POS.""", |
||||
|
'description': """This module enables to create automatic MRP orders after |
||||
|
selling through POS.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['point_of_sale', 'mrp', 'stock'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/product_template_views.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'point_of_sale._assets_pos': [ |
||||
|
'pos_mrp_order/static/src/overrides/components/payment_screen/payment_screen.js', |
||||
|
], |
||||
|
}, |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <pos_mrp_order> |
||||
|
|
||||
|
#### 29.10.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for Make MRP Orders from POS |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Gayathri V (odoo@cybrosys.com) |
||||
|
# you can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from . import mrp_production |
||||
|
from . import product_template |
||||
|
from . import product_product |
@ -0,0 +1,106 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com> |
||||
|
# Author: Gayathri V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# you can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
|
class MrpProduction(models.Model): |
||||
|
""" Extends MRP Production model for creating manufacturing orders from POS |
||||
|
orders.""" |
||||
|
_inherit = 'mrp.production' |
||||
|
|
||||
|
def create_mrp_from_pos(self, products): |
||||
|
""" Function for creating manufacturing orders.""" |
||||
|
product_ids = [] |
||||
|
if products: |
||||
|
for product in products: |
||||
|
if self.env['product.product'].browse( |
||||
|
int(product['id'])).to_make_mrp: |
||||
|
flag = 1 |
||||
|
if product_ids: |
||||
|
for product_id in product_ids: |
||||
|
if product_id['id'] == product['id']: |
||||
|
product_id['qty'] += product['qty'] |
||||
|
product_id |
||||
|
flag = 0 |
||||
|
if flag: |
||||
|
product_ids.append(product) |
||||
|
for prod in product_ids: |
||||
|
if prod['qty'] > 0: |
||||
|
bom_count = self.env['mrp.bom'].search([ |
||||
|
('product_id', '=', prod['id'])]) |
||||
|
if bom_count: |
||||
|
bom_temp = self.env['mrp.bom'].search([ |
||||
|
('product_id', '=', prod['id']), |
||||
|
('product_id', '=', False)]) |
||||
|
bom_prod = self.env['mrp.bom'].search([ |
||||
|
('product_id', '=', prod['id'])]) |
||||
|
if bom_prod: |
||||
|
bom = bom_prod[0] |
||||
|
elif bom_temp: |
||||
|
bom = bom_temp[0] |
||||
|
else: |
||||
|
bom = [] |
||||
|
if bom: |
||||
|
vals = { |
||||
|
'origin': 'POS-' + prod['pos_reference'], |
||||
|
'state': 'confirmed', |
||||
|
'product_id': prod['id'], |
||||
|
'product_uom_id': prod['uom_id'], |
||||
|
'product_qty': prod['qty'], |
||||
|
'bom_id': bom.id, |
||||
|
} |
||||
|
mrp_order = self.sudo().create(vals) |
||||
|
list_value = [] |
||||
|
for bom_line in mrp_order.bom_id.bom_line_ids: |
||||
|
list_value.append((0, 0, { |
||||
|
'raw_material_production_id': mrp_order.id, |
||||
|
'name': mrp_order.name, |
||||
|
'product_id': bom_line.product_id.id, |
||||
|
'product_uom': bom_line.product_uom_id.id, |
||||
|
'product_uom_qty': (bom_line.product_qty * mrp_order.product_qty)/self.env['mrp.bom'].search([("product_id", "=", prod['id'])]).product_qty, |
||||
|
'picking_type_id': mrp_order.picking_type_id.id, |
||||
|
'location_id': mrp_order.location_src_id.id, |
||||
|
'location_dest_id': bom_line.product_id.with_company(self.company_id.id).property_stock_production.id, |
||||
|
'company_id': mrp_order.company_id.id, |
||||
|
})) |
||||
|
finished_vals = { |
||||
|
'product_id': prod['id'], |
||||
|
'product_uom_qty': prod['qty'], |
||||
|
'product_uom': prod['uom_id'], |
||||
|
'name': mrp_order.name, |
||||
|
'date_deadline': mrp_order.date_deadline, |
||||
|
'picking_type_id': mrp_order.picking_type_id.id, |
||||
|
'location_id': mrp_order.location_src_id.id, |
||||
|
'location_dest_id': mrp_order.location_dest_id.id, |
||||
|
'company_id': mrp_order.company_id.id, |
||||
|
'production_id': mrp_order.id, |
||||
|
'warehouse_id': mrp_order.location_dest_id.warehouse_id.id, |
||||
|
'origin': mrp_order.name, |
||||
|
'group_id': mrp_order.procurement_group_id.id, |
||||
|
'propagate_cancel': mrp_order.propagate_cancel, |
||||
|
} |
||||
|
mrp_order.update({ |
||||
|
'move_raw_ids': list_value, |
||||
|
'move_finished_ids': [ |
||||
|
(0, 0, finished_vals)] |
||||
|
}) |
||||
|
return True |
@ -0,0 +1,34 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Gayathri V (odoo@cybrosys.com) |
||||
|
# you can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import api, models, _ |
||||
|
|
||||
|
|
||||
|
class ProductProduct(models.Model): |
||||
|
""" Inheriting 'product.product' for adding custom functionality.""" |
||||
|
_inherit = 'product.product' |
||||
|
|
||||
|
@api.onchange('to_make_mrp') |
||||
|
def onchange_to_make_mrp(self): |
||||
|
""" Raise validation error if bom is not set in 'product.product'.""" |
||||
|
if self.to_make_mrp: |
||||
|
if not self.bom_count: |
||||
|
raise Warning( |
||||
|
_('Please set Bill of Material for this product.')) |
@ -0,0 +1,41 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com> |
||||
|
# Author: Gayathri V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# you can modify it under the terms of the GNU AFFERO |
||||
|
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
||||
|
# (AGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################## |
||||
|
from odoo import api, fields, models, _ |
||||
|
from odoo.exceptions import ValidationError |
||||
|
|
||||
|
|
||||
|
class ProductTemplate(models.Model): |
||||
|
""" Inheriting 'product.template' for adding custom field and functionality. |
||||
|
""" |
||||
|
_inherit = 'product.template' |
||||
|
|
||||
|
to_make_mrp = fields.Boolean( |
||||
|
string='To Create MRP Order', |
||||
|
help="Check if the product should make mrp order") |
||||
|
|
||||
|
@api.onchange('to_make_mrp') |
||||
|
def onchange_to_make_mrp(self): |
||||
|
""" Raise validation error if bom is not set in 'product.template'.""" |
||||
|
if self.to_make_mrp: |
||||
|
if not self.bom_count: |
||||
|
raise ValidationError(_( |
||||
|
'Please set Bill of Material for this product.')) |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 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: 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: 158 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.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: 11 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: 80 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 565 B |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 77 KiB |