@ -0,0 +1,13 @@ |
|||
Make MRP orders from POS v10 |
|||
============================ |
|||
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 |
|||
======= |
|||
Nikhil Krishnan @ cybrosys, nikhil@cybrosys.in |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<https://www.cybrosys.com>) |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import models |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<https://www.cybrosys.com>) |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
{ |
|||
'name': 'Make MRP orders from POS', |
|||
'version': '10.0.1.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': 'Sales Management', |
|||
'depends': ['point_of_sale', 'mrp', 'stock'], |
|||
'license': 'LGPL-3', |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/product_view.xml', |
|||
'views/pos_template.xml', |
|||
], |
|||
'demo': [], |
|||
'images': ['static/description/banner.jpg'], |
|||
'installable': True, |
|||
'auto_install': False, |
|||
} |
@ -0,0 +1,26 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<https://www.cybrosys.com>) |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import point_of_sale_make_mrp |
|||
|
@ -0,0 +1,85 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<https://www.cybrosys.com>) |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
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 = [] |
|||
print "products", products |
|||
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 = [] |
|||
print "This product variants have no exact 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_temp: |
|||
raise Warning('Please set Bill of Material for this product.') |
|
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 49 KiB |
After Width: | Height: | Size: 201 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,151 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h2 class="oe_slogan">Make MRP orders from POS</h2> |
|||
<h3 class="oe_slogan">Launch automatic MRP orders after selling through POS.</h3> |
|||
<h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4> |
|||
<div> |
|||
<h4><p>Features:</p></h4> |
|||
<ul> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> Automatically create MRP order form POS sale.</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> We have to assign the products for which MRP order gets created Automatically.</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ☑</span> Identify the MRP orders easily generated from POS.</li> |
|||
</ul> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">How enable MRP order creation from POS</h3> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="Product form.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
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. |
|||
</p> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="warning.png"> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">What are the points to be noted when set the BoM</h3> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="BoM.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
Every product needs minimum one BoM, then only MRP order gets created at the time of POS sale. </p> |
|||
<p class="oe_mt32"> |
|||
If you do not enable the Product Variants, then you can set a BoM with a product and its components. |
|||
</p> |
|||
<p class="oe_mt32"> |
|||
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. |
|||
</p> |
|||
<p class="oe_mt32"> |
|||
<ul> |
|||
<li>If you set a BoM for a product template, then you will be able to get that BoM for all |
|||
the variants.</li> |
|||
</ul> |
|||
<ul> |
|||
<li>If you set a BoM for a particular Product variants, then that BoM is counted only for |
|||
that variant.</li> |
|||
</ul> |
|||
<ul> |
|||
<li>So other variants’ BoM is counted as zero. MRP Order is created only when the BoM |
|||
is available.</li> |
|||
</ul> |
|||
</p> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">Point Of Sale</h3> |
|||
<div class="oe_row oe_spaced"> |
|||
<p> |
|||
<ul> |
|||
<li>Select the products for sale.</li> |
|||
</ul> |
|||
<ul> |
|||
<li>Make the payments and validate it.</li> |
|||
</ul> |
|||
<ul> |
|||
<li>Check Manufacturing orders</li> |
|||
</ul> |
|||
</p> |
|||
</div> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="POS view.png"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<h3 class="oe_slogan">Manufacturing Order</h3> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<div class="oe_row_img oe_centered"> |
|||
<img class="oe_picture oe_screenshot" src="MRP order.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
From the "Source", we can easily find out the MRP orders that is created by POS. |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
|||
<div class="oe_slogan" style="margin-top:10px !important;"> |
|||
<div> |
|||
<a class="btn btn-primary btn-lg mt8" |
|||
style="color: #FFFFFF !important;border-radius: 0;" href="http://www.cybrosys.com"><i |
|||
class="fa fa-envelope"></i> Email </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="http://www.cybrosys.com/contact/"><i |
|||
class="fa fa-phone"></i> Contact Us </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i |
|||
class="fa fa-check-square"></i> Request Customization </a> |
|||
</div> |
|||
<br> |
|||
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
|||
<div> |
|||
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
|||
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
|||
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
|||
</div> |
|||
</div> |
|||
</section> |
After Width: | Height: | Size: 68 KiB |
@ -0,0 +1,53 @@ |
|||
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 Model = require('web.DataModel'); |
|||
|
|||
|
|||
for(var i=0; i<models.length; i++){ |
|||
var model=models[i]; |
|||
if(model.model === 'product.product'){ |
|||
model.fields.push('to_make_mrp'); |
|||
} |
|||
} |
|||
pos_screens.PaymentScreenWidget.include({ |
|||
validate_order: function(force_validation) { |
|||
var self = this |
|||
this._super(force_validation); |
|||
var order = self.pos.get_order(); |
|||
var order_line = order.orderlines.models; |
|||
var list_product = [] |
|||
var due = order.get_due(); |
|||
if (due == 0) |
|||
{ |
|||
for (var i in order_line) |
|||
{ |
|||
if (order_line[i].product.to_make_mrp) |
|||
{ |
|||
if (order_line[i].quantity>0) |
|||
{ |
|||
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) |
|||
{ |
|||
new Model("mrp.production") |
|||
.call("create_mrp_from_pos", [1, list_product]) |
|||
} |
|||
} |
|||
|
|||
}, |
|||
|
|||
}); |
|||
}); |
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<template id="assets_mrp" inherit_id="point_of_sale.assets"> |
|||
<xpath expr="." position="inside"> |
|||
<script type="text/javascript" src="/pos_mrp_order/static/src/js/models.js"></script> |
|||
</xpath> |
|||
</template> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record id="product_template_form_view_make_mrp" model="ir.ui.view"> |
|||
<field name="name">product.template.form.inherit</field> |
|||
<field name="model">product.template</field> |
|||
<field name="inherit_id" ref="point_of_sale.product_template_form_view"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='to_weight']" position="after"> |
|||
<field name="to_make_mrp" attrs="{'invisible': [('available_in_pos', '=', False)]}"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |