diff --git a/barcode_scanning_sale_purchase/__init__.py b/barcode_scanning_sale_purchase/__init__.py
index da16ad3c5..97947739a 100644
--- a/barcode_scanning_sale_purchase/__init__.py
+++ b/barcode_scanning_sale_purchase/__init__.py
@@ -19,5 +19,4 @@
# If not, see .
#
#############################################################################
-
from . import models
diff --git a/barcode_scanning_sale_purchase/__manifest__.py b/barcode_scanning_sale_purchase/__manifest__.py
index f5bdc32f2..8ce431e40 100644
--- a/barcode_scanning_sale_purchase/__manifest__.py
+++ b/barcode_scanning_sale_purchase/__manifest__.py
@@ -21,17 +21,19 @@
{
'name': 'Barcode scanning support for sale and Purchase',
- 'version': '16.0.1.0.0',
+ 'version': '16.0.2.1.0',
'category': 'Sales',
'live_test_url': 'https://www.youtube.com/watch?v=6tJZAfPu__s&feature=youtu.be',
'summary': 'This module will help you to use barcode scanner in sales and purchase.',
'author': 'Cybrosys Techno solutions',
'company': 'Cybrosys Techno Solutions',
'website': 'https://www.cybrosys.com',
- 'depends': ['purchase', 'sale_management'],
+ 'depends': ['purchase', 'sale_management', 'stock'],
'data': [
'views/sale_order_line.xml',
'views/purchase_order_line.xml',
+ 'views/stock_picking_views.xml',
+ 'views/account_move_views.xml',
],
'installable': True,
'application': False,
diff --git a/barcode_scanning_sale_purchase/doc/RELEASE_NOTES.md b/barcode_scanning_sale_purchase/doc/RELEASE_NOTES.md
index f0ba7d11f..776c6de5a 100644
--- a/barcode_scanning_sale_purchase/doc/RELEASE_NOTES.md
+++ b/barcode_scanning_sale_purchase/doc/RELEASE_NOTES.md
@@ -3,4 +3,9 @@
#### 07.10.2021
#### Version 16.0.1.0.0
##### ADD
-- Initial Commit
\ No newline at end of file
+- Initial Commit
+
+#### 16.10.2023
+#### Version 16.0.2.1.0
+##### ADD
+- Inherited models and add fields, functions and add views for it
diff --git a/barcode_scanning_sale_purchase/models/__init__.py b/barcode_scanning_sale_purchase/models/__init__.py
index ba1911358..8df63052b 100644
--- a/barcode_scanning_sale_purchase/models/__init__.py
+++ b/barcode_scanning_sale_purchase/models/__init__.py
@@ -19,6 +19,7 @@
# If not, see .
#
#############################################################################
-
-from . import sale_order
+from . import account_move_line
from . import purchase_order
+from . import sale_order
+from . import stock_move
diff --git a/barcode_scanning_sale_purchase/models/account_move_line.py b/barcode_scanning_sale_purchase/models/account_move_line.py
new file mode 100644
index 000000000..50a4e383b
--- /dev/null
+++ b/barcode_scanning_sale_purchase/models/account_move_line.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+#############################################################################
+#
+# Cybrosys Technologies Pvt. Ltd.
+#
+# Copyright (C) 2023-TODAY Cybrosys Technologies().
+# Author: Sreejith P ()
+#
+# 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 .
+#
+#############################################################################
+from odoo import fields, models
+
+
+class AccountMoveLine(models.Model):
+ """Inherited the model for to add field for barcode."""
+ _inherit = 'account.move.line'
+
+ barcode_scan = fields.Char(string='Product Barcode',
+ help="Barcode for the product")
\ No newline at end of file
diff --git a/barcode_scanning_sale_purchase/models/purchase_order.py b/barcode_scanning_sale_purchase/models/purchase_order.py
index b1830180e..da99df78b 100644
--- a/barcode_scanning_sale_purchase/models/purchase_order.py
+++ b/barcode_scanning_sale_purchase/models/purchase_order.py
@@ -1,17 +1,62 @@
-from odoo import api, models, fields
+# -*- coding: utf-8 -*-
+#############################################################################
+#
+# Cybrosys Technologies Pvt. Ltd.
+#
+# Copyright (C) 2023-TODAY Cybrosys Technologies().
+# Author: Sreejith P ()
+#
+# 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 .
+#
+#############################################################################
+from odoo import api, fields, models
class PurchaseOrderLines(models.Model):
+ """Inherited the model for add field for barcode."""
_inherit = "purchase.order.line"
- barcode_scan = fields.Char(string='Product Barcode', help="Here you can provide the barcode for the product")
+ barcode_scan = fields.Char(string='Product Barcode',
+ help="Here you can provide the barcode for the "
+ "product")
@api.onchange('barcode_scan')
def _onchange_barcode_scan(self):
- print('purchase')
+ """Scanning the barcode will automatically add products to order line"""
product_rec = self.env['product.product']
if self.barcode_scan:
product = product_rec.search([('barcode', '=', self.barcode_scan)])
self.product_id = product.id
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+class PurchaseOrder(models.Model):
+ """Added functions for pass the values from the order line to stock picking
+ and account move"""
+ _inherit = 'purchase.order'
+
+ def button_confirm(self):
+ """Corresponding barcode of product will show in stock picking"""
+ res = super().button_confirm()
+ for rec in self.order_line:
+ self.env['stock.move'].search([('purchase_line_id', '=', rec.id)])[
+ 'barcode_scan'] = rec.barcode_scan
+ return res
+
+ def action_create_invoice(self):
+ """Corresponding barcode of product will show in account move line"""
+ res = super().action_create_invoice()
+ for rec in self.order_line:
+ self.env['account.move.line'].search(
+ [('purchase_line_id', '=', rec.id)])[
+ 'barcode_scan'] = rec.barcode_scan
+ return res
diff --git a/barcode_scanning_sale_purchase/models/sale_order.py b/barcode_scanning_sale_purchase/models/sale_order.py
index 6b13226c4..cd122d11f 100644
--- a/barcode_scanning_sale_purchase/models/sale_order.py
+++ b/barcode_scanning_sale_purchase/models/sale_order.py
@@ -1,17 +1,59 @@
-from odoo import api, models, fields
+# -*- coding: utf-8 -*-
+#############################################################################
+#
+# Cybrosys Technologies Pvt. Ltd.
+#
+# Copyright (C) 2023-TODAY Cybrosys Technologies().
+# Author: Sreejith P ()
+#
+# 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 .
+#
+#############################################################################
+from odoo import api, fields, models
-class SaleOrderLines(models.Model):
+class SaleOrderLine(models.Model):
+ """Inherited the model for to add field for barcode."""
_inherit = 'sale.order.line'
- barcode_scan = fields.Char(string='Product Barcode', help="Here you can provide the barcode for the product")
+ barcode_scan = fields.Char(string='Product Barcode',
+ help="Here you can provide the barcode for "
+ "the product")
- @api.onchange('barcode_scan')
+ @api.onchange('barcode_scan', 'product_template_id')
def _onchange_barcode_scan(self):
- print('sale')
+ """Scanning the barcode will automatically add products to order line"""
product_rec = self.env['product.product']
if self.barcode_scan:
product = product_rec.search([('barcode', '=', self.barcode_scan)])
self.product_id = product.id
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ def _prepare_invoice_line(self, **optional_values):
+ """Corresponding barcode of product will show in account move"""
+ res = super(SaleOrderLine, self)._prepare_invoice_line(
+ **optional_values)
+ if self.barcode_scan:
+ res.update({'barcode_scan': self.barcode_scan})
+ return res
+
+
+class SaleOrder(models.Model):
+ _inherit = 'sale.order'
+
+ def action_confirm(self):
+ """Corresponding barcode of product will show in stock picking"""
+ res = super().action_confirm()
+ for rec in self.order_line:
+ self.env['stock.move'].search([('sale_line_id', '=', rec.id)])[
+ 'barcode_scan'] = rec.barcode_scan
+ return res
diff --git a/barcode_scanning_sale_purchase/models/stock_move.py b/barcode_scanning_sale_purchase/models/stock_move.py
new file mode 100644
index 000000000..8afe1cd8e
--- /dev/null
+++ b/barcode_scanning_sale_purchase/models/stock_move.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+#############################################################################
+#
+# Cybrosys Technologies Pvt. Ltd.
+#
+# Copyright (C) 2023-TODAY Cybrosys Technologies().
+# Author: Sreejith P ()
+#
+# 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 .
+#
+#############################################################################
+from odoo import fields, models
+
+
+class StockMove(models.Model):
+ """Inherited the model for add field for barcode."""
+ _inherit = "stock.move"
+
+ barcode_scan = fields.Char(string='Product Barcode',
+ help="Barcode of the product")
+
+
diff --git a/barcode_scanning_sale_purchase/views/account_move_views.xml b/barcode_scanning_sale_purchase/views/account_move_views.xml
new file mode 100644
index 000000000..5e8f0f9e2
--- /dev/null
+++ b/barcode_scanning_sale_purchase/views/account_move_views.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ account.move.form.inherit.barcode.scanning.sale.purchase
+ account.move
+
+
+
+
+
+
+
+
diff --git a/barcode_scanning_sale_purchase/views/purchase_order_line.xml b/barcode_scanning_sale_purchase/views/purchase_order_line.xml
index 1b4fc9519..fe387305e 100644
--- a/barcode_scanning_sale_purchase/views/purchase_order_line.xml
+++ b/barcode_scanning_sale_purchase/views/purchase_order_line.xml
@@ -1,15 +1,14 @@
-
-
- purchase.order.form.inherit
- purchase.order
-
-
-
-
-
-
-
-
+
+
+ purchase.order.form.inherit
+ purchase.order
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/barcode_scanning_sale_purchase/views/sale_order_line.xml b/barcode_scanning_sale_purchase/views/sale_order_line.xml
index 7c4872fc7..932afbd58 100644
--- a/barcode_scanning_sale_purchase/views/sale_order_line.xml
+++ b/barcode_scanning_sale_purchase/views/sale_order_line.xml
@@ -1,15 +1,14 @@
-
-
- sale.order.form.inherit
- sale.order
-
-
-
-
-
-
-
-
+
+
+ sale.order.form.inherit
+ sale.order
+
+
+
+
+
+
+
diff --git a/barcode_scanning_sale_purchase/views/stock_picking_views.xml b/barcode_scanning_sale_purchase/views/stock_picking_views.xml
new file mode 100644
index 000000000..a1719f0be
--- /dev/null
+++ b/barcode_scanning_sale_purchase/views/stock_picking_views.xml
@@ -0,0 +1,14 @@
+
+
+
+
+ stock.picking.view.form.inherit.barcode.scanning.sale.purchase
+ stock.picking
+
+
+
+
+
+
+
+