@ -0,0 +1,49 @@ |
|||||
|
.. 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 |
||||
|
|
||||
|
Multi Barcode for Products |
||||
|
================================================================== |
||||
|
This module allows you to create Product multi barcodes for Sales, Purchase, Inventory and Invoicing. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configuration is needed. |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Affero General Public License, v3.0 (AGPL v3). |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (V16) Ammu Raj, |
||||
|
(V17) Advaith, |
||||
|
(V18) Aysha Shalin, |
||||
|
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: Aysha Shalin (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: Aysha Shalin (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': 'Multi Barcode for Products', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Warehouse', |
||||
|
'summary': """Allows to create multiple barcode for a single product.""", |
||||
|
'description': """This module allows to create Product multi barcode for |
||||
|
Sales, Purchase, Inventory and Invoicing.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com/', |
||||
|
'depends': ['stock', 'sale_management', 'purchase', 'account'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'views/account_move_views.xml', |
||||
|
'views/product_product_views.xml', |
||||
|
'views/product_template_views.xml', |
||||
|
'views/purchase_order_views.xml', |
||||
|
'views/sale_order_views.xml', |
||||
|
'views/stock_picking_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
## Module <multi_barcode_for_products> |
||||
|
|
||||
|
#### 16.10.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial commit for Multi Barcode for Products |
@ -0,0 +1,28 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 account_move_line |
||||
|
from . import product_multiple_barcodes |
||||
|
from . import product_product |
||||
|
from . import product_template |
||||
|
from . import purchase_order_line |
||||
|
from . import sale_order_line |
||||
|
from . import stock_move |
@ -0,0 +1,53 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 |
||||
|
|
||||
|
|
||||
|
class AccountMoveLine(models.Model): |
||||
|
""" Inherits Account.move.line for scanning multi barcode """ |
||||
|
_inherit = 'account.move.line' |
||||
|
|
||||
|
scan_barcode = fields.Char(string='Product Barcode', |
||||
|
compute="_compute_scan_barcode", |
||||
|
inverse="_inverse_scan_barcode", store=True, |
||||
|
help="You can scan the barcode here") |
||||
|
|
||||
|
@api.depends('purchase_line_id') |
||||
|
def _compute_scan_barcode(self): |
||||
|
""" For updating the Product Barcode field in move line while it's |
||||
|
generating from a Purchase order. """ |
||||
|
for line in self: |
||||
|
if line.purchase_line_id: |
||||
|
line.scan_barcode = line.purchase_line_id.scan_barcode |
||||
|
|
||||
|
def _inverse_scan_barcode(self): |
||||
|
"""Inverse function for scan_barcode""" |
||||
|
for account in self: |
||||
|
account.scan_barcode = account.scan_barcode |
||||
|
|
||||
|
@api.onchange('scan_barcode') |
||||
|
def _onchange_scan_barcode(self): |
||||
|
""" For getting the scanned barcode product """ |
||||
|
if self.scan_barcode: |
||||
|
product = self.env['product.multiple.barcodes'].search( |
||||
|
[('product_multi_barcode', '=', self.scan_barcode)]) |
||||
|
self.product_id = product.product_id.id |
@ -0,0 +1,53 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 fields, models |
||||
|
|
||||
|
|
||||
|
class ProductMultiBarcode(models.Model): |
||||
|
"""Creating multiple barcode for products""" |
||||
|
_name = 'product.multiple.barcodes' |
||||
|
_description = 'Product Multiple Barcodes' |
||||
|
_rec_name = 'product_multi_barcode' |
||||
|
|
||||
|
product_multi_barcode = fields.Char(string="Barcode", |
||||
|
help="Provide alternate barcodes for " |
||||
|
"the product") |
||||
|
product_id = fields.Many2one('product.product', string="Product Variant", |
||||
|
help="This will be the Product " |
||||
|
"variants") |
||||
|
product_template_id = fields.Many2one('product.template', string="Product", |
||||
|
help="This will be the products") |
||||
|
_sql_constraints = [ |
||||
|
('field_unique', 'unique(product_multi_barcode)', |
||||
|
'Existing barcode is not allowed !'),] |
||||
|
|
||||
|
def get_barcode_val(self, product): |
||||
|
""" |
||||
|
Summary: |
||||
|
get barcode of record in self and product id |
||||
|
Args: |
||||
|
product(int):current product |
||||
|
Returns: |
||||
|
barcode of the record in self and product |
||||
|
""" |
||||
|
|
||||
|
return self.product_multi_barcode, product |
@ -0,0 +1,71 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 |
||||
|
|
||||
|
|
||||
|
class ProductProduct(models.Model): |
||||
|
"""Inherits Products for multiple barcodes""" |
||||
|
_inherit = 'product.product' |
||||
|
|
||||
|
multi_barcode_ids = fields.One2many('product.multiple.barcodes', |
||||
|
'product_id', string='Barcodes', |
||||
|
help='Set multiple barcode') |
||||
|
|
||||
|
def _check_multi_barcode(self, domain): |
||||
|
"""Check product have multi barcode or not""" |
||||
|
product_id = None |
||||
|
if len(domain) > 1: |
||||
|
if 'barcode' in domain[0]: |
||||
|
barcode = domain[0][2] |
||||
|
bi_line = self.env['product.multiple.barcodes'].search( |
||||
|
[('product_multi_barcode', '=', barcode)]) |
||||
|
if bi_line: |
||||
|
product_id = bi_line.product_id.id |
||||
|
return product_id |
||||
|
|
||||
|
@api.model |
||||
|
def search_read(self, domain=None, fields=None, offset=0, limit=None, |
||||
|
order=None): |
||||
|
"""For searching the product with multi barcode""" |
||||
|
product_id = self._check_multi_barcode(domain) |
||||
|
if product_id: |
||||
|
domain = [('id', '=', product_id)] |
||||
|
res = super().search_read(domain=domain, fields=fields, offset=offset, |
||||
|
limit=limit, order=order) |
||||
|
return res |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
"""Creating multi barcodes""" |
||||
|
res = super(ProductProduct, self).create(vals) |
||||
|
res.multi_barcode_ids.update({ |
||||
|
'product_template_id': res.product_tmpl_id.id |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
def write(self, vals): |
||||
|
"""Updating multi barcodes""" |
||||
|
res = super(ProductProduct, self).write(vals) |
||||
|
self.multi_barcode_ids.update({ |
||||
|
'product_template_id': self.product_tmpl_id.id |
||||
|
}) |
||||
|
return res |
@ -0,0 +1,51 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 |
||||
|
|
||||
|
|
||||
|
class ProductTemplate(models.Model): |
||||
|
"""Inherits Product template for multi barcode feature""" |
||||
|
_inherit = 'product.template' |
||||
|
|
||||
|
template_multi_barcode_ids = fields.One2many( |
||||
|
'product.multiple.barcodes', |
||||
|
'product_template_id', |
||||
|
string='Multi Barcodes', |
||||
|
help="Multi barcode for product template") |
||||
|
|
||||
|
def write(self, vals): |
||||
|
"""Updating the multi barcodes""" |
||||
|
res = super(ProductTemplate, self).write(vals) |
||||
|
if self.template_multi_barcode_ids: |
||||
|
self.template_multi_barcode_ids.update({ |
||||
|
'product_id': self.product_variant_id.id |
||||
|
}) |
||||
|
return res |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
"""Creating the multi barcodes""" |
||||
|
res = super(ProductTemplate, self).create(vals) |
||||
|
res.template_multi_barcode_ids.update({ |
||||
|
'product_id': res.product_variant_id.id |
||||
|
}) |
||||
|
return res |
@ -0,0 +1,39 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 |
||||
|
|
||||
|
|
||||
|
class PurchaseOrderLines(models.Model): |
||||
|
"""Inherits Purchase order line for scanning multi barcode""" |
||||
|
_inherit = "purchase.order.line" |
||||
|
|
||||
|
scan_barcode = fields.Char(string='Product Barcode', |
||||
|
help="Here you can provide the barcode for the " |
||||
|
"product") |
||||
|
|
||||
|
@api.onchange('scan_barcode') |
||||
|
def _onchange_scan_barcode(self): |
||||
|
"""For getting the scanned barcode product""" |
||||
|
if self.scan_barcode: |
||||
|
product = self.env['product.multiple.barcodes'].search( |
||||
|
[('product_multi_barcode', '=', self.scan_barcode)]) |
||||
|
self.product_id = product.product_id.id |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 |
||||
|
|
||||
|
|
||||
|
class SaleOrderLine(models.Model): |
||||
|
"""Inherits Sale order line for scanning multi barcode""" |
||||
|
_inherit = 'sale.order.line' |
||||
|
|
||||
|
scan_barcode = fields.Char(string='Product Barcode', |
||||
|
help="Here you can provide the barcode for " |
||||
|
"the product") |
||||
|
|
||||
|
def _prepare_invoice_line(self, **optional_values): |
||||
|
"""For adding the scanned barcode in the invoice""" |
||||
|
res = super()._prepare_invoice_line(**optional_values) |
||||
|
res['scan_barcode'] = self.move_ids.scan_barcode |
||||
|
return res |
||||
|
|
||||
|
@api.onchange('scan_barcode') |
||||
|
def _onchange_scan_barcode(self): |
||||
|
"""For getting the scanned barcode product""" |
||||
|
if self.scan_barcode: |
||||
|
product = self.env['product.multiple.barcodes'].search( |
||||
|
[('product_multi_barcode', '=', self.scan_barcode)]) |
||||
|
self.product_id = product.product_id.id |
@ -0,0 +1,57 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 |
||||
|
|
||||
|
|
||||
|
class StockMove(models.Model): |
||||
|
"""Inherits Stock move for scanning multi barcode""" |
||||
|
_inherit = 'stock.move' |
||||
|
|
||||
|
scan_barcode = fields.Char(string='Product Barcode', |
||||
|
compute='_compute_scan_barcode', |
||||
|
inverse='_inverse_scan_barcode', |
||||
|
store=True, |
||||
|
help="Here you can provide the barcode for the " |
||||
|
"product") |
||||
|
|
||||
|
@api.depends('sale_line_id', 'purchase_line_id') |
||||
|
def _compute_scan_barcode(self): |
||||
|
"""For updating the Product Barcode field in delivery while it's |
||||
|
generating from a Purchase order or sale order""" |
||||
|
for stock in self: |
||||
|
if stock.sale_line_id: |
||||
|
stock.scan_barcode = stock.sale_line_id.scan_barcode |
||||
|
if stock.purchase_line_id: |
||||
|
stock.scan_barcode = stock.purchase_line_id.scan_barcode |
||||
|
|
||||
|
def _inverse_scan_barcode(self): |
||||
|
"""Inverse function for scan_barcode""" |
||||
|
for stock in self: |
||||
|
stock.scan_barcode = stock.scan_barcode |
||||
|
|
||||
|
@api.onchange('scan_barcode') |
||||
|
def _onchange_scan_barcode(self): |
||||
|
"""For getting the scanned barcode product""" |
||||
|
if self.scan_barcode: |
||||
|
product = self.env['product.multiple.barcodes'].search( |
||||
|
[('product_multi_barcode', '=', self.scan_barcode)]) |
||||
|
self.product_id = product.product_id.id |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 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: 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: 738 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.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: 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: 135 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 89 KiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 113 KiB |
After Width: | Height: | Size: 93 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 75 KiB |
After Width: | Height: | Size: 268 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 742 KiB |
After Width: | Height: | Size: 45 KiB |