diff --git a/product_variant_import/README.rst b/product_variant_import/README.rst new file mode 100644 index 000000000..2aad431a4 --- /dev/null +++ b/product_variant_import/README.rst @@ -0,0 +1,55 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg + :target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 + +Import Product variant +====================== +This module is used to import the product and their attributes using xlsx file +and csv file.And also through this files with product importing we can also +import some basic fields such as char ,many2one and many2many fields.Using this +module we can update a product using the product's internal reference +or barcode we can change the date through the importing and also these can be +implemented using the two files. + +Configuration +============= +* No additional configurations needed + +Company +------- +* `Cybrosys Techno Solutions `__ + +License +------- +General Public License, Version 3 (LGPL v3). +(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) + + +Credits +------- +* Developer: (V16) Gayathri V, + (V18) Busthana Shirin, +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 `__ + +Further information +=================== +HTML Description: ``__ \ No newline at end of file diff --git a/product_variant_import/__init__.py b/product_variant_import/__init__.py new file mode 100644 index 000000000..6f4970bab --- /dev/null +++ b/product_variant_import/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import wizards diff --git a/product_variant_import/__manifest__.py b/product_variant_import/__manifest__.py new file mode 100644 index 000000000..021061c0b --- /dev/null +++ b/product_variant_import/__manifest__.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +{ + 'name': 'Import Product variant', + 'version': '18.0.1.0.0', + 'category': 'Sales', + 'summary': """This module is used to import the product and product + variants.""", + 'description': """This module is used to import the product and their + attributes using xlsx file and csv file. And also through this files with + product importing we can also import some basic fields such as char,many2one + and many2many fields.Using this module we can update a product using the + product's internal reference or barcode we can change the date through the + importing and also these can be implemented using the two files.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': 'https://www.cybrosys.com', + 'depends': ['sale_management', 'stock'], + 'data': [ + 'security/ir.model.access.csv', + 'security/product_variant_import_groups.xml', + 'wizards/import_product_variant_views.xml', + ], + 'images': ['static/description/banner.png'], + 'license': 'LGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/product_variant_import/doc/RELEASE_NOTES.md b/product_variant_import/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..b48ab6de8 --- /dev/null +++ b/product_variant_import/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 17.01.2025 +#### Version 18.0.1.0.0 +##### ADD +- Initial commit for Import Product variant diff --git a/product_variant_import/security/ir.model.access.csv b/product_variant_import/security/ir.model.access.csv new file mode 100644 index 000000000..6bbf62355 --- /dev/null +++ b/product_variant_import/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access.import.product.variant_user,access.import.product.variant.user,model_import_product_variant,base.group_user,1,1,1,1 diff --git a/product_variant_import/security/product_variant_import_groups.xml b/product_variant_import/security/product_variant_import_groups.xml new file mode 100644 index 000000000..b0cfe20e7 --- /dev/null +++ b/product_variant_import/security/product_variant_import_groups.xml @@ -0,0 +1,13 @@ + + + + + Import + Import Product Variant + 10 + + + Variant Manager + + + diff --git a/product_variant_import/static/description/assets/icons/arrows-repeat.svg b/product_variant_import/static/description/assets/icons/arrows-repeat.svg new file mode 100755 index 000000000..1d7efabc5 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/arrows-repeat.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/banner-1.png b/product_variant_import/static/description/assets/icons/banner-1.png new file mode 100755 index 000000000..c180db172 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/banner-1.png differ diff --git a/product_variant_import/static/description/assets/icons/banner-2.svg b/product_variant_import/static/description/assets/icons/banner-2.svg new file mode 100755 index 000000000..e606d97d9 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/banner-2.svg @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/banner-bg.png b/product_variant_import/static/description/assets/icons/banner-bg.png new file mode 100755 index 000000000..a8238d3c0 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/banner-bg.png differ diff --git a/product_variant_import/static/description/assets/icons/banner-bg.svg b/product_variant_import/static/description/assets/icons/banner-bg.svg new file mode 100755 index 000000000..b1378103e --- /dev/null +++ b/product_variant_import/static/description/assets/icons/banner-bg.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/banner-call.svg b/product_variant_import/static/description/assets/icons/banner-call.svg new file mode 100755 index 000000000..96c687e81 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/banner-call.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/product_variant_import/static/description/assets/icons/banner-mail.svg b/product_variant_import/static/description/assets/icons/banner-mail.svg new file mode 100755 index 000000000..cbf0d158d --- /dev/null +++ b/product_variant_import/static/description/assets/icons/banner-mail.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/product_variant_import/static/description/assets/icons/banner-pattern.svg b/product_variant_import/static/description/assets/icons/banner-pattern.svg new file mode 100755 index 000000000..9c1c7e101 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/banner-pattern.svg @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/banner-promo.svg b/product_variant_import/static/description/assets/icons/banner-promo.svg new file mode 100755 index 000000000..d52791b11 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/banner-promo.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/brand-pair.svg b/product_variant_import/static/description/assets/icons/brand-pair.svg new file mode 100755 index 000000000..d8db7fc1e --- /dev/null +++ b/product_variant_import/static/description/assets/icons/brand-pair.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/check.png b/product_variant_import/static/description/assets/icons/check.png new file mode 100755 index 000000000..c8e85f51d Binary files /dev/null and b/product_variant_import/static/description/assets/icons/check.png differ diff --git a/product_variant_import/static/description/assets/icons/chevron.png b/product_variant_import/static/description/assets/icons/chevron.png new file mode 100755 index 000000000..2089293d6 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/chevron.png differ diff --git a/product_variant_import/static/description/assets/icons/close-icon.svg b/product_variant_import/static/description/assets/icons/close-icon.svg new file mode 100755 index 000000000..df8cce37a --- /dev/null +++ b/product_variant_import/static/description/assets/icons/close-icon.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/product_variant_import/static/description/assets/icons/cogs.png b/product_variant_import/static/description/assets/icons/cogs.png new file mode 100755 index 000000000..95d0bad62 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/cogs.png differ diff --git a/product_variant_import/static/description/assets/icons/collabarate-icon.svg b/product_variant_import/static/description/assets/icons/collabarate-icon.svg new file mode 100755 index 000000000..dd4e10518 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/collabarate-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/product_variant_import/static/description/assets/icons/consultation.png b/product_variant_import/static/description/assets/icons/consultation.png new file mode 100755 index 000000000..8319d4baa Binary files /dev/null and b/product_variant_import/static/description/assets/icons/consultation.png differ diff --git a/product_variant_import/static/description/assets/icons/cybro-logo.png b/product_variant_import/static/description/assets/icons/cybro-logo.png new file mode 100755 index 000000000..ff4b78220 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/cybro-logo.png differ diff --git a/product_variant_import/static/description/assets/icons/down.svg b/product_variant_import/static/description/assets/icons/down.svg new file mode 100755 index 000000000..f21c36271 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/product_variant_import/static/description/assets/icons/ecom-black.png b/product_variant_import/static/description/assets/icons/ecom-black.png new file mode 100755 index 000000000..a9385ff13 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/ecom-black.png differ diff --git a/product_variant_import/static/description/assets/icons/education-black.png b/product_variant_import/static/description/assets/icons/education-black.png new file mode 100755 index 000000000..3eb09b27b Binary files /dev/null and b/product_variant_import/static/description/assets/icons/education-black.png differ diff --git a/product_variant_import/static/description/assets/icons/faq.png b/product_variant_import/static/description/assets/icons/faq.png new file mode 100755 index 000000000..4250b5b81 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/faq.png differ diff --git a/product_variant_import/static/description/assets/icons/feature-icon.svg b/product_variant_import/static/description/assets/icons/feature-icon.svg new file mode 100755 index 000000000..fa0ea6850 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/feature-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/feature.png b/product_variant_import/static/description/assets/icons/feature.png new file mode 100755 index 000000000..ac7a785c0 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/feature.png differ diff --git a/product_variant_import/static/description/assets/icons/gear.svg b/product_variant_import/static/description/assets/icons/gear.svg new file mode 100755 index 000000000..0cc66b6ea --- /dev/null +++ b/product_variant_import/static/description/assets/icons/gear.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/hero.gif b/product_variant_import/static/description/assets/icons/hero.gif new file mode 100755 index 000000000..380654dfe Binary files /dev/null and b/product_variant_import/static/description/assets/icons/hero.gif differ diff --git a/product_variant_import/static/description/assets/icons/hire-odoo.svg b/product_variant_import/static/description/assets/icons/hire-odoo.svg new file mode 100755 index 000000000..e1ac089b0 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/hire-odoo.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/hotel-black.png b/product_variant_import/static/description/assets/icons/hotel-black.png new file mode 100755 index 000000000..130f613be Binary files /dev/null and b/product_variant_import/static/description/assets/icons/hotel-black.png differ diff --git a/product_variant_import/static/description/assets/icons/license.png b/product_variant_import/static/description/assets/icons/license.png new file mode 100755 index 000000000..a5869797e Binary files /dev/null and b/product_variant_import/static/description/assets/icons/license.png differ diff --git a/product_variant_import/static/description/assets/icons/life-ring-icon.svg b/product_variant_import/static/description/assets/icons/life-ring-icon.svg new file mode 100755 index 000000000..3ae6e1d89 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/life-ring-icon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/lifebuoy.png b/product_variant_import/static/description/assets/icons/lifebuoy.png new file mode 100755 index 000000000..658d56ccc Binary files /dev/null and b/product_variant_import/static/description/assets/icons/lifebuoy.png differ diff --git a/product_variant_import/static/description/assets/icons/mail.svg b/product_variant_import/static/description/assets/icons/mail.svg new file mode 100755 index 000000000..1eedde695 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/mail.svg @@ -0,0 +1,3 @@ + + + diff --git a/product_variant_import/static/description/assets/icons/manufacturing-black.png b/product_variant_import/static/description/assets/icons/manufacturing-black.png new file mode 100755 index 000000000..697eb0e9f Binary files /dev/null and b/product_variant_import/static/description/assets/icons/manufacturing-black.png differ diff --git a/product_variant_import/static/description/assets/icons/notes.png b/product_variant_import/static/description/assets/icons/notes.png new file mode 100755 index 000000000..ee5e95404 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/notes.png differ diff --git a/product_variant_import/static/description/assets/icons/notification icon.svg b/product_variant_import/static/description/assets/icons/notification icon.svg new file mode 100755 index 000000000..053189973 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/notification icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/odoo-consultancy.svg b/product_variant_import/static/description/assets/icons/odoo-consultancy.svg new file mode 100755 index 000000000..e05f65bde --- /dev/null +++ b/product_variant_import/static/description/assets/icons/odoo-consultancy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/product_variant_import/static/description/assets/icons/odoo-licencing.svg b/product_variant_import/static/description/assets/icons/odoo-licencing.svg new file mode 100755 index 000000000..2606c88b0 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/odoo-licencing.svg @@ -0,0 +1,3 @@ + + + diff --git a/product_variant_import/static/description/assets/icons/odoo-logo.png b/product_variant_import/static/description/assets/icons/odoo-logo.png new file mode 100755 index 000000000..0e4d0eb5a Binary files /dev/null and b/product_variant_import/static/description/assets/icons/odoo-logo.png differ diff --git a/product_variant_import/static/description/assets/icons/patter.svg b/product_variant_import/static/description/assets/icons/patter.svg new file mode 100755 index 000000000..25c9c0a8f --- /dev/null +++ b/product_variant_import/static/description/assets/icons/patter.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/pattern1.png b/product_variant_import/static/description/assets/icons/pattern1.png new file mode 100755 index 000000000..09ab0fb2d Binary files /dev/null and b/product_variant_import/static/description/assets/icons/pattern1.png differ diff --git a/product_variant_import/static/description/assets/icons/pos-black.png b/product_variant_import/static/description/assets/icons/pos-black.png new file mode 100755 index 000000000..97c0f90c1 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/pos-black.png differ diff --git a/product_variant_import/static/description/assets/icons/puzzle-piece-icon.svg b/product_variant_import/static/description/assets/icons/puzzle-piece-icon.svg new file mode 100755 index 000000000..3e9ad9373 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/puzzle-piece-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/puzzle.png b/product_variant_import/static/description/assets/icons/puzzle.png new file mode 100755 index 000000000..65cf854e7 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/puzzle.png differ diff --git a/product_variant_import/static/description/assets/icons/replace-icon.svg b/product_variant_import/static/description/assets/icons/replace-icon.svg new file mode 100755 index 000000000..d0e3a7af1 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/replace-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/restaurant-black.png b/product_variant_import/static/description/assets/icons/restaurant-black.png new file mode 100755 index 000000000..4a35eb939 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/restaurant-black.png differ diff --git a/product_variant_import/static/description/assets/icons/screenshot-main.png b/product_variant_import/static/description/assets/icons/screenshot-main.png new file mode 100755 index 000000000..575f8e676 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/screenshot-main.png differ diff --git a/product_variant_import/static/description/assets/icons/screenshot.png b/product_variant_import/static/description/assets/icons/screenshot.png new file mode 100755 index 000000000..cef272529 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/screenshot.png differ diff --git a/product_variant_import/static/description/assets/icons/service-black.png b/product_variant_import/static/description/assets/icons/service-black.png new file mode 100755 index 000000000..301ab51cb Binary files /dev/null and b/product_variant_import/static/description/assets/icons/service-black.png differ diff --git a/product_variant_import/static/description/assets/icons/skype-fill.svg b/product_variant_import/static/description/assets/icons/skype-fill.svg new file mode 100755 index 000000000..c17423639 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/skype-fill.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/skype.png b/product_variant_import/static/description/assets/icons/skype.png new file mode 100755 index 000000000..51b409fb3 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/skype.png differ diff --git a/product_variant_import/static/description/assets/icons/skype.svg b/product_variant_import/static/description/assets/icons/skype.svg new file mode 100755 index 000000000..df3dad39b --- /dev/null +++ b/product_variant_import/static/description/assets/icons/skype.svg @@ -0,0 +1,3 @@ + + + diff --git a/product_variant_import/static/description/assets/icons/star-1.svg b/product_variant_import/static/description/assets/icons/star-1.svg new file mode 100755 index 000000000..7e55ab162 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/star-1.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/star-2.svg b/product_variant_import/static/description/assets/icons/star-2.svg new file mode 100755 index 000000000..5ae9f507a --- /dev/null +++ b/product_variant_import/static/description/assets/icons/star-2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/support.png b/product_variant_import/static/description/assets/icons/support.png new file mode 100755 index 000000000..4f18b8b82 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/support.png differ diff --git a/product_variant_import/static/description/assets/icons/test-1 - Copy.png b/product_variant_import/static/description/assets/icons/test-1 - Copy.png new file mode 100755 index 000000000..f6a902663 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/test-1 - Copy.png differ diff --git a/product_variant_import/static/description/assets/icons/test-1.png b/product_variant_import/static/description/assets/icons/test-1.png new file mode 100755 index 000000000..0908add2b Binary files /dev/null and b/product_variant_import/static/description/assets/icons/test-1.png differ diff --git a/product_variant_import/static/description/assets/icons/test-2.png b/product_variant_import/static/description/assets/icons/test-2.png new file mode 100755 index 000000000..4671fe91e Binary files /dev/null and b/product_variant_import/static/description/assets/icons/test-2.png differ diff --git a/product_variant_import/static/description/assets/icons/trading-black.png b/product_variant_import/static/description/assets/icons/trading-black.png new file mode 100755 index 000000000..9398ba2f1 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/trading-black.png differ diff --git a/product_variant_import/static/description/assets/icons/training.png b/product_variant_import/static/description/assets/icons/training.png new file mode 100755 index 000000000..884ca024d Binary files /dev/null and b/product_variant_import/static/description/assets/icons/training.png differ diff --git a/product_variant_import/static/description/assets/icons/translate.svg b/product_variant_import/static/description/assets/icons/translate.svg new file mode 100755 index 000000000..af9c8a1aa --- /dev/null +++ b/product_variant_import/static/description/assets/icons/translate.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/update.png b/product_variant_import/static/description/assets/icons/update.png new file mode 100755 index 000000000..ecbc5a01a Binary files /dev/null and b/product_variant_import/static/description/assets/icons/update.png differ diff --git a/product_variant_import/static/description/assets/icons/user.png b/product_variant_import/static/description/assets/icons/user.png new file mode 100755 index 000000000..6ffb23d9f Binary files /dev/null and b/product_variant_import/static/description/assets/icons/user.png differ diff --git a/product_variant_import/static/description/assets/icons/video.png b/product_variant_import/static/description/assets/icons/video.png new file mode 100755 index 000000000..576705b17 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/video.png differ diff --git a/product_variant_import/static/description/assets/icons/whatsapp.png b/product_variant_import/static/description/assets/icons/whatsapp.png new file mode 100755 index 000000000..d513a5356 Binary files /dev/null and b/product_variant_import/static/description/assets/icons/whatsapp.png differ diff --git a/product_variant_import/static/description/assets/icons/wrench-icon.svg b/product_variant_import/static/description/assets/icons/wrench-icon.svg new file mode 100755 index 000000000..174b5a465 --- /dev/null +++ b/product_variant_import/static/description/assets/icons/wrench-icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/product_variant_import/static/description/assets/icons/wrench.png b/product_variant_import/static/description/assets/icons/wrench.png new file mode 100755 index 000000000..6c04dea0f Binary files /dev/null and b/product_variant_import/static/description/assets/icons/wrench.png differ diff --git a/product_variant_import/static/description/assets/modules/1.gif b/product_variant_import/static/description/assets/modules/1.gif new file mode 100755 index 000000000..ae3a880a2 Binary files /dev/null and b/product_variant_import/static/description/assets/modules/1.gif differ diff --git a/product_variant_import/static/description/assets/modules/2.gif b/product_variant_import/static/description/assets/modules/2.gif new file mode 100755 index 000000000..d19e2b352 Binary files /dev/null and b/product_variant_import/static/description/assets/modules/2.gif differ diff --git a/product_variant_import/static/description/assets/modules/3.png b/product_variant_import/static/description/assets/modules/3.png new file mode 100755 index 000000000..8513873ea Binary files /dev/null and b/product_variant_import/static/description/assets/modules/3.png differ diff --git a/product_variant_import/static/description/assets/modules/4.png b/product_variant_import/static/description/assets/modules/4.png new file mode 100755 index 000000000..3bedf7981 Binary files /dev/null and b/product_variant_import/static/description/assets/modules/4.png differ diff --git a/product_variant_import/static/description/assets/modules/5.png b/product_variant_import/static/description/assets/modules/5.png new file mode 100755 index 000000000..0e311ca87 Binary files /dev/null and b/product_variant_import/static/description/assets/modules/5.png differ diff --git a/product_variant_import/static/description/assets/modules/6.jpg b/product_variant_import/static/description/assets/modules/6.jpg new file mode 100755 index 000000000..67c7f7062 Binary files /dev/null and b/product_variant_import/static/description/assets/modules/6.jpg differ diff --git a/product_variant_import/static/description/assets/screenshots/hero.gif b/product_variant_import/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..5c524d910 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/hero.gif differ diff --git a/product_variant_import/static/description/assets/screenshots/image1.png b/product_variant_import/static/description/assets/screenshots/image1.png new file mode 100644 index 000000000..b4a34d989 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image1.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image10.png b/product_variant_import/static/description/assets/screenshots/image10.png new file mode 100644 index 000000000..5bd55aa96 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image10.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image12.png b/product_variant_import/static/description/assets/screenshots/image12.png new file mode 100644 index 000000000..66abf24ae Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image12.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image2.png b/product_variant_import/static/description/assets/screenshots/image2.png new file mode 100644 index 000000000..f8b4b580c Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image2.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image3.png b/product_variant_import/static/description/assets/screenshots/image3.png new file mode 100644 index 000000000..17b19f659 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image3.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image4.png b/product_variant_import/static/description/assets/screenshots/image4.png new file mode 100644 index 000000000..fe4b0fde9 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image4.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image5.png b/product_variant_import/static/description/assets/screenshots/image5.png new file mode 100644 index 000000000..9e1fcdc68 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image5.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image6.png b/product_variant_import/static/description/assets/screenshots/image6.png new file mode 100644 index 000000000..5e836ce9a Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image6.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image7.png b/product_variant_import/static/description/assets/screenshots/image7.png new file mode 100644 index 000000000..4cb8cef0e Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image7.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image8.png b/product_variant_import/static/description/assets/screenshots/image8.png new file mode 100644 index 000000000..5774ee444 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image8.png differ diff --git a/product_variant_import/static/description/assets/screenshots/image9.png b/product_variant_import/static/description/assets/screenshots/image9.png new file mode 100644 index 000000000..05bab546e Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/image9.png differ diff --git a/product_variant_import/static/description/assets/screenshots/pr.png b/product_variant_import/static/description/assets/screenshots/pr.png new file mode 100644 index 000000000..6139c7f1d Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/pr.png differ diff --git a/product_variant_import/static/description/assets/screenshots/product1.png b/product_variant_import/static/description/assets/screenshots/product1.png new file mode 100644 index 000000000..7c86ba3df Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/product1.png differ diff --git a/product_variant_import/static/description/assets/screenshots/product2.png b/product_variant_import/static/description/assets/screenshots/product2.png new file mode 100644 index 000000000..9f2821d29 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/product2.png differ diff --git a/product_variant_import/static/description/assets/screenshots/product3.png b/product_variant_import/static/description/assets/screenshots/product3.png new file mode 100644 index 000000000..045b50aa1 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/product3.png differ diff --git a/product_variant_import/static/description/assets/screenshots/product4.png b/product_variant_import/static/description/assets/screenshots/product4.png new file mode 100644 index 000000000..9c8453662 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/product4.png differ diff --git a/product_variant_import/static/description/assets/screenshots/var1.png b/product_variant_import/static/description/assets/screenshots/var1.png new file mode 100644 index 000000000..9ebe19d28 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/var1.png differ diff --git a/product_variant_import/static/description/assets/screenshots/var2.png b/product_variant_import/static/description/assets/screenshots/var2.png new file mode 100644 index 000000000..8523595fa Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/var2.png differ diff --git a/product_variant_import/static/description/assets/screenshots/var3.png b/product_variant_import/static/description/assets/screenshots/var3.png new file mode 100644 index 000000000..926898f31 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/var3.png differ diff --git a/product_variant_import/static/description/assets/screenshots/var4.png b/product_variant_import/static/description/assets/screenshots/var4.png new file mode 100644 index 000000000..a5a75d0f9 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/var4.png differ diff --git a/product_variant_import/static/description/assets/screenshots/var5.png b/product_variant_import/static/description/assets/screenshots/var5.png new file mode 100644 index 000000000..3c823a197 Binary files /dev/null and b/product_variant_import/static/description/assets/screenshots/var5.png differ diff --git a/product_variant_import/static/description/banner.png b/product_variant_import/static/description/banner.png new file mode 100644 index 000000000..b589bdae4 Binary files /dev/null and b/product_variant_import/static/description/banner.png differ diff --git a/product_variant_import/static/description/icon.png b/product_variant_import/static/description/icon.png new file mode 100644 index 000000000..6b161592f Binary files /dev/null and b/product_variant_import/static/description/icon.png differ diff --git a/product_variant_import/static/description/index.html b/product_variant_import/static/description/index.html new file mode 100644 index 000000000..6051d31fa --- /dev/null +++ b/product_variant_import/static/description/index.html @@ -0,0 +1,1076 @@ + + + + + + Import Product Variant + + + + + + + + + + +
+
+ + + +
+
+ Community +
+
+ Enterprise +
+
+ Odoo.sh +
+
+
+ +
+
+
+
+

