14 changed files with 433 additions and 0 deletions
@ -0,0 +1,12 @@ |
|||||
|
POS Serial Number Validator v11 |
||||
|
=============================== |
||||
|
|
||||
|
Validate Serial number of a product by checking availability in stock |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
Cybrosys Techno Solutions |
||||
|
|
||||
|
Author |
||||
|
------ |
||||
|
* Akhilesh N S <akhilesh@cybrosys.in> |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Akhilesh N S(<http://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 . import models |
@ -0,0 +1,40 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Akhilesh N S(<http://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': 'POS Serial Number Validator', |
||||
|
'version': '11.0.1.0', |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'website': 'http://www.cybrosys.com', |
||||
|
'category': 'Point of Sale', |
||||
|
'summary': """Validate Serial number of a product by checking availability in stock""", |
||||
|
'description': """Validate Serial number of a product by checking availability in stock""", |
||||
|
'depends': ['point_of_sale'], |
||||
|
'data': [ |
||||
|
'static/src/xml/pos_templates.xml', |
||||
|
], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
} |
||||
|
|
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Akhilesh N S(<http://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 . import traceability_validation |
@ -0,0 +1,47 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# Copyright (C) 2018-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
||||
|
# Author: Akhilesh N S(<http://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, api |
||||
|
|
||||
|
|
||||
|
class ValidateLotNumber(models.Model): |
||||
|
_name = 'serial_no.validation' |
||||
|
|
||||
|
@api.model |
||||
|
def validate_lots(self, lots): |
||||
|
processed = [] |
||||
|
LotObj = self.env['stock.production.lot'] |
||||
|
for lot in lots: |
||||
|
lot_id = LotObj.search([('name', '=', lot)], limit=1) |
||||
|
try: |
||||
|
if lot_id.product_qty > 0 and lot not in processed: |
||||
|
processed.append(lot) |
||||
|
continue |
||||
|
else: |
||||
|
if lot in processed: |
||||
|
return ['duplicate', lot] |
||||
|
else: |
||||
|
return ['no_stock', lot] |
||||
|
except Exception: |
||||
|
return ['except', lot] |
||||
|
return True |
||||
|
|
After Width: | Height: | Size: 80 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,48 @@ |
|||||
|
<section class="oe_container oe_dark"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<h2 class="oe_slogan" style="color:#875A7B;">POS Serial Number Validator</h2> |
||||
|
<h3 class="oe_slogan">Validate the given Serial number of a product from stock</h3> |
||||
|
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a></h4> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<div class="oe_row oe_spaced"> |
||||
|
<div class="oe_span12"> |
||||
|
<h3 class="oe_slogan">Warnings</h3> |
||||
|
</div> |
||||
|
<img class="oe_picture oe_screenshot" src="invalid_serial_number.png"/> |
||||
|
<img class="oe_picture oe_screenshot" src="duplicate_entry.png"/> |
||||
|
<p class="oe_mt32" style="margin-left:48px;"> |
||||
|
Currently in Odoo, Serial number validation at POS not available. This module validates given serial number is available in stock and prevent duplicated entry for more than one quantity |
||||
|
</p> |
||||
|
</div> |
||||
|
</div> |
||||
|
</section> |
||||
|
|
||||
|
|
||||
|
<section class="oe_container"> |
||||
|
<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="https://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="https://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="https://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: 143 KiB |
@ -0,0 +1,73 @@ |
|||||
|
odoo.define('pos_traceability_validation.models', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var PosModel = require('point_of_sale.models'); |
||||
|
var PosPopups = require('point_of_sale.popups'); |
||||
|
var gui = require('point_of_sale.gui'); |
||||
|
var rpc = require('web.rpc'); |
||||
|
var PackLotLinePopupWidget = PosPopups.extend({ |
||||
|
template: 'PackLotLinePopupWidget', |
||||
|
|
||||
|
/*making sure we didn't used same key already in the order*/ |
||||
|
duplicate_lot_name: function(id, lot_name, lot_lines){ |
||||
|
for(var i=0; i< lot_lines.length; i++){ |
||||
|
if(lot_lines[i].attributes && |
||||
|
lot_lines[i].attributes.lot_name != null |
||||
|
&& lot_lines[i].attributes.lot_name == lot_name && |
||||
|
id != lot_lines[i].cid){ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
|
return false; |
||||
|
}, |
||||
|
|
||||
|
click_confirm: function(){ |
||||
|
var self = this; |
||||
|
var lot_names = []; |
||||
|
var lot_cid = {}; |
||||
|
var pack_lot_lines = this.options.pack_lot_lines; |
||||
|
|
||||
|
this.$('.packlot-line-input').each(function(index, el){ |
||||
|
var cid = $(el).attr('cid'), |
||||
|
lot_name = $(el).val(); |
||||
|
var pack_line = pack_lot_lines.get({cid: cid}); |
||||
|
pack_line.set_lot_name(lot_name); |
||||
|
lot_names.push(lot_name); |
||||
|
lot_cid[lot_name] = cid; |
||||
|
}); |
||||
|
|
||||
|
rpc.query({ |
||||
|
model: 'serial_no.validation', |
||||
|
method: 'validate_lots', |
||||
|
args: [lot_names] |
||||
|
}).done(function(result){ |
||||
|
if(result != true){ |
||||
|
var current_id = lot_cid[result[1]]; |
||||
|
var pack_line = pack_lot_lines.get({cid: current_id}); |
||||
|
pack_line.set_lot_name(null); |
||||
|
if(result[0] == 'no_stock'){ |
||||
|
alert("Insufficient stock for " + result[1]) |
||||
|
} |
||||
|
else if(result[0] == 'duplicate'){ |
||||
|
alert("Duplicate entry for " + result[1]) |
||||
|
} |
||||
|
else if(result[0] == 'except'){ |
||||
|
alert("Exception occured with " + result[1]) |
||||
|
} |
||||
|
} |
||||
|
else{ |
||||
|
pack_lot_lines.remove_empty_model(); |
||||
|
pack_lot_lines.set_quantity_by_lot(); |
||||
|
self.options.order.save_to_db(); |
||||
|
self.options.order_line.trigger( |
||||
|
'change', |
||||
|
self.options.order_line |
||||
|
); |
||||
|
self.gui.close_popup(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
gui.define_popup({name:'packlotline', widget: PackLotLinePopupWidget}); |
||||
|
|
||||
|
}); |
@ -0,0 +1,8 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<template id="pos_extend_assets" inherit_id="point_of_sale.assets"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<script type="text/javascript" src="/pos_invoice_lot_no/static/src/js/pos_models.js"/> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
</odoo> |
@ -0,0 +1,158 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<templates id="point_of_sale.template" xml:space="preserve"> |
||||
|
<t t-extend="Chrome"> |
||||
|
<t t-jquery='.pos-branding' t-operation='replace'> |
||||
|
<img src='/web/binary/company_logo' style="width: 3%;padding: 2px 8px 0px 13px;float: left;"/> |
||||
|
<span class="placeholder-UsernameWidget" style="float: left;padding-top: 19px;color: #fff;"></span> |
||||
|
</t> |
||||
|
</t> |
||||
|
|
||||
|
<t t-extend="PosTicket"> |
||||
|
<t t-jquery='.pos-sale-ticket' t-operation='replace'> |
||||
|
<div class="pos-sale-ticket"> |
||||
|
<div> |
||||
|
<div style="width: 55%; float: left; padding: 20px 0px;"> |
||||
|
<t t-if="order.get_client()"> |
||||
|
Customer: <t t-esc="order.get_client().name"/><br /> |
||||
|
</t> |
||||
|
Cashier: <t t-esc="widget.pos.cashier ? widget.pos.cashier.name : widget.pos.user.name"/><br /> |
||||
|
<t t-if="widget.pos.company.phone"> |
||||
|
Phone: <t t-esc="widget.pos.company.phone || ''"/><br /> |
||||
|
</t> |
||||
|
<t t-esc="order.name"/> |
||||
|
<t t-esc="moment().format('L LT')"/> |
||||
|
</div> |
||||
|
<div style="width: 45%;float: left; "> |
||||
|
<img src='/web/binary/company_logo' style="width:100%"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<t t-if="widget.pos.company.name"> |
||||
|
<div style="width:100%;text-align:right;"><t t-esc="widget.pos.company.name"/></div> |
||||
|
</t> |
||||
|
<t t-if="widget.pos.company.email"> |
||||
|
<div style="width:100%;text-align:right;"><t t-esc="widget.pos.company.email"/></div> |
||||
|
</t> |
||||
|
<br /> |
||||
|
<t t-if="receipt.header"> |
||||
|
<div style='text-align:center'> |
||||
|
<t t-esc="receipt.header" /> |
||||
|
</div> |
||||
|
<br/> |
||||
|
</t> |
||||
|
<table class='receipt-orderlines'> |
||||
|
<colgroup> |
||||
|
<col width='40%' /> |
||||
|
<col width='15%' /> |
||||
|
<col width='15%' /> |
||||
|
<col width='30%' /> |
||||
|
</colgroup> |
||||
|
<tr style="border: 1px solid rgb(0, 0, 0);"> |
||||
|
<th>Name</th> |
||||
|
<th>Qty</th> |
||||
|
<th>Price</th> |
||||
|
<th>Value</th> |
||||
|
</tr> |
||||
|
<tr t-foreach="orderlines" t-as="orderline"> |
||||
|
<td> |
||||
|
<t t-esc="orderline.get_product().display_name"/> |
||||
|
<t t-if="orderline.get_discount() > 0"> |
||||
|
<div class="pos-disc-font"> |
||||
|
With a <t t-esc="orderline.get_discount()"/>% discount |
||||
|
</div> |
||||
|
</t> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-esc="orderline.get_quantity_str_with_unit()"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
<t t-set="a" t-value="orderline.quantityStr"></t> |
||||
|
<t t-set="b" t-value="orderline.get_display_price()"></t> |
||||
|
<t t-set="c" t-value="b/a"></t> |
||||
|
<t t-esc="c"/> |
||||
|
</td> |
||||
|
<td style='text-align:right'> |
||||
|
<t t-esc="widget.format_currency(orderline.get_display_price())"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
<br /> |
||||
|
<table class='receipt-total'> |
||||
|
<colgroup> |
||||
|
<col width='40%' /> |
||||
|
<col width='30%' /> |
||||
|
<col width='30%' /> |
||||
|
</colgroup> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td>Subtotal:</td> |
||||
|
<td style='text-align:right'> |
||||
|
<t t-esc="widget.format_currency(order.get_total_without_tax())"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<t t-foreach="order.get_tax_details()" t-as="taxdetail"> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td><t t-esc="taxdetail.name" /></td> |
||||
|
<td style='text-align:right'> |
||||
|
<t t-esc="widget.format_currency(taxdetail.amount)"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
<tr> |
||||
|
<td></td> |
||||
|
<td>Discount:</td> |
||||
|
<td style='text-align:right'> |
||||
|
<t t-esc="widget.format_currency(order.get_total_discount())"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr class="emph"> |
||||
|
<td>Total:</td> |
||||
|
<td colspan="2" style='text-align:right'> |
||||
|
<t t-esc="widget.format_currency(order.get_total_with_tax())"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</table> |
||||
|
<br/> |
||||
|
<table class='receipt-paymentlines'> |
||||
|
<colgroup> |
||||
|
<col width='38%' /> |
||||
|
<col width='20%' /> |
||||
|
<col width='13%' /> |
||||
|
<col width='29%' /> |
||||
|
</colgroup> |
||||
|
<t t-foreach="paymentlines" t-as="line"> |
||||
|
<tr> |
||||
|
<td> |
||||
|
<t t-esc="line.name"/> |
||||
|
</td> |
||||
|
<td> |
||||
|
</td> |
||||
|
<td> |
||||
|
</td> |
||||
|
<td style='text-align:right'> |
||||
|
<t t-esc="widget.format_currency(line.get_amount())"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</table> |
||||
|
<br/> |
||||
|
<table class='receipt-change'> |
||||
|
<colgroup> |
||||
|
<col width='40%' /> |
||||
|
<col width='15%' /> |
||||
|
<col width='15%' /> |
||||
|
<col width='30%' /> |
||||
|
</colgroup> |
||||
|
<tr><td>Change:</td> |
||||
|
<td> |
||||
|
</td> |
||||
|
<td> |
||||
|
</td> |
||||
|
<td style='text-align:right'> |
||||
|
<t t-esc="widget.format_currency(order.get_change())"/> |
||||
|
</td></tr> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</templates> |
Loading…
Reference in new issue