diff --git a/pos_mrp_order/README.rst b/pos_mrp_order/README.rst new file mode 100644 index 000000000..c2ee9f92d --- /dev/null +++ b/pos_mrp_order/README.rst @@ -0,0 +1,14 @@ +Make MRP orders from POS v12 +============================ +From the POS sale we need to generate MRP orders in the back end with out close the current window. + +Features +======== + +* Automatically create MRP order form POS sale. +* We can assign which products make MRP order Automatically. + +Credits +======= +V10 Nikhil Krishnan @ cybrosys, odoo@cybrosys.com +V12 Akshay Babu diff --git a/pos_mrp_order/__init__.py b/pos_mrp_order/__init__.py new file mode 100644 index 000000000..934aa716d --- /dev/null +++ b/pos_mrp_order/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nikhil krishnan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from . import models diff --git a/pos_mrp_order/__manifest__.py b/pos_mrp_order/__manifest__.py new file mode 100644 index 000000000..8474bff0d --- /dev/null +++ b/pos_mrp_order/__manifest__.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nikhil krishnan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +{ + 'name': 'Make MRP orders from POS', + 'version': '12.0.2.0.0', + 'summary': """Launch Automatic MRP Orders After Selling Through POS.""", + 'description': """Launch automatic MRP orders after selling through POS""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'http://www.cybrosys.com', + 'category': 'Point of Sale', + 'depends': ['point_of_sale', 'mrp', 'stock'], + 'license': 'LGPL-3', + 'data': [ + 'security/ir.model.access.csv', + 'views/product_view.xml', + 'views/pos_template.xml', + ], + 'images': ['static/description/banner.jpg'], + 'installable': True, + 'auto_install': False, +} diff --git a/pos_mrp_order/models/__init__.py b/pos_mrp_order/models/__init__.py new file mode 100644 index 000000000..2bb8f9152 --- /dev/null +++ b/pos_mrp_order/models/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nikhil krishnan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from . import point_of_sale_make_mrp + diff --git a/pos_mrp_order/models/point_of_sale_make_mrp.py b/pos_mrp_order/models/point_of_sale_make_mrp.py new file mode 100644 index 000000000..60c11125c --- /dev/null +++ b/pos_mrp_order/models/point_of_sale_make_mrp.py @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- + +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# Copyright (C) 2017-TODAY Cybrosys Technologies(). +# Author: Nikhil krishnan() +# you can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. +# +# It is forbidden to publish, distribute, sublicense, or sell copies +# of the Software or modified copies of the Software. +# +# 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 +# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. +# If not, see . +# +############################################################################## + +from odoo import models, fields, api +from odoo.exceptions import Warning + + +class MrpProduction(models.Model): + _inherit = 'mrp.production' + + @api.multi + def create_mrp_from_pos(self, products): + product_ids = [] + if products: + for product in products: + flag = 1 + if product_ids: + for product_id in product_ids: + if product_id['id'] == product['id']: + product_id['qty'] += product['qty'] + flag = 0 + if flag: + product_ids.append(product) + for prod in product_ids: + if prod['qty'] > 0: + product = self.env['product.product'].search([('id', '=', prod['id'])]) + bom_count = self.env['mrp.bom'].search([('product_tmpl_id', '=', prod['product_tmpl_id'])]) + if bom_count: + bom_temp = self.env['mrp.bom'].search([('product_tmpl_id', '=', prod['product_tmpl_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_tmpl_id': prod['product_tmpl_id'], + 'product_uom_id': prod['uom_id'], + 'product_qty': prod['qty'], + 'bom_id': bom.id, + } + self.sudo().create(vals) + return True + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + to_make_mrp = fields.Boolean(string='To Create MRP Order', + help="Check if the product should be make mrp order") + + @api.onchange('to_make_mrp') + def onchange_to_make_mrp(self): + if self.to_make_mrp: + if not self.bom_count: + raise Warning('Please set Bill of Material for this product.') + + +class ProductProduct(models.Model): + _inherit = 'product.product' + + @api.onchange('to_make_mrp') + def onchange_to_make_mrp(self): + if self.to_make_mrp: + if not self.bom_count: + raise Warning('Please set Bill of Material for this product.') diff --git a/pos_mrp_order/security/ir.model.access.csv b/pos_mrp_order/security/ir.model.access.csv new file mode 100644 index 000000000..db938e13a --- /dev/null +++ b/pos_mrp_order/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mrp_production_pos_user,mrp.production.pos.user,mrp.model_mrp_production,point_of_sale.group_pos_user,1,1,1,0 +access_mrp_bom_pos_user,mrp.bom.pos.user,mrp.model_mrp_bom,point_of_sale.group_pos_user,1,0,0,0 \ No newline at end of file diff --git a/pos_mrp_order/static/description/banner.jpg b/pos_mrp_order/static/description/banner.jpg new file mode 100644 index 000000000..e31ee4ebe Binary files /dev/null and b/pos_mrp_order/static/description/banner.jpg differ diff --git a/pos_mrp_order/static/description/cybro_logo.png b/pos_mrp_order/static/description/cybro_logo.png new file mode 100644 index 000000000..bb309114c Binary files /dev/null and b/pos_mrp_order/static/description/cybro_logo.png differ diff --git a/pos_mrp_order/static/description/icon.png b/pos_mrp_order/static/description/icon.png new file mode 100644 index 000000000..ea63a87f1 Binary files /dev/null and b/pos_mrp_order/static/description/icon.png differ diff --git a/pos_mrp_order/static/description/index.html b/pos_mrp_order/static/description/index.html new file mode 100644 index 000000000..fb42048b0 --- /dev/null +++ b/pos_mrp_order/static/description/index.html @@ -0,0 +1,379 @@ + +
+
+

+ Make MRP orders from POS +

+

+ Launch automatic MRP orders after selling through POS. +

+
+ Cybrosys Technologies +
+ +
+ cybrosys technologies +
+
+
+
+ +
+
+

+ Overview +

+

+ The module automatically launches MRP orders from point of sale +

+
+
+ +
+
+

+ Features +

+

+ + Automatically create MRP order form POS sale +

+

+ + We have to assign the products for which MRP order gets created Automatically. +

+

+ + Identify the MRP orders easily generated from POS. +

+
+
+ +
+
+

+ Screenshots +

+

+ + How enable MRP order creation from POS +

+
+ +
+

+ + There is a heading 'Point of Sale' under sales tab in the product form. Enable 'To create MRP order' and make sure that this product has a bill of material, else system will generate a warning. + If you forget to set the BOM, then MRP order does not get created. +

+
+ +
+

+ + + Every product needs minimum one BoM, then only MRP order gets created at the time of POS sale.
+ + If you do not enable the Product Variants, then you can set a BoM with a product and its components.
+ + If you enable the Product Variants (Products can have several attributes, defining variants (Example: size, color...)) then the BoM form will contain extra field Product Variant.
+
    + +
  • If you set a BoM for a product template, then you will be able to get that BoM for all the variants.
  • + +
  • If you set a BoM for a particular Product variants, then that BoM is counted only for that variant.
  • + +
  • So other variants’ BoM is counted as zero. MRP Order is created only when the BoM is available.
  • +
+

+
+ +
+

+ + Point Of Sale +
    +
  • Select the products for sale.
  • +
  • Make the payments and validate it.
  • +
  • Check Manufacturing orders
  • +
+

+
+ +
+

+ + From the "Source", we can easily find out the MRP orders that is created by POS. +

+
+ +
+ +
+
+ +
+
+ cybrosys technologies +
+
+
+
+

+ Our Services +

+
+ + + +
+ +
+ + + +
+

+ + Odoo Support +

+ +
+ +
+
+
+
+
+

+ Our Industries +

+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Trading + +

+

+ Easily procure and sell your products. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Manufacturing +

+

+ Plan, track and schedule your operations. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Restaurant +

+

+ Run your bar or restaurant methodical. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + POS +

+

+ Easy configuring and convivial selling. +

+
+ +
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + E-commerce & Website +

+

+ Mobile friendly, awe-inspiring product pages. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Hotel Management +

+

+ An all-inclusive hotel management application. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Education +

+

+ A Collaborative platform for educational management. +

+
+
+
+ +
+
+ + Odoo Industry + +
+
+
+

+ + Service Management +

+

+ Keep track of services and invoice accordingly. +

+
+
+
+
+
+
+ +
diff --git a/pos_mrp_order/static/description/pos-mrp-order-cybrosys-1.jpg b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-1.jpg new file mode 100644 index 000000000..42c8178fc Binary files /dev/null and b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-1.jpg differ diff --git a/pos_mrp_order/static/description/pos-mrp-order-cybrosys-2.jpg b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-2.jpg new file mode 100644 index 000000000..0c547d17d Binary files /dev/null and b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-2.jpg differ diff --git a/pos_mrp_order/static/description/pos-mrp-order-cybrosys-3.jpg b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-3.jpg new file mode 100644 index 000000000..5b50cb126 Binary files /dev/null and b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-3.jpg differ diff --git a/pos_mrp_order/static/description/pos-mrp-order-cybrosys-4.jpg b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-4.jpg new file mode 100644 index 000000000..2388ffef8 Binary files /dev/null and b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-4.jpg differ diff --git a/pos_mrp_order/static/description/pos-mrp-order-cybrosys-5.jpg b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-5.jpg new file mode 100644 index 000000000..0eee9189f Binary files /dev/null and b/pos_mrp_order/static/description/pos-mrp-order-cybrosys-5.jpg differ diff --git a/pos_mrp_order/static/src/js/models.js b/pos_mrp_order/static/src/js/models.js new file mode 100644 index 000000000..aa59f06ca --- /dev/null +++ b/pos_mrp_order/static/src/js/models.js @@ -0,0 +1,55 @@ +odoo.define('pos_mrp_order.models_mrp_order', function (require) { +"use strict"; +var pos_model = require('point_of_sale.models'); +var pos_screens = require('point_of_sale.screens'); +var models = pos_model.PosModel.prototype.models; +var rpc = require('web.rpc'); + + +for(var i=0; i0) + { + var product_dict = { + 'id': order_line[i].product.id, + 'qty': order_line[i].quantity, + 'product_tmpl_id': order_line[i].product.product_tmpl_id, + 'pos_reference': order.name, + 'uom_id': order_line[i].product.uom_id[0], + }; + list_product.push(product_dict); + } + + } + + if (list_product.length) + { + rpc.query({ + model: 'mrp.production', + method: 'create_mrp_from_pos', + args: [1,list_product], + }); + } + } + + }, + + }); +}); diff --git a/pos_mrp_order/views/pos_template.xml b/pos_mrp_order/views/pos_template.xml new file mode 100644 index 000000000..e228cf0a6 --- /dev/null +++ b/pos_mrp_order/views/pos_template.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/pos_mrp_order/views/product_view.xml b/pos_mrp_order/views/product_view.xml new file mode 100644 index 000000000..d57f7d45d --- /dev/null +++ b/pos_mrp_order/views/product_view.xml @@ -0,0 +1,13 @@ + + + + product.template.form.inherit + product.template + + + + + + + +