+ This Module Is Helps To Import Product And + Product Variants.

+

Import Product Variant +

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

Key + Highlights

+
+
+
+
+ +
+

+ This module is used to import the product + and their attributes using + xlsx file and csv file. And also through + these files with product + importing we can also import some + basic fields such as char ,many2one and + many2many fields.Using this + module we can update a product using the + product's internal + reference or barcode we can change the date + through the importing + and also these can be implemented using the + two files.

+
+
+
+
+
+ +
+

+ You can or update product variants by + barcode & internal reference.

+ +
+
+
+
+
+ +
+

+ You can import product images by image URL + or local image path.

+ +
+
+
+
+
+ +
+

+ Easy to create and update product + variants.

+ +
+
+
+
+
+ +
+

+ Easy to import custom fields with product + variants..

+ +
+
+
+
+
+ +
+

+ Easy to import Product Variant (image, + price, invoicing type, product type etc.) + from CSV or Excel.

+ +
+
+
+
+
+ +
+

+ Useful for mass records.

+ +
+
+
+
+ +
+
+
+ Import Product Variant +

+ Are you ready to make your business more + organized? +
Improve now! +

+ +
+
+ +
+
+
+ + + + +
+
+ +
+
+
+
+ acc_bg +
+ +
+
+
+
+

+ Set the user access.

+

+ +

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

+ Import menu in the sales module under + the product tab.

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

+ Sample example of csv file. +

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

+ Upload csv/xlsx file to create the + product with + variants. +

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

+ Sample example of xlsx file. +

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

+ Upload you csv/xlsx file to + create/update the product with + variants.

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

+ Imported product with image.

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

+ Available in + Odoo 18.0 Community and + Enterprise

+
+ +
+
+
+
+
+
+ +
+

+ Useful for mass records.

+
+
+
+
+
+
+
+ +
+

+ Easy to import Product Variant + (image, + price, invoicing type, product type + etc.) from CSV or Excel.

+
+
+
+
+
+
+ +
+
+

+ Latest Release 18.0.1.0.0 +

+ + 29th Feb, 2025 + +
+
+
+
+
+ Add +
+
+
+
    +
  • + Initial Commit +
  • + +
+
+
+
+
+
+
+
+
+
+ + + +
+

+ Related Products +

+ +
+ + +
+

+ Our Services

+ +
+ +
+
+ .... +
+
+ +
+ + +
+ + + + + + + diff --git a/product_variant_import/static/test_files/prdoct_create_test.csv b/product_variant_import/static/test_files/prdoct_create_test.csv new file mode 100644 index 000000000..d6ae3fbd8 --- /dev/null +++ b/product_variant_import/static/test_files/prdoct_create_test.csv @@ -0,0 +1,2 @@ +Unique Identifier,Name,Internal Reference,Canbe Sold,Canbe Purchased,Product Type,Category,Unit of Measure,Purchase Unit of Measure,Customer Taxes,Vendor Taxes,Description for customers,Invoicing Policy,Sales Price,Cost,Variant Attributes,Attribute Values,Internal Reference,Barcode,Weight,Volume,Qty On hand,Responsible,Image,x_char_testtext,x_many2many_testnamepartner,x_many2one_testpartner2 +1,Chair,Chair,TRUE,TRUE,Goods,All,Units,Units,Tax 15 %,Tax 20 %,Try This One,Delivered quantities,295,120.5,Legs,"Steel,Aluminium",Chair,OO10,10.7,7.7,100,OdooBot,/home/cybrosys/Downloads/chair.png,Hello,res.partner:Mitchel Admin,res.partner:Mitchell Admin diff --git a/product_variant_import/static/test_files/product_test.xlsx b/product_variant_import/static/test_files/product_test.xlsx new file mode 100644 index 000000000..14c14336e Binary files /dev/null and b/product_variant_import/static/test_files/product_test.xlsx differ diff --git a/product_variant_import/wizards/__init__.py b/product_variant_import/wizards/__init__.py new file mode 100644 index 000000000..404a007dc --- /dev/null +++ b/product_variant_import/wizards/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +from . import import_product_variant diff --git a/product_variant_import/wizards/import_product_variant.py b/product_variant_import/wizards/import_product_variant.py new file mode 100644 index 000000000..0f6012d31 --- /dev/null +++ b/product_variant_import/wizards/import_product_variant.py @@ -0,0 +1,683 @@ +# -*- coding: utf-8 -*- +############################################################################# +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2025-TODAY Cybrosys Technologies() +# Author: Cybrosys Techno Solutions() +# +# You can modify it under the terms of the GNU LESSER +# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. +# +# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE +# (LGPL v3) along with this program. +# If not, see . +# +############################################################################# +import os +import io, requests +from openpyxl import load_workbook +import re +import binascii +import tempfile +from odoo import models, fields, _ +import csv +import base64 +from odoo.exceptions import UserError + + +class ImportVariant(models.TransientModel): + """Wizard for selecting the imported Files""" + _name = 'import.product.variant' + _description = "Import Product Variants" + + import_file = fields.Selection( + [('csv', 'CSV File'), ('excel', 'Excel File')], required=True, + string="Import FIle", help="Import the files") + method = fields.Selection([('create', 'Create Product'), + ('update', 'Update Product'), ( + 'update_product', + 'Update Product Variant'), ], + string="Method", required=True, + help="Method for importing/Exporting") + file = fields.Binary(string="File", required=True, + help="The file to upload") + + def action_import_product_variant(self): + """This is used to import/export the product """ + try: + global list, detailed, invoicing_type + link = False + if self.import_file == 'excel': + try: + file_pointer = tempfile.NamedTemporaryFile(delete=False, + suffix=".xlsx") + file_pointer.write(binascii.a2b_base64(self.file)) + file_pointer.seek(0) + workbook = load_workbook(filename=file_pointer.name) + sheet = workbook['Sheet1'] + except: + raise UserError(_("File not Valid")) + for index, row in enumerate(sheet.iter_rows(values_only=True)): + if index == 0: + continue # Skip the first row + # if rec >= 1: + if row: + row_vals = row + if len(row_vals) < int(24): + raise UserError( + _("Please ensure that you selected " + "the correct file")) + product_category = self.env['product.category'].search( + [('complete_name', '=', row_vals[6])]).id + if product_category: + category = product_category + else: + category = self.env['product.category'].create({ + 'name': row_vals[6].split('/')[0], + 'complete_name': row_vals[6] + }) + category = category.id + product_uom = self.env['uom.uom'].search( + [('name', '=', row_vals[7])]).id + if product_uom: + uom = product_uom + else: + raise UserError(_("Invalid uom")) + pro_uom = self.env['uom.uom'].search( + [('name', '=', row_vals[8])]).id + if pro_uom: + po_uom = pro_uom + else: + raise UserError(_("Invalid Purchase uom")) + + def calculate_tax_value(val): + if isinstance(val, float) and val < 1: + return val * 100, f"{val * 100}%" + return val, val + + def create_tax_record(name, amount, tax_type): + match = re.search(r'\d+', name) + amount = int(match.group()) if match else amount + return self.env['account.tax'].create({ + 'name': name, + 'amount': amount, + 'type_tax_use': tax_type, + }).id + + account_val, account_name = calculate_tax_value( + row_vals[9]) + supp_val, supp_name = calculate_tax_value(row_vals[10]) + + account_tax = self.env['account.tax'].search( + [('name', '=', account_name), + ('type_tax_use', '=', 'sale')]).id + supp_tax = self.env['account.tax'].search( + [('name', '=', supp_name), + ('type_tax_use', '=', 'purchase')]).id + + tax = account_tax if account_tax else create_tax_record( + account_name, account_val, 'sale') + supplier_tax = supp_tax if supp_tax else create_tax_record( + supp_name, supp_val, 'purchase') + + kay_val_dict = dict( + self.env['product.template']._fields[ + 'type'].selection) + # here 'type' is field name + for key, val in kay_val_dict.items(): + if val == row_vals[5]: + detailed = key + kay_val_dict = dict( + self.env['product.template']._fields[ + 'invoice_policy'].selection) + # here 'type' is field name + for key, val in kay_val_dict.items(): + if val == row_vals[12]: + invoicing_type = key + if "http://" in row_vals[23] or "https://" in row_vals[ + 23]: + link = base64.b64encode( + requests.get( + row_vals[23].strip()).content).replace( + b"\n", b"") + elif "/home" in row_vals[23]: + if os.path.exists(row_vals[23]): + with open(row_vals[23], 'rb') as image_file: + link = base64.b64encode(image_file.read()) + if not row_vals[2] or not row_vals[18]: + raise UserError(_("File Must Contain Internal " + "Reference or Barcode of the " + "Product")) + if self.method == 'update': + vals = { + 'default_code': row_vals[2], + 'name': row_vals[1], + 'image_1920': link, + 'sale_ok': row_vals[3], + 'purchase_ok': row_vals[4], + 'type': detailed, + 'categ_id': category, + 'uom_id': uom, + 'uom_po_id': po_uom, + 'taxes_id': [tax], + 'supplier_taxes_id': [supplier_tax], + 'description_sale': row_vals[11], + 'invoice_policy': invoicing_type, + 'list_price': row_vals[13], + 'standard_price': row_vals[14], + 'weight': row_vals[19], + 'volume': row_vals[20], + } + if link: + vals.update({'image_1920': link}) + product = self.env['product.template'].search( + [('barcode', '=', row_vals[18])]) + if product: + product.write(vals) + else: + product = self.env['product.template'].search( + [('default_code', '=', row_vals[2])]) + if product: + product.write(vals) + else: + raise UserError( + _("Please ensure that product " + "having the" + "contains Internal reference or " + "Barcode to with your file")) + else: + if self.method == 'update_product': + vals = { + 'default_code': row_vals[2], + 'name': row_vals[1], + 'image_1920': link, + 'sale_ok': row_vals[3], + 'purchase_ok': row_vals[4], + 'type': detailed, + 'categ_id': category, + 'uom_id': uom, + 'uom_po_id': po_uom, + 'taxes_id': [tax], + 'supplier_taxes_id': [supplier_tax], + 'supplier_taxes_id': [(6, 0, [supplier_tax])], + 'description_sale': row_vals[11], + 'invoice_policy': invoicing_type, + 'lst_price': row_vals[13], + 'standard_price': row_vals[14], + 'weight': row_vals[19], + 'volume': row_vals[20], + } + if link: + vals.update({'image_1920': link}) + product = self.env['product.product'].search( + [('barcode', '=', row_vals[18])]) + if product: + product.write(vals) + else: + product = self.env[ + 'product.product'].search( + [('default_code', '=', row_vals[2])]) + if product: + product.write(vals) + else: + raise UserError( + _("Please ensure that product " + "having the" + "contains Internal reference or " + "Barcode to with your file.")) + else: + vals = { + 'default_code': row_vals[2], + 'name': row_vals[1], + 'image_1920': link, + 'sale_ok': row_vals[3], + 'purchase_ok': row_vals[4], + 'type': detailed, + 'categ_id': category, + 'uom_id': uom, + 'uom_po_id': po_uom, + 'taxes_id': [tax], + 'supplier_taxes_id': [supplier_tax], + 'description_sale': row_vals[11], + 'invoice_policy': invoicing_type, + 'list_price': row_vals[13], + 'standard_price': row_vals[14], + 'weight': row_vals[19], + 'volume': row_vals[20], + + } + product = self.env['product.template'].create( + vals) + values = [] + for row_val in row_vals[15].split(','): + pr_attribute = self.env['product.attribute'].search( + [('name', '=', row_val)]).id + if pr_attribute: + attribute = pr_attribute + else: + raise UserError( + _("Please update a valid attribute and " + "values")) + values.append({'attribute': attribute}) + for row in row_vals[16].split(','): + attri_values = self.env[ + 'product.attribute.value'].search( + [('attribute_id', '=', attribute), + ('name', '=', row)]).ids + if len(attri_values) != 0: + values.extend({attri_values[0]}) + variant = {} + mylist = [] + for val in values: + if isinstance(val, dict): + variant = val + variant['attribut_value'] = [] + else: + variant['attribut_value'].extend([val]) + if variant in mylist: + pass + else: + mylist.append(variant) + for lst in mylist: + val = { + 'product_tmpl_id': product.id, + 'attribute_id': lst['attribute'], + 'value_ids': lst['attribut_value'], + } + self.env['product.template.attribute.line'].create( + val) + elif self.import_file == 'csv': + keys = ['Unique Identifier', 'Name', 'Internal Reference', + 'Can be sold', 'Can be Purchased', 'Product Type', + 'Category', 'Unit of Measure', + 'Purchase Unit of Measure', + 'Customer Taxes', 'Vendor Taxes', + 'Description for customers', 'Invoicing Policy', + 'Sales Price', 'Cost', 'Variant Attributes', + 'Attribute Values', 'Internal Reference', 'Barcode', + 'Weight', 'Volume', 'Qty On hand', + 'Responsible', 'image', 'Char', 'Many2many', 'Many2one', + 'Integer'] + try: + files = base64.b64decode(self.file) + data = io.StringIO(files.decode("utf-8")) + data.seek(0) + file_reader = [] + csv_reader = csv.reader(data, delimiter=',') + file_reader.extend(csv_reader) + except: + raise UserError(_("File not Valid")) + for file in range(len(file_reader)): + field = list(map(str, file_reader[file])) + values = dict(zip(keys, field)) + if file >= 1: + pro_categ = self.env['product.category'].search( + [('complete_name', '=', values['Category'])]).id + if pro_categ: + pro_category = pro_categ + else: + category = self.env['product.category'].create({ + 'name': values['Category'] + }) + pro_category = category.id + unit_uom = self.env['uom.uom'].search( + [('name', '=', values['Unit of Measure'])]).id + if unit_uom: + uom = unit_uom + else: + raise UserError(_("Invalid uom")) + po_uoms = self.env['uom.uom'].search( + [('name', '=', + values['Purchase Unit of Measure'])]).id + if po_uoms: + po_uom = po_uoms + else: + raise UserError(_("Invalid Product Uom")) + def calculate_tax_value(val): + if isinstance(val, float) and val < 1: + return val * 100, f"{val * 100}%" + return val, val + + def create_tax_record(name, amount, tax_type): + match = re.search(r'\d+', name) + amount = int(match.group()) if match else amount + return self.env['account.tax'].create({ + 'name': name, + 'amount': amount, + 'type_tax_use': tax_type, + }).id + + account_val, account_name = calculate_tax_value( + values['Customer Taxes']) + supp_val, supp_name = calculate_tax_value(values['Vendor Taxes']) + + account_tax = self.env['account.tax'].search( + [('name', '=', account_name), + ('type_tax_use', '=', 'sale')]).id + supp_tax = self.env['account.tax'].search( + [('name', '=', supp_name), + ('type_tax_use', '=', 'purchase')]).id + + tax = account_tax if account_tax else create_tax_record( + account_name, account_val, 'sale') + supplier_tax = supp_tax if supp_tax else create_tax_record( + supp_name, supp_val, 'purchase') + + kay_val_dict = dict( + self.env['product.template']._fields[ + 'type'].selection) # here 'type' is field name + for key, val in kay_val_dict.items(): + if val == values['Product Type']: + detailed = key + kay_val_dict = dict( + self.env['product.template']._fields[ + 'invoice_policy'].selection) # here 'type' is field name + for key, val in kay_val_dict.items(): + if val == values['Invoicing Policy']: + invoicing_type = key + if "http://" in values['image'] or "https://" in values[ + 'image']: + link = base64.b64encode(requests.get( + values['image'].strip()).content).replace(b"\n", + b"") + elif "/home" in values['image']: + if os.path.exists(values['image']): + with open(values['image'], 'rb') as file_image: + link = base64.b64encode(file_image.read()) + + if file_reader[0][24] or file_reader[0][25] or \ + file_reader[0][26]: + model = self.env['ir.model']._get_id( + 'product.template') + self.env['ir.model.fields'].create({ + 'model_id': model, + 'name': file_reader[0][24], + 'field_description': + file_reader[0][24].split('_')[ + 2].upper(), + 'ttype': file_reader[0][24].split('_')[1], + }) + inherit_id = self.env.ref( + 'product.product_template_only_form_view') + arch_base = _('' + '' + '' + '' + '' + '') % ( + 'type', 'after', + file_reader[0][24]) + self.env['ir.ui.view'].sudo().create( + {'name': 'product.dynamic.fields', + 'type': 'form', + 'model': 'product.template', + 'mode': 'extension', + 'inherit_id': inherit_id.id, + 'arch_base': arch_base, + 'active': True}) + self.env['ir.model.fields'].create({ + 'model_id': model, + 'name': file_reader[0][25], + 'field_description': + file_reader[0][25].split('_')[ + 2].upper(), + 'relation': values['Many2many'].split(':')[0], + 'ttype': file_reader[0][25].split('_')[1], + }) + inherit_id = self.env.ref( + 'product.product_template_only_form_view') + arch_base = _('' + '' + '' + '' + '' + '') % ( + 'avatax_category_id', 'after', + file_reader[0][25], + 'many2many_tags') + self.env['ir.ui.view'].sudo().create( + {'name': 'product.many2many.fields', + 'type': 'form', + 'model': 'product.template', + 'mode': 'extension', + 'inherit_id': inherit_id.id, + 'arch_base': arch_base, + 'active': True}) + val = values['Many2many'].split(':')[0] + partner = [ + values['Many2many'].split(':')[1].split(',')] + vals_many = [] + for part in partner[0]: + many2many = self.env[val].search( + [('name', '=', part)]).id + if many2many: + vals_many.append(many2many) + else: + partner = self.env[val].create({ + 'name': part, + }) + vals_many.append(partner) + self.env['ir.model.fields'].create({ + 'model_id': model, + 'name': file_reader[0][26], + 'field_description': + file_reader[0][26].split('_')[ + 2].upper(), + 'relation': values['Many2one'].split(':')[0], + 'ttype': file_reader[0][26].split('_')[1], + }) + inherit_id = self.env.ref( + 'product.product_template_only_form_view') + arch_base = _('' + '' + '' + '' + '' + '') % ( + 'categ_id', 'after', + file_reader[0][26], + 'many2one_tags') + self.env['ir.ui.view'].sudo().create( + {'name': 'product.many2one.fields', + 'type': 'form', + 'model': 'product.template', + 'mode': 'extension', + 'inherit_id': inherit_id.id, + 'arch_base': arch_base, + 'active': True}) + many2one = values['Many2one'].split(':')[0] + value = [values['Many2one'].split(':')[1]] + vals_one = [] + for vals in value: + many2one_value = self.env[many2one].search( + [('name', '=', vals)]).id + if many2one_value: + vals_one.append(many2one_value) + else: + value = self.env[many2one].create({ + 'name': vals, + }) + vals_one.append(value) + if not values['Internal Reference'] or not values[ + 'Barcode']: + raise UserError( + _("File Must Contain Internal Reference " + "or Barcode of the Product")) + if self.method == 'update': + vals = { + 'default_code': values[ + 'Internal Reference'] if + values['Internal Reference'] else False, + 'name': values['Name'], + 'image_1920': link, + 'sale_ok': values['Can be sold'], + 'purchase_ok': values['Can be Purchased'], + 'type': detailed, + 'categ_id': pro_category, + 'uom_id': uom, + 'uom_po_id': po_uom, + 'barcode': values['Barcode'] if values[ + 'Barcode'] else False, + 'taxes_id': [tax], + 'supplier_taxes_id': [supplier_tax], + 'description_sale': values[ + 'Description for customers'], + 'invoice_policy': invoicing_type, + 'list_price': values['Sales Price'], + 'standard_price': values['Cost'], + 'weight': values['Weight'], + 'volume': values['Volume'], + } + if link: + vals.update({'image_1920': link}) + product = self.env[ + 'product.template'].search( + [('barcode', '=', values['Barcode'])]) + if len(product): + product.write(vals) + else: + product = self.env[ + 'product.template'].search( + [('default_code', '=', + values['Internal Reference'])]) + if product: + product.write(vals) + else: + raise UserError( + _("Please ensure that product " + "having the" + "contains Internal reference or " + "Barcode to with your file.")) + elif self.method == 'update_product': + vals = { + 'default_code': values[ + 'Internal Reference'] if + values['Internal Reference'] else False, + 'name': values['Name'], + 'image_1920': link, + 'sale_ok': values['Can be sold'], + 'purchase_ok': values['Can be Purchased'], + 'type': detailed, + 'categ_id': pro_category, + 'uom_id': uom, + 'uom_po_id': po_uom, + 'barcode': values['Barcode'] if values[ + 'Barcode'] else False, + 'taxes_id': [tax], + 'supplier_taxes_id': [supplier_tax], + 'description_sale': values[ + 'Description for customers'], + 'invoice_policy': invoicing_type, + 'lst_price': values['Sales Price'], + 'standard_price': values['Cost'], + 'weight': values['Weight'], + 'volume': values['Volume'], + } + if link: + vals.update({'image_1920': link}) + product = self.env[ + 'product.product'].search( + [('barcode', '=', values['Barcode'])]) + if len(product): + product.write(vals) + else: + product = self.env[ + 'product.product'].search( + [('default_code', '=', + values['Internal Reference'])]) + if product: + product.write(vals) + else: + raise UserError( + _("Please ensure that product " + "having the" + "contains Internal reference or " + "Barcode to with your file.")) + else: + vals = { + 'default_code': values[ + 'Internal Reference'] if + values['Internal Reference'] else False, + 'name': values['Name'], + 'image_1920': link, + 'sale_ok': values['Can be sold'], + 'purchase_ok': values['Can be Purchased'], + 'type': detailed, + 'categ_id': pro_category, + 'uom_id': uom, + 'uom_po_id': po_uom, + 'barcode': values['Barcode'] if values[ + 'Barcode'] else False, + 'taxes_id': [tax], + 'supplier_taxes_id': [supplier_tax], + 'description_sale': values[ + 'Description for customers'], + 'invoice_policy': invoicing_type, + 'list_price': values['Sales Price'], + 'standard_price': values['Cost'], + 'weight': values['Weight'], + 'volume': values['Volume'], + } + product = self.env['product.template'].create(vals) + product.write({ + file_reader[0][24]: values['Char'], + file_reader[0][25]: vals_many[0], + file_reader[0][26]: vals_one[0], + }) + attribute_values = [] + for val_attribute in values[ + 'Variant Attributes'].split(','): + attributes = self.env[ + 'product.attribute'].search( + [('name', '=', val_attribute)]).id + if attributes: + attribute = attributes + else: + raise UserError( + _("Please add a valid attribute and " + "their values")) + attribute_values.append( + {'attribute': attribute}) + for value in values['Attribute Values'].split( + ','): + attri_values = self.env[ + 'product.attribute.value'].search( + [('attribute_id', '=', attribute), + ('name', '=', value)]).ids + if len(attri_values) != 0: + attribute_values.extend( + {attri_values[0]}) + variant = {} + mylist = [] + for attribute in attribute_values: + if isinstance(attribute, dict): + variant = attribute + variant['attribut_value'] = [] + else: + variant['attribut_value'].extend( + [attribute]) + if variant in mylist: + pass + else: + mylist.append(variant) + for list in mylist: + val = { + 'product_tmpl_id': product.id, + 'attribute_id': list['attribute'], + 'value_ids': list['attribut_value'], + } + self.env[ + 'product.template.attribute.line'].create( + val) + return { + 'type': 'ir.actions.client', + 'tag': 'reload', + } + except UserError as e: + raise UserError(str(e)) diff --git a/product_variant_import/wizards/import_product_variant_views.xml b/product_variant_import/wizards/import_product_variant_views.xml new file mode 100644 index 000000000..b2213fa8a --- /dev/null +++ b/product_variant_import/wizards/import_product_variant_views.xml @@ -0,0 +1,43 @@ + + + + + Product Variant + ir.actions.act_window + import.product.variant + form + new + + + + import.product.variant.view.form + import.product.variant + form + +
+ + + + + + + +
+
+
+
+
+ + + + +