@ -0,0 +1,75 @@ |
|||
# Instant Import for Odoo 17 |
|||
|
|||
[](https://www.odoo.com) |
|||
[](https://opensource.org/licenses/MIT) |
|||
|
|||
|
|||
## Overview |
|||
|
|||
The Instant Import module is an Odoo extension that streamlines the data import |
|||
process by providing a user-friendly interface built with OWL. It lets users |
|||
test and import Excel data into any model with validation, error feedback, and |
|||
smooth record creation. Designed for performance, the module ensures that large |
|||
volumes of data are imported quickly and efficiently. |
|||
|
|||
## Features |
|||
|
|||
- Features |
|||
- **Fast Data Import**: Quickly import large volumes of records from Excel files into any Odoo model. |
|||
- **Real-Time Validation**: Instantly checks for field mismatches or errors before importing. |
|||
- **OWL-Based Interface**: Modern and responsive UI built with Odoo Web Library (OWL) for smooth user experience. |
|||
- **Seamless Record Creation**: Automatically creates records without navigating away from the current view. |
|||
## Screenshots |
|||
|
|||
Here are some glimpses of Odoo Instant Import: |
|||
|
|||
### Sales module |
|||
|
|||
<div> |
|||
<tr> |
|||
<td align="center"> |
|||
<img src="static/description/assets/screenshots/instant_import_01.png" alt="step 1" width="500" style="border: none;"/> |
|||
</td> |
|||
</tr> |
|||
</div> |
|||
<div> |
|||
<tr> |
|||
<td align="center"> |
|||
<img src="static/description/assets/screenshots/instant_import_02.png" alt="step 2" width="500" style="border: none;"/> |
|||
</td> |
|||
</tr> |
|||
</div> |
|||
<div> |
|||
<tr> |
|||
<td align="center"> |
|||
<img src="static/description/assets/screenshots/instant_import_03.png" alt="step 3" width="500" style="border: none;"/> |
|||
</td> |
|||
</tr> |
|||
</div> |
|||
<div> |
|||
<tr> |
|||
<td align="center"> |
|||
<img src="static/description/assets/screenshots/instant_import_04.png" alt="step 4" width="500" style="border: none;"/> |
|||
</td> |
|||
</tr> |
|||
</div> |
|||
<div> |
|||
<tr> |
|||
<td align="center"> |
|||
<img src="static/description/assets/screenshots/instant_import_05.png" alt="step 5" width="500" style="border: none;"/> |
|||
</td> |
|||
</tr> |
|||
</div> |
|||
<div> |
|||
<tr> |
|||
<td align="center"> |
|||
<img src="static/description/assets/screenshots/instant_import_06.png" alt="step 6" width="500" style="border: none;"/> |
|||
</td> |
|||
</tr> |
|||
</div> |
|||
|
|||
## Prerequisites |
|||
|
|||
Before you begin, ensure you have the following installed: |
|||
|
|||
- An active Odoo Community/Enterprise Edition instance (local or hosted) |
|||
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import wizard |
|||
from .hooks import setup_db_level_functions, delete_contact |
|||
@ -0,0 +1,50 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
{ |
|||
'name': 'Instant Import', |
|||
'version': '17.0.1.0.0', |
|||
'depends': ['base', 'web', 'base_import'], |
|||
'category': 'Tools', |
|||
'summary': 'Module for fast bulk imports using PostgreSQL COPY', |
|||
'author': "Cybrosys Techno Solutions", |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': "https://www.cybrosys.com", |
|||
'application': False, |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
], |
|||
'assets': { |
|||
'web.assets_backend': [ |
|||
'instant_import/static/src/js/import_component.js', |
|||
'instant_import/static/src/js/import_component.xml', |
|||
'instant_import/static/src/js/instant_import.js', |
|||
'instant_import/static/src/js/templates.xml', |
|||
], |
|||
}, |
|||
'images': [ |
|||
'static/description/banner.jpg', |
|||
], |
|||
'license': 'LGPL-3', |
|||
'post_init_hook': 'setup_db_level_functions', |
|||
'uninstall_hook': 'delete_contact', |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
## Module <custom_import> |
|||
|
|||
#### 17.07.2025 |
|||
#### Version 17.0.1.0.0 |
|||
##### ADD |
|||
|
|||
- Initial Commit for Custom Import |
|||
@ -0,0 +1,134 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
def setup_db_level_functions(env): |
|||
env.cr.execute( |
|||
""" |
|||
CREATE OR REPLACE FUNCTION process_m2m_mapping() |
|||
RETURNS TRIGGER AS $$ |
|||
DECLARE |
|||
col record; |
|||
value_array text[]; |
|||
single_value text; |
|||
id1 integer; |
|||
id2 integer; |
|||
dynamic_sql text; |
|||
mapping_config jsonb; |
|||
column_type text; |
|||
field_config jsonb; |
|||
BEGIN |
|||
-- Get the mapping configuration from TG_ARGV[0] |
|||
-- Expected format: |
|||
-- { |
|||
-- "m2m__field1": {"data_table": "table1", "mapping_table": "map1", "column1": "col1", "column2": "col2"}, |
|||
-- "m2m__field2": {"data_table": "table2", "mapping_table": "map2", "column1": "col3", "column2": "col4"} |
|||
-- } |
|||
mapping_config := TG_ARGV[0]::jsonb; |
|||
|
|||
-- Loop through all columns of the table |
|||
FOR col IN ( |
|||
SELECT column_name |
|||
FROM information_schema.columns |
|||
WHERE table_name = TG_TABLE_NAME::text |
|||
AND column_name LIKE 'm2m__%' |
|||
) LOOP |
|||
-- Get configuration for this m2m field |
|||
field_config := mapping_config->col.column_name; |
|||
|
|||
IF field_config IS NOT NULL THEN |
|||
-- Only process if the column has a value |
|||
EXECUTE format('SELECT $1.%I', col.column_name) USING NEW INTO dynamic_sql; |
|||
IF dynamic_sql IS NOT NULL THEN |
|||
-- Get the ID from the currently triggered table |
|||
id1 := NEW.id; |
|||
|
|||
-- Get the data type of the name column |
|||
EXECUTE format( |
|||
'SELECT data_type |
|||
FROM information_schema.columns |
|||
WHERE table_name = %L |
|||
AND column_name = ''name''', |
|||
field_config->>'data_table' |
|||
) INTO column_type; |
|||
|
|||
-- Split the m2m values |
|||
value_array := string_to_array(dynamic_sql, ','); |
|||
|
|||
-- Process each value in the array |
|||
FOREACH single_value IN ARRAY value_array LOOP |
|||
-- Get the ID from the related table based on column type |
|||
IF column_type = 'jsonb' THEN |
|||
EXECUTE format( |
|||
'SELECT id FROM %I WHERE (name->>''en_US'' = %L OR name->>''fr_FR'' = %L)', |
|||
field_config->>'data_table', |
|||
TRIM(single_value), |
|||
TRIM(single_value) |
|||
) INTO id2; |
|||
|
|||
-- If not found, try searching without language code |
|||
IF id2 IS NULL THEN |
|||
EXECUTE format( |
|||
'SELECT id FROM %I WHERE (name->''en_US'' ? %L OR name->''fr_FR'' ? %L)', |
|||
field_config->>'data_table', |
|||
TRIM(single_value), |
|||
TRIM(single_value) |
|||
) INTO id2; |
|||
END IF; |
|||
ELSE |
|||
-- For text type |
|||
EXECUTE format( |
|||
'SELECT id FROM %I WHERE name = %L', |
|||
field_config->>'data_table', |
|||
TRIM(single_value) |
|||
) INTO id2; |
|||
END IF; |
|||
|
|||
-- Insert into mapping table if both IDs are found |
|||
IF id1 IS NOT NULL AND id2 IS NOT NULL THEN |
|||
EXECUTE format( |
|||
'INSERT INTO %I (%I, %I) |
|||
VALUES (%L, %L) |
|||
ON CONFLICT (%I, %I) DO NOTHING', |
|||
field_config->>'mapping_table', |
|||
field_config->>'column1', |
|||
field_config->>'column2', |
|||
id1, id2, |
|||
field_config->>'column1', |
|||
field_config->>'column2' |
|||
); |
|||
END IF; |
|||
END LOOP; |
|||
END IF; |
|||
END IF; |
|||
END LOOP; |
|||
|
|||
RETURN NEW; |
|||
END; |
|||
$$ LANGUAGE plpgsql; |
|||
""" |
|||
) |
|||
|
|||
def delete_contact(env): |
|||
env.cr.execute( |
|||
""" |
|||
DROP FUNCTION IF EXISTS process_m2m_mapping(); |
|||
""" |
|||
) |
|||
|
|
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: 383 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: 1.0 MiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 544 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 91 KiB |
|
After Width: | Height: | Size: 212 KiB |
|
After Width: | Height: | Size: 309 KiB |
|
After Width: | Height: | Size: 208 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 299 KiB |
|
After Width: | Height: | Size: 880 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,927 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8"/> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
|||
<title>Instant Import</title> |
|||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" |
|||
rel="stylesheet"/> |
|||
<link rel="preconnect" href="https://fonts.googleapis.com"> |
|||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
|||
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" |
|||
rel="stylesheet"> |
|||
<link rel="stylesheet" |
|||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"/> |
|||
<link rel="stylesheet" |
|||
href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css"/> |
|||
<style> |
|||
:root { |
|||
--primary-color: #7f54b3; |
|||
--bg-white: #fff; |
|||
--text-color: #121212; |
|||
--text-color-light: #64728f; |
|||
} |
|||
|
|||
body { |
|||
font-family: "Montserrat", sans-serif; |
|||
} |
|||
|
|||
.nav-tabs .nav-item.show .nav-link, .nav-tabs .nav-link.active { |
|||
color: #121212; |
|||
font-family: Montserrat; |
|||
font-size: 16px !important; |
|||
font-weight: 500 !important; |
|||
border-radius: 30px; |
|||
line-height: normal; |
|||
text-transform: capitalize; |
|||
background-color: #F5F5F5; |
|||
border: none; |
|||
margin-bottom: 0; |
|||
padding: 12px 24px; |
|||
} |
|||
|
|||
.nav-tabs .nav-link:focus, .nav-tabs .nav-link:hover { |
|||
border-color: transparent; |
|||
isolation: isolate; |
|||
} |
|||
|
|||
.nav-tabs .nav-link:focus-visible { |
|||
border-color: transparent; |
|||
box-shadow: none; |
|||
} |
|||
|
|||
/* owl-carosel */ |
|||
.owl-carousel .owl-nav { |
|||
position: absolute; |
|||
top: 42%; |
|||
width: 100%; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
transform: translateY(-42%); |
|||
} |
|||
|
|||
.owl-carousel .owl-nav button.owl-prev { |
|||
position: absolute; |
|||
right: -36px; |
|||
font-size: 28px; |
|||
background-color: #e4e4e4; |
|||
border-radius: 20px; |
|||
width: 40px; |
|||
height: 40px; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
} |
|||
|
|||
.owl-carousel .owl-nav button.owl-next { |
|||
position: absolute; |
|||
left: -36px; |
|||
font-size: 28px; |
|||
background-color: #e4e4e4; |
|||
border-radius: 20px; |
|||
width: 40px; |
|||
height: 40px; |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
|
|||
} |
|||
|
|||
</style> |
|||
</head> |
|||
<body> |
|||
<!-- overview --> |
|||
<div class="container"> |
|||
<div class="my-5"> |
|||
<!-- button tab --> |
|||
<!-- --> |
|||
<!-- version support --> |
|||
<div class="my-3 d-flex align-items-center justify-content-end"> |
|||
<div class="text-center" |
|||
style="background-color:#017E84 !important; font-size:0.8rem !important; color:#fff !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important; min-width:120px !important"> |
|||
Community |
|||
</div> |
|||
<div class="text-center" |
|||
style="background-color:#875A7B !important; color:#fff !important; font-size:0.8rem !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important; min-width:120px !important"> |
|||
Enterprise |
|||
</div> |
|||
<div class="text-center" |
|||
style="background-color:#7C7BAD !important; color:#fff !important; font-size:0.8rem !important; font-weight:500 !important; padding:4px !important; margin:0 3px !important; border-radius:50px !important; min-width:120px !important"> |
|||
Odoo.sh |
|||
</div> |
|||
</div> |
|||
<div class="tab-content" id="myTabContent"> |
|||
<!-- description --> |
|||
<div class="tab-pane fade show active" id="home" role="tabpanel" |
|||
aria-labelledby="home-tab"> |
|||
<div class="position-relative" |
|||
style="border-radius: 16px; background: #f8f8f8; padding: 20px 0;"> |
|||
<div class="row " style=" |
|||
padding: 2rem 0rem 0 !important; |
|||
"> |
|||
<div class="col-lg-8 mx-auto gap-4 d-flex flex-column align-items-center"> |
|||
<p class="my-1 text-center text-uppercase" |
|||
style=" |
|||
letter-spacing: 4px !important; |
|||
color: #7f54b3; |
|||
font-weight: bold; |
|||
text-align: center; |
|||
font-size: 14px; |
|||
font-weight: 600; |
|||
line-height: 15.96px; |
|||
text-transform: uppercase; |
|||
"> |
|||
Odoo Instant Import is a fast and user-friendly |
|||
module that allows you to import Excel data easily. |
|||
</p> |
|||
<h1 class="text-center text-uppercase my-0" |
|||
style=" |
|||
color: #121212; |
|||
font-size: 46px; |
|||
font-weight: 700; |
|||
line-height: normal; |
|||
">Instant Import</span> |
|||
</h1> |
|||
</div> |
|||
<div class="col-lg-12 d-flex justify-content-center align-items-center" |
|||
style="margin: 3rem 0;"> |
|||
<img src="./assets/icons/brand-pair.svg" |
|||
width="100%" |
|||
height="auto" |
|||
style="width: 50%" |
|||
class="img-responsive"/> |
|||
</div> |
|||
<div class="col-md-12 text-center"> |
|||
<a href="mailto:odoo@cybrosys.com" |
|||
target="_blank" |
|||
style="background-color: transparent;border-radius: 35px; |
|||
font-family: Montserrat; |
|||
display: inline-block; |
|||
padding: 7px 33px; |
|||
border: 1px solid #7f54b3; |
|||
color: #7f54b3; |
|||
text-decoration: none; |
|||
" |
|||
class="mx-1 mb-2 deep-1 deep_hover"> |
|||
<img class="img" |
|||
style="width: 24px" |
|||
src="./assets/icons/mail.svg"/> |
|||
<span |
|||
class="pl-2" |
|||
style=" font-size: 16px; vertical-align: middle" |
|||
>Email Us</span |
|||
> |
|||
</a> |
|||
<a href="skype:cybroopenerp?chat" |
|||
target="_blank" |
|||
style=" |
|||
background-color: #7f289b; |
|||
font-family: Montserrat; |
|||
display: inline-block; |
|||
padding: 7px 33px; |
|||
border: 1px solid #7f289b; |
|||
border-radius: 35px; |
|||
text-decoration: none; |
|||
" |
|||
class="mx-1 mb-2 deep-1 deep_hover"> |
|||
<img |
|||
class="img" |
|||
style="width: 24px" |
|||
src="./assets/icons/skype-fill.svg" |
|||
/> |
|||
<span |
|||
class="pl-2" |
|||
style="color: #fff; font-size: 16px; vertical-align: middle" |
|||
>Skype Us</span |
|||
> |
|||
</a> |
|||
</div> |
|||
<div class="d-flex justify-content-center mt-2"> |
|||
<img src="./assets/screenshots/Gif.gif" |
|||
class="w-100" |
|||
style="z-index: 3; height: auto;"> |
|||
</div> |
|||
</div> |
|||
<div class="position-absolute bottom-0" |
|||
style="z-index: 1; width: 100%;"> |
|||
<img src="./assets/icons/banner-bg.svg" |
|||
class="img-fluid w-100"> |
|||
</div> |
|||
<div class="position-absolute bottom-0 end-0" |
|||
style=" z-index: 2;"> |
|||
<img src="./assets/icons/patter.svg"> |
|||
</div> |
|||
</div> |
|||
<!-- key-highlight --> |
|||
<div class="" style="border-radius: 16px; |
|||
padding: 60px 40px; |
|||
border: 1px solid #EBEEF2; |
|||
background: #F5F5F7; |
|||
box-shadow: 0px 5px 20px -11px rgba(0, 0, 0, 0.25); "> |
|||
<div class="row"> |
|||
<div class="col-lg-12 d-flex flex-column justify-content-center align-items-center"> |
|||
<h2 style=" color: #121212; |
|||
text-align: center; |
|||
font-size: 40px; |
|||
font-weight: 700; |
|||
text-transform: uppercase; padding-bottom: 50px;">Key |
|||
Highlights</h2> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<div class="mb-4 d-flex flex-column justify-content-center gap-3" |
|||
style="border-radius: 12px; border: 1px solid #B6BCCD; |
|||
background: #FFF;padding:32px "> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#7847D9 !important; border-radius:8px !important; height:42px; width:42px"> |
|||
<img src="./assets/icons/feature-icon.svg" |
|||
class="img-responsive" height="26px" |
|||
width="26px"> |
|||
</div> |
|||
<h5 class="m-0" |
|||
style="color:#000 !important; font-weight:bold"> |
|||
Fast Data Import. |
|||
</h5> |
|||
<p class="m-0" |
|||
style="font-size:0.9rem; color:#64728f; font-size: 16px; font-weight: 400;"> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<div class="mb-4 d-flex flex-column justify-content-center gap-3" |
|||
style="border-radius: 12px; |
|||
border: 1px solid #B6BCCD; |
|||
background: #FFF;padding:32px "> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#7847D9 !important; border-radius:8px !important; height:42px; width:42px"> |
|||
<img src="./assets/icons/feature-icon.svg" |
|||
class="img-responsive" height="26px" |
|||
width="26px"> |
|||
</div> |
|||
<h5 class="m-0" |
|||
style="color:#000 !important; font-weight:bold"> |
|||
Real-Time Validation. |
|||
</h5> |
|||
<p class="m-0" |
|||
style="font-size:0.9rem; color:#64728f; font-size: 16px; font-weight: 400;"> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<div class="mb-4 d-flex flex-column justify-content-center gap-3" |
|||
style="border-radius: 12px; |
|||
border: 1px solid #B6BCCD; |
|||
background: #FFF;padding:32px "> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#7847D9 !important; border-radius:8px !important; height:42px; width:42px"> |
|||
<img src="./assets/icons/feature-icon.svg" |
|||
class="img-responsive" height="26px" |
|||
width="26px"> |
|||
</div> |
|||
<h5 class="m-0" |
|||
style="color:#000 !important; font-weight:bold"> |
|||
OWL-Based Interface. |
|||
Seamless Record Creation. |
|||
</h5> |
|||
<p class="m-0" |
|||
style="font-size:0.9rem; color:#64728f; font-size: 16px; font-weight: 400;"> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
<div class="col-lg-4"> |
|||
<div class="mb-4 d-flex flex-column justify-content-center gap-3" |
|||
style="border-radius: 12px; |
|||
border: 1px solid #B6BCCD; |
|||
background: #FFF;padding:32px "> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#7847D9 !important; border-radius:8px !important; height:42px; width:42px"> |
|||
<img src="./assets/icons/feature-icon.svg" |
|||
class="img-responsive" height="26px" |
|||
width="26px"> |
|||
</div> |
|||
<h5 class="m-0" |
|||
style="color:#000 !important; font-weight:bold"> |
|||
Seamless Record Creation. |
|||
</h5> |
|||
<p class="m-0" |
|||
style="font-size:0.9rem; color:#64728f; font-size: 16px; font-weight: 400;"> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!--code --> |
|||
<div class="my-5"> |
|||
<div class="position-relative" |
|||
style=" padding: 5rem 4rem 5rem 4rem; background-color: #0A1425; border-radius: 12px;"> |
|||
<div class="d-flex flex-column gap-4"> |
|||
<span class="wrapper-subtitle" |
|||
style="font-size: 40px; font-weight: 700; color: #fff;line-height: 60px; text-transform: capitalize; width: 450px; font-family: Montserrat;">Instant Import</span> |
|||
<h3 class="wrapper-details" |
|||
style="font-size: 20px; font-weight: 400; color: #fff; line-height: 32px; "> |
|||
Are you ready to make your business more |
|||
organized? |
|||
<br> Improve now! |
|||
</h3> |
|||
<div class="d-flex gap-3"> |
|||
<a href="mailto:odoo@cybrosys.com" |
|||
class="shop-btn" style="cursor: pointer; border-radius: 16px; display: flex; justify-content: center; align-items: center; gap: 7px; |
|||
border: 1px solid #ffffff33; |
|||
background-color: #ffffff14; |
|||
backdrop-filter: blur(10px); color: #fff; padding: 12px 16px 12px 16px; text-decoration: none;"> |
|||
<span style="border-radius: 12px; |
|||
background-color: #ffffff1a; |
|||
backdrop-filter: blur(6px);padding: 12px; "> |
|||
<img src="./assets/icons/banner-mail.svg"> |
|||
</span> |
|||
<span style="font-weight: 500;font-family: Montserrat;">odoo@cybrosys.com</span> |
|||
</a> |
|||
<a href="tel:+91 9074270811" class="shop-btn" |
|||
style="cursor: pointer; border-radius: 16px; display: flex; justify-content: center; align-items: center; gap: 7px; |
|||
border: 1px solid #ffffff33; |
|||
background-color: #ffffff14; |
|||
backdrop-filter: blur(10px); color: #fff; padding: 12px 22px 12px 18px; text-decoration: none;"> |
|||
<span style="border-radius: 12px; |
|||
background-color: #ffffff1a; |
|||
backdrop-filter: blur(6px);padding: 12px;"> |
|||
<img src="./assets/icons/banner-call.svg"> |
|||
</span> |
|||
<span style="font-weight: 500;font-family: Montserrat;">+91 9074270811</span> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="position-absolute bottom-0 end-0"> |
|||
<img src="./assets/icons/banner-pattern.svg" |
|||
style="width: 540px;"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- end-code --> |
|||
<!-- --> |
|||
<!-- screenshot and other --> |
|||
|
|||
<div class="mb-4 bg-white" |
|||
style=" border: 1px solid #EBEEF2; border-radius: 6px; box-shadow: 0px 8px 20px -4px rgba(0, 0, 0, 0.10); border: 1px solid #EBEEF2;"> |
|||
<div> |
|||
<ul class="nav nav-tabs justify-content-center bg-white py-2" |
|||
id="myTab" role="tablist" |
|||
style="border-radius: 6px 6px 0 0;"> |
|||
<li class="nav-item"> |
|||
<a aria-controls="overview" |
|||
aria-bs-selected="true" |
|||
class="nav-link active" data-bs-toggle="tab" |
|||
href="#overview" id="overview-tab" role="tab" |
|||
style="color:#121212; font-weight:500; font-size:16px"> |
|||
Screenshots</a> |
|||
</li> |
|||
<li class="nav-item"> |
|||
<a aria-controls="feature" |
|||
aria-bs-selected="false" |
|||
class="nav-link py-2" data-bs-toggle="tab" |
|||
href="#feature" id="feature-tab" role="tab" |
|||
style="color:#121212; font-weight:500; font-size:16px">Features</a> |
|||
</li> |
|||
<li class="nav-item"> |
|||
<a aria-controls="releases" |
|||
aria-bs-selected="false" class="nav-link" |
|||
data-bs-toggle="tab" href="#releases" |
|||
id="releases-tab" role="tab" |
|||
style="color:#121212; font-weight:500; font-size:16px">Releases</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
<div class="tab-content p-md-5 p-2 py-3" id="myTabContent2"> |
|||
<div aria-labelledby="overview-tab" |
|||
class="tab-pane fade show active" id="overview" |
|||
role="tabpanel"> |
|||
<div class="position-relative mb-4" |
|||
style="border-radius:10px"> |
|||
<img alt="acc_bg" |
|||
class="w-100 h-100 position-absolute img-fluid left_0" |
|||
loading="lazy" |
|||
src="//apps.odoocdn.com/apps/assets/17.0/ks_dashboard_ninja/ai-img/o3.png?007008f" |
|||
style=""> |
|||
</div> |
|||
<!-- screenshots section--> |
|||
<div class="position-relative mb-4" style="border-radius:10px; background-color:#f4f4f4"> |
|||
<div class="p-md-5 p-3 position-relative"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size:40px; font-weight:700;"> |
|||
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">Click on the action button in the view then click on the Instant import menu</span> |
|||
</h1> |
|||
</div> |
|||
<div class="col-md-12 text-center"> |
|||
<div class="d-inline-block p-3 shadow-sm" |
|||
style="background-color:#fff; border-radius:10px"> |
|||
<img alt="" class="img-fluid" |
|||
loading="lazy" |
|||
src="./assets/screenshots/instant_import_01.png" |
|||
style="min-height: 1px;"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="position-relative mb-4" |
|||
style="border-radius:10px; background-color:#f4f4f4"> |
|||
<div class="p-md-5 p-3 position-relative"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px; |
|||
font-weight: 700;"> |
|||
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">Upload the Data to be imported |
|||
</span> |
|||
</h1> |
|||
</div> |
|||
<div class="col-md-12 text-center"> |
|||
<div class="d-inline-block p-3 shadow-sm" |
|||
style="background-color:#fff; border-radius:10px"> |
|||
<img alt="" class="img-fluid" |
|||
loading="lazy" |
|||
src="./assets/screenshots/instant_import_02.png" |
|||
style="min-height: 1px;"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="position-relative mb-4" |
|||
style="border-radius:10px; background-color:#f4f4f4"> |
|||
<div class="p-md-5 p-3 position-relative"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px; |
|||
font-weight: 700;"> |
|||
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">Test the data by clicking the Test Button |
|||
</span> |
|||
</h1> |
|||
</div> |
|||
<div class="col-md-12 text-center"> |
|||
<div class="d-inline-block p-3 shadow-sm" |
|||
style="background-color:#fff; border-radius:10px"> |
|||
<img alt="" class="img-fluid" |
|||
loading="lazy" |
|||
src="./assets/screenshots/instant_import_03.png" |
|||
style="min-height: 1px;"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="position-relative mb-4" |
|||
style="border-radius:10px; background-color:#f4f4f4"> |
|||
<div class="p-md-5 p-3 position-relative"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px; |
|||
font-weight: 700;"> |
|||
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">Import the data by clicking on the Import Button |
|||
</span> |
|||
</h1> |
|||
</div> |
|||
<div class="col-md-12 text-center"> |
|||
<div class="d-inline-block p-3 shadow-sm" |
|||
style="background-color:#fff; border-radius:10px"> |
|||
<img alt="" class="img-fluid" |
|||
loading="lazy" |
|||
src="./assets/screenshots/instant_import_04.png" |
|||
style="min-height: 1px;"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="position-relative mb-4" |
|||
style="border-radius:10px; background-color:#f4f4f4"> |
|||
<div class="p-md-5 p-3 position-relative"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px; |
|||
font-weight: 700;"> |
|||
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">Data is being imported |
|||
</span> |
|||
</h1> |
|||
</div> |
|||
<div class="col-md-12 text-center"> |
|||
<div class="d-inline-block p-3 shadow-sm" |
|||
style="background-color:#fff; border-radius:10px"> |
|||
<img alt="" class="img-fluid" |
|||
loading="lazy" |
|||
src="./assets/screenshots/instant_import_05.png" |
|||
style="min-height: 1px;"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="position-relative mb-4" |
|||
style="border-radius:10px; background-color:#f4f4f4"> |
|||
<div class="p-md-5 p-3 position-relative"> |
|||
<div class="row"> |
|||
<div class="col-md-12"> |
|||
<h1 style="font-weight:bold; font-size:calc(1.1rem + 1vw); line-height:120%; text-align:center; text-transform:capitalize; font-size: 40px; |
|||
font-weight: 700;"> |
|||
<span style="color:#121212; font-size:calc(1.1rem + 1vw)">Data successfully imported |
|||
</span> |
|||
</h1> |
|||
</div> |
|||
<div class="col-md-12 text-center"> |
|||
<div class="d-inline-block p-3 shadow-sm" |
|||
style="background-color:#fff; border-radius:10px"> |
|||
<img alt="" class="img-fluid" |
|||
loading="lazy" |
|||
src="./assets/screenshots/instant_import_06.png" |
|||
style="min-height: 1px;"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div aria-labelledby="feature-tab" |
|||
class="tab-pane fade show py-1" id="feature" |
|||
role="tabpanel"> |
|||
<div class="row py-4"> |
|||
<!-- Features Section --> |
|||
<div class="col-md-6 col-sm-12 p-3"> |
|||
<div class="d-flex flex-column align-items-start h-100" |
|||
style="padding:30px; border-radius:12px; background-color:#faf8ff"> |
|||
<div class="d-flex align-items-center justify-content-center"> |
|||
<div class="d-flex align-items-center justify-content-center " |
|||
style="width:36px; height:36px; border-radius:50%; background-color:#7847D9 ; margin-right:10px"> |
|||
<i class="fa fa-star " |
|||
style="color:#fff; font-size:14px"></i> |
|||
</div> |
|||
<p style="color:#1A202C; font-weight:600; font-size:1.2rem; margin-bottom:2px"> |
|||
Import bulk data instantly. |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-md-6 col-sm-12 p-3"> |
|||
<div class="d-flex flex-column align-items-start h-100" |
|||
style="padding:30px; border-radius:12px; background-color:#faf8ff"> |
|||
<div class="d-flex align-items-center justify-content-center"> |
|||
<div class="d-flex align-items-center justify-content-center " |
|||
style="width:36px; height:36px; border-radius:50%; background-color:#7847D9 ; margin-right:10px"> |
|||
<i class="fa fa-star " |
|||
style="color:#fff; font-size:14px"></i> |
|||
</div> |
|||
<p style="color:#1A202C; font-weight:600; font-size:1.2rem; margin-bottom:2px"> |
|||
Ensures clean and consistent import for Many2one and Many2many relational fields. |
|||
</p> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
<div class="col-md-6 col-sm-12 p-3"> |
|||
<div class="d-flex flex-column align-items-start h-100" |
|||
style="padding:30px; border-radius:12px; background-color:#faf8ff"> |
|||
<div class="d-flex align-items-center justify-content-center"> |
|||
<div class="d-flex align-items-center justify-content-center " |
|||
style="width:36px; height:36px; border-radius:50%; background-color:#7847D9 ; margin-right:10px"> |
|||
<i class="fa fa-star " |
|||
style="color:#fff; font-size:14px"></i> |
|||
</div> |
|||
<p style="color:#1A202C; font-weight:600; font-size:1.2rem; margin-bottom:2px"> |
|||
Works effortlessly with Odoo 17 models. |
|||
</p> |
|||
</div> |
|||
|
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div aria-labelledby="releases-tab" |
|||
class="tab-pane fade show" id="releases" |
|||
role="tabpanel"> |
|||
<!-- Release Notes --> |
|||
<div class="row pt-5 m-0"> |
|||
<div class="col-md-3"> |
|||
<h4 style="font-size:16px; font-weight:600; color:#514F4F; margin:0; line-height:26px;"> |
|||
Latest Release 17.0.1.0.0 |
|||
</h4> |
|||
<span style="font-size:14px; color:#7A7979; display:block; margin-bottom:20px;"> |
|||
17th September, 2025 |
|||
</span> |
|||
</div> |
|||
<div class="col-md-8"> |
|||
<div style="padding:0 0 40px"> |
|||
<div style="margin:0 0 10px"> |
|||
<div style="display:inline-block; padding:0px 8px; color:#514F4F; background-color:#FFD8D8; border-radius:20px"> |
|||
Add |
|||
</div> |
|||
</div> |
|||
<div class="d-flex m-0" |
|||
style="color:#7A7979;"> |
|||
<ul class="pl-3 mb-0"> |
|||
<li> |
|||
Initial Commit |
|||
</li> |
|||
|
|||
</ul> |
|||
</div> |
|||
</div> |
|||
<div style="padding:0 0 0; border-bottom:1px solid #E3E3E3"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- --> |
|||
<!-- related post --> |
|||
<!-- --> |
|||
<section class="oe_container mt32"> |
|||
<h2 style="color: #091E42;font-family: "Montserrat";text-align: center;margin: 25px auto;text-transform: uppercase;" |
|||
class="oe_slogan"> |
|||
<b>Related Products</b> |
|||
</h2> |
|||
<div id="demo" class="row carousel slide mt64 mb32" data-bs-ride="carousel"> |
|||
<!-- The slideshow --> |
|||
<div class="carousel-inner"> |
|||
<div class="carousel-item active"> |
|||
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left; padding: 10px;"> |
|||
<a href="https://apps.odoo.com/apps/modules/18.0/hide_menu_user" target="_blank" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border-radius: 6px; padding: 16px; border: 1px solid #cbcbcb;" |
|||
class="shadow-sm"> |
|||
<img class="img img-responsive center-block" style=" max-width: 100%;" |
|||
src="./assets/modules/b1.png"/> |
|||
<h4 class="mt0 text-truncate" |
|||
style="text-align:center;width:100% margin-bottom: 8px; font-weight: 600; padding-top: 16px; text-decoration:none;font-size: 18px; padding-bottom: 8px; margin-bottom: 0px"> |
|||
Hide Any Menu User Wise</h4> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left; padding: 10px;"> |
|||
<a href="https://apps.odoo.com/apps/modules/18.0/web_login_styles" target="_blank" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border-radius: 6px; padding: 16px; border: 1px solid #cbcbcb;" |
|||
class="shadow-sm"> |
|||
<img class="img img-responsive center-block" style=" max-width: 100%;" |
|||
src="./assets/modules/b2.png"/> |
|||
<h4 class="mt0 text-truncate" |
|||
style="text-align:center;width:100% margin-bottom: 8px; font-weight: 600; padding-top: 16px; text-decoration:none;font-size: 18px; padding-bottom: 8px; margin-bottom: 0px"> |
|||
Customize Login Page Style</h4> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left; padding: 10px;"> |
|||
<a href="https://apps.odoo.com/apps/modules/18.0/whatsapp_mail_messaging" |
|||
target="_blank" style="color: #000; text-decoration: none;"> |
|||
<div style="border-radius: 6px;padding: 16px; border: 1px solid #cbcbcb;" |
|||
class="shadow-sm"> |
|||
<img class="img img-responsive center-block" style=" max-width: 100%;" |
|||
src="./assets/modules/b3.png"/> |
|||
<h4 class="mt0 text-truncate" |
|||
style="text-align:center;width:100% margin-bottom: 8px; font-weight: 600; padding-top: 16px; text-decoration:none;font-size: 18px; padding-bottom: 8px; margin-bottom: 0px"> |
|||
Odoo Whatsapp Connector</h4> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
<div class="carousel-item"> |
|||
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left; padding: 10px;"> |
|||
<a href="https://apps.odoo.com/apps/modules/18.0/login_user_detail" target="_blank" |
|||
style="color: #000; text-decoration: none;"> |
|||
<div style="border-radius: 6px; padding: 16px; border: 1px solid #cbcbcb;" |
|||
class="shadow-sm"> |
|||
<img class="img img-responsive center-block" style=" max-width: 100%;" |
|||
src="./assets/modules/b4.png"/> |
|||
<h4 class="mt0 text-truncate" |
|||
style="text-align:center;width:100% margin-bottom: 8px; font-weight: 600; padding-top: 16px; text-decoration:none;font-size: 18px; padding-bottom: 8px; margin-bottom: 0px"> |
|||
User Log Details</h4> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left; padding: 10px;"> |
|||
<a href="https://apps.odoo.com/apps/modules/18.0/report_attachment_preview" |
|||
target="_blank" style="color: #000; text-decoration: none;"> |
|||
<div style="border-radius: 6px; padding: 16px; border: 1px solid #cbcbcb;" |
|||
class="shadow-sm"> |
|||
<img class="img img-responsive center-block" style=" max-width: 100%;" |
|||
src="./assets/modules/b5.png"/> |
|||
<h4 class="mt0 text-truncate" |
|||
style="text-align:center;width:100% margin-bottom: 8px; font-weight: 600; padding-top: 16px; text-decoration:none;font-size: 18px; padding-bottom: 8px; margin-bottom: 0px"> |
|||
Reports and Attachments Preview in Browser</h4> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" style="float: left; padding: 10px;"> |
|||
<a href="https://apps.odoo.com/apps/modules/18.0/project_dashboard_odoo" |
|||
target="_blank" style="color: #000; text-decoration: none;"> |
|||
<div style="border-radius: 6px; padding: 16px; border: 1px solid #cbcbcb;" |
|||
class="shadow-sm"> |
|||
<img class="img img-responsive center-block" style=" max-width: 100%;" |
|||
src="./assets/modules/b6.png"/> |
|||
<h4 class="mt0 text-truncate" |
|||
style="text-align:center;width:100% margin-bottom: 8px; font-weight: 600; padding-top: 16px; text-decoration:none;font-size: 18px; padding-bottom: 8px; margin-bottom: 0px"> |
|||
Project Dashboard</h4> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<!-- Left and right controls --> |
|||
<a class="carousel-control-prev" href="#demo" data-bs-slide="prev" |
|||
style="margin-left: -30px;width: 35px;color: #000;"> |
|||
<span class="carousel-control-prev-icon"> |
|||
<i class="fa fa-chevron-left" style="font-size:24px"></i> |
|||
</span> |
|||
</a> |
|||
<a class="carousel-control-next" href="#demo" data-bs-slide="next" |
|||
style="margin-right: -30px;width: 35px;color: #000;"> |
|||
<span class="carousel-control-next-icon"> |
|||
<i class="fa fa-chevron-right" style="font-size:24px"></i> |
|||
</span> |
|||
</a> |
|||
</div> |
|||
</section> |
|||
<!-- service-section --> |
|||
|
|||
<section id="services" class="mt-5" style="border-radius: 16px; |
|||
border: 1px solid #EBEEF2; |
|||
background: var(--Neutral-N0, #FFF); |
|||
padding: 60px 40px; |
|||
box-shadow: 0px 5px 20px -11px rgba(0, 0, 0, 0.25);"> |
|||
<div class="text-center mt-4"><h3 class="mb-0" style="color: #000; |
|||
text-align: center; |
|||
font-family: Montserrat; |
|||
font-size: 40px; |
|||
font-style: normal; |
|||
font-weight: 700; |
|||
line-height: normal; |
|||
text-transform: uppercase; |
|||
padding-bottom: 50px;"> |
|||
Our Services</h3></div> |
|||
<div class="row mt-3"> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#FFE2E5; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#FA5A7D; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/gear.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;"> Odoo Customization</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#FFF4DE; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#FF947A; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/wrench-icon.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;"> Odoo Implementation</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#DCFCE7; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#3CD856; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/life-ring-icon.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;">Odoo Support</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#F3E8FF; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#BF83FF; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/arrows-repeat.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;">Odoo Migration</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#F1F9FF; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#01649C; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/puzzle-piece-icon.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;">Odoo integration</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#EDF8ED; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#69CC70; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/odoo-consultancy.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;">Odoo Consultancy</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#F1F6FF; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#2E4556; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/odoo-licencing.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;">Odoo Licensing</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
<div class="col-lg-3 col-sm-12 mb-3"> |
|||
<a href="#" style="text-decoration:none"> |
|||
<div class="btn-lg btn-block p-4 mb-2 d-flex flex-column justify-content-center align-items-center" |
|||
style="font-size:25px; font-weight:bold;background-color:#FAF6EA; margin:auto; gap: 16px; border-radius: 8px;"> |
|||
|
|||
<div class="d-flex justify-content-center align-items-center" |
|||
style="background-color:#FCD12C; border-radius:50%; height:56px; width:56px"> |
|||
<img src="./assets/icons/hire-odoo.svg" |
|||
class="img-responsive" |
|||
height="28px" width="28px"> |
|||
</div> |
|||
<span style="font-size: 18px; |
|||
color: var(--text-color); |
|||
font-weight: 600;">Hire Odoo Developer</span> |
|||
</div> |
|||
</a> |
|||
</div> |
|||
</div></section></div> |
|||
<!-- licence --> |
|||
<div class="tab-pane fade" id="profile" role="tabpanel" |
|||
aria-labelledby="profile-tab"> |
|||
<div class="px-5"> |
|||
.... |
|||
</div> |
|||
</div> |
|||
<!-- --> |
|||
</div> |
|||
</section> |
|||
<!-- --> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js" |
|||
integrity="sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==" |
|||
crossorigin="anonymous" referrerpolicy="no-referrer"></script> |
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js"></script> |
|||
<script> |
|||
$('.owl-carousel').owlCarousel({ |
|||
rtl: true, |
|||
loop: true, |
|||
margin: 10, |
|||
nav: true, |
|||
responsive: { |
|||
0: { |
|||
items: 1 |
|||
}, |
|||
600: { |
|||
items: 3 |
|||
}, |
|||
1000: { |
|||
items: 3 |
|||
} |
|||
} |
|||
}) |
|||
</script> |
|||
</html> |
|||
@ -0,0 +1,138 @@ |
|||
/** @odoo-module **/ |
|||
|
|||
import { registry } from "@web/core/registry"; |
|||
import { ImportAction } from "@base_import/import_action/import_action"; |
|||
import { useService } from "@web/core/utils/hooks"; |
|||
import { BlockUI } from "@web/core/ui/block_ui"; |
|||
|
|||
export class InstantImport extends ImportAction { |
|||
static template = "instant_import.importaction"; |
|||
static components = { ...ImportAction.components, BlockUI }; |
|||
|
|||
setup() { |
|||
super.setup(); |
|||
this.orm = useService('orm'); |
|||
this.action = useService('action'); |
|||
this.notification = useService("notification"); |
|||
this.blockUI = useService("ui"); |
|||
} |
|||
|
|||
async handleImport() { |
|||
try { |
|||
this.blockUI.block({ |
|||
message: "Your records are being imported...", |
|||
}); |
|||
|
|||
console.log("Importing model:", this.props.action.params.model); |
|||
const result = await this.orm.call( |
|||
"custom.import.wizard", |
|||
"copy_import", |
|||
[this.model.id, this.props.action.params.model, this.model.columns], |
|||
{} |
|||
); |
|||
|
|||
if (result && result.record_count) { |
|||
this.notification.add(`${result.record_count} Records successfully imported`, { |
|||
type: "success", |
|||
}); |
|||
|
|||
// Redirect to the relevant view after successful import
|
|||
this.action.doAction({ |
|||
type: "ir.actions.act_window", |
|||
res_model: this.props.action.params.model, |
|||
name: result.name, |
|||
views: [[false, 'list'], [false, 'kanban'], [false, 'form']], |
|||
target: 'main', |
|||
}); |
|||
} |
|||
|
|||
} catch (error) { |
|||
console.error("Import error:", error); |
|||
|
|||
// Extract the actual error message from the error object
|
|||
let errorMessage = "Import failed. Please check your data."; |
|||
|
|||
if (error && error.data && error.data.message) { |
|||
// This handles UserError messages from Python
|
|||
errorMessage = error.data.message; |
|||
} else if (error && error.message) { |
|||
// This handles other types of error messages
|
|||
errorMessage = error.message; |
|||
} else if (typeof error === 'string') { |
|||
errorMessage = error; |
|||
} |
|||
|
|||
this.notification.add(errorMessage, { |
|||
type: "danger", |
|||
sticky: true, // Keep the error message visible longer
|
|||
}); |
|||
} finally { |
|||
this.blockUI.unblock(); |
|||
} |
|||
} |
|||
|
|||
async handleTest() { |
|||
try { |
|||
this.blockUI.block({ |
|||
message: "Your records are being tested...", |
|||
}); |
|||
|
|||
const validationResult = await this.orm.call( |
|||
"custom.import.wizard", |
|||
"validate_columns", |
|||
[this.model.id, this.props.action.params.model, this.model.columns], |
|||
{} |
|||
); |
|||
|
|||
console.log('Validation result:', validationResult); |
|||
|
|||
if (validationResult && validationResult.is_valid) { |
|||
this.notification.add(`Everything seems valid`, { |
|||
type: "success", |
|||
}); |
|||
} else { |
|||
// Handle different types of validation errors
|
|||
let errorMessage = "Validation failed"; |
|||
|
|||
if (validationResult.error_type === 'missing_required_fields') { |
|||
errorMessage = validationResult.error_message || |
|||
`Required fields missing: ${validationResult.missing_required_fields.join(", ")}. Please add these columns to your Excel file.`; |
|||
} else if (validationResult.error_type === 'invalid_columns') { |
|||
errorMessage = `The following columns do not match Odoo fields: ${validationResult.invalid_columns.join(", ")}`; |
|||
} else if (validationResult.error_message) { |
|||
errorMessage = validationResult.error_message; |
|||
} else if (validationResult.invalid_columns) { |
|||
errorMessage = `The following columns do not match Odoo fields: ${validationResult.invalid_columns.join(", ")}`; |
|||
} |
|||
|
|||
this.notification.add(errorMessage, { |
|||
type: "danger", |
|||
sticky: true, // Keep the error message visible longer
|
|||
}); |
|||
} |
|||
|
|||
} catch (error) { |
|||
console.error("Error during column validation:", error); |
|||
|
|||
// Extract the actual error message from the error object
|
|||
let errorMessage = "Validation failed. Please check your data."; |
|||
|
|||
if (error && error.data && error.data.message) { |
|||
errorMessage = error.data.message; |
|||
} else if (error && error.message) { |
|||
errorMessage = error.message; |
|||
} else if (typeof error === 'string') { |
|||
errorMessage = error; |
|||
} |
|||
|
|||
this.notification.add(errorMessage, { |
|||
type: "danger", |
|||
sticky: true, |
|||
}); |
|||
} finally { |
|||
this.blockUI.unblock(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
registry.category("actions").add("instant_import", InstantImport); |
|||
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<templates xml:space="preserve"> |
|||
<t t-name="instant_import.importaction" t-inherit="base_import.ImportAction" t-inherit-mode="primary"> |
|||
|
|||
<xpath expr="//FileInput" position="replace"> |
|||
<t t-if="isPreviewing"> |
|||
<button type="button" class="btn btn-secondary" t-on-click="() => this.handleTest()">Test</button> |
|||
</t> |
|||
<FileInput |
|||
acceptedFileExtensions="'.csv, .xls, .xlsx, .xlsm, .ods'" |
|||
onUpload.bind="(data, files) => this.handleFilesUpload(files)" |
|||
resId="model.id" |
|||
resModel="this.resModel" |
|||
route="'/base_import/set_file'"> |
|||
<button t-if="isPreviewing" type="button" class="btn btn-secondary">Load File</button> |
|||
<button t-else="" type="button" class="btn btn-primary o_import_file">Upload File</button> |
|||
</FileInput> |
|||
</xpath> |
|||
<xpath expr="//button[3]" position="attributes"> |
|||
<attribute name="style">display:None;</attribute> |
|||
</xpath> |
|||
</t> |
|||
</templates> |
|||
@ -0,0 +1,24 @@ |
|||
/** @odoo-module **/ |
|||
|
|||
import { DropdownItem } from "@web/core/dropdown/dropdown_item"; |
|||
import { registry } from "@web/core/registry"; |
|||
import { useService } from "@web/core/utils/hooks"; |
|||
import { Component } from "@odoo/owl"; |
|||
import { patch } from "@web/core/utils/patch"; |
|||
import { ImportRecords } from "@base_import/import_records/import_records"; |
|||
|
|||
patch(ImportRecords.prototype, { |
|||
setup() { |
|||
super.setup(); |
|||
this.orm = useService("orm"); |
|||
this.action = useService("action"); |
|||
}, |
|||
async InstantImport() { |
|||
const { context, resModel } = this.env.searchModel; |
|||
this.action.doAction({ |
|||
type: "ir.actions.client", |
|||
tag: "instant_import", |
|||
params: { model: resModel, context }, |
|||
}); |
|||
} |
|||
}); |
|||
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<templates xml:space="preserve"> |
|||
<t t-name="instant_import.InstantImport" t-inherit="base_import.ImportRecords" t-inherit-mode="extension" owl="1"> |
|||
<xpath expr="//DropdownItem" position="after"> |
|||
<DropdownItem class="'o_import_menu'" onSelected.bind="InstantImport"> |
|||
<i class="fa fa-fw fa-download me-1"/>Instant Import |
|||
</DropdownItem> |
|||
</xpath> |
|||
</t> |
|||
</templates> |
|||
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
from . import import_wizard |
|||
|
|||
@ -0,0 +1,780 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################# |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################# |
|||
import json |
|||
import csv |
|||
from datetime import datetime |
|||
from io import BytesIO |
|||
|
|||
import pandas as pd |
|||
from odoo import models, fields, api, _ |
|||
from odoo.exceptions import UserError |
|||
from odoo.addons.base_import.models.base_import import FIELDS_RECURSION_LIMIT |
|||
|
|||
|
|||
class ImportWizard(models.TransientModel): |
|||
_name = 'custom.import.wizard' |
|||
_description = 'Custom Import Wizard' |
|||
|
|||
model_id = fields.Many2one( |
|||
'ir.model', 'Model', |
|||
required=True, |
|||
domain=[('transient', '=', False)] |
|||
) |
|||
|
|||
def remove_m2m_temp_columns(self, table, m2m_columns): |
|||
for column in m2m_columns: |
|||
self.env.cr.execute(f"ALTER TABLE {table} DROP COLUMN IF EXISTS {column};") |
|||
self.env.cr.execute(f"DROP TRIGGER IF EXISTS trg_process_m2m_mapping ON {table};") |
|||
|
|||
def get_m2m_details(self, model_name, field_name): |
|||
model = self.env[model_name] |
|||
field = model._fields[field_name] |
|||
return { |
|||
'relation_table': field.relation, |
|||
'column1': field.column1, |
|||
'column2': field.column2 |
|||
} |
|||
|
|||
@api.model |
|||
def validate_columns(self, res_id, model, columns): |
|||
try: |
|||
uploaded_columns = [item['fieldInfo']['id'] for item in columns if 'fieldInfo' in item] |
|||
if len(uploaded_columns) < len(columns): |
|||
invalid_columns = [col.get('name', 'Unknown') for col in columns if 'fieldInfo' not in col] |
|||
return { |
|||
'is_valid': False, |
|||
'invalid_columns': invalid_columns, |
|||
'error_type': 'invalid_columns' |
|||
} |
|||
|
|||
missing_required = self._check_missing_required_fields_for_validation(model, columns) |
|||
if missing_required: |
|||
return { |
|||
'is_valid': False, |
|||
'missing_required_fields': missing_required, |
|||
'error_type': 'missing_required_fields', |
|||
'error_message': _("Required fields missing: %s. Please add these columns to your Excel file.") % ', '.join(missing_required) |
|||
} |
|||
|
|||
return {'is_valid': True} |
|||
except Exception as e: |
|||
return { |
|||
'is_valid': False, |
|||
'error_type': 'validation_error', |
|||
'error_message': _("Validation failed: %s") % str(e) |
|||
} |
|||
|
|||
def _check_missing_required_fields_for_validation(self, model_name, columns): |
|||
try: |
|||
imported_fields = set() |
|||
for item in columns: |
|||
if 'fieldInfo' in item: |
|||
field_name = item['fieldInfo']['id'].split('/')[0] if '/' in item['fieldInfo']['id'] else item['fieldInfo']['id'] |
|||
imported_fields.add(field_name) |
|||
|
|||
Model = self.env[model_name] |
|||
model_fields = Model.fields_get() |
|||
required_fields = [ |
|||
fname for fname, field in model_fields.items() |
|||
if field.get('required') and field.get('store') and not field.get('deprecated', False) |
|||
] |
|||
|
|||
defaults = Model.default_get(list(model_fields.keys())) |
|||
odoo_defaults = {k: v for k, v in defaults.items() if v is not None} |
|||
auto_generated_fields = self._get_auto_generated_fields(model_name, required_fields) |
|||
|
|||
missing = [] |
|||
for field in set(required_fields) - imported_fields: |
|||
if field not in odoo_defaults and field not in auto_generated_fields: |
|||
missing.append(field) |
|||
|
|||
return missing |
|||
except Exception: |
|||
return [] |
|||
|
|||
def _get_auto_generated_fields(self, model_name, required_fields): |
|||
auto_generated_fields = set() |
|||
try: |
|||
model_obj = self.env[model_name] |
|||
try: |
|||
all_field_names = list(model_obj.fields_get().keys()) |
|||
defaults = model_obj.default_get(all_field_names) |
|||
fields_with_defaults = {k for k, v in defaults.items() if v is not None} |
|||
except Exception: |
|||
fields_with_defaults = set() |
|||
|
|||
for field_name in required_fields: |
|||
if field_name in model_obj._fields: |
|||
field_obj = model_obj._fields[field_name] |
|||
if ( |
|||
getattr(field_obj, 'compute', False) |
|||
or getattr(field_obj, 'related', False) |
|||
or getattr(field_obj, 'default', False) |
|||
or field_name in fields_with_defaults |
|||
or field_name in ['create_date', 'write_date', 'create_uid', 'write_uid'] |
|||
): |
|||
auto_generated_fields.add(field_name) |
|||
if field_obj.type == 'many2one': |
|||
# Generic company/currency lookup if attribute exists |
|||
attr_name = field_name.replace('_id', '') |
|||
if hasattr(self.env, 'company') and hasattr(self.env.company, attr_name): |
|||
auto_generated_fields.add(field_name) |
|||
except Exception: |
|||
pass |
|||
return auto_generated_fields |
|||
|
|||
def _handle_special_required_fields(self, data, model_name, model_fields, missing_required): |
|||
try: |
|||
Model = self.env[model_name] |
|||
defaults = Model.default_get(list(model_fields.keys())) |
|||
|
|||
for field in missing_required: |
|||
if field in model_fields and model_fields[field]['type'] == 'many2one' and field not in data.columns: |
|||
rel_model = model_fields[field]['relation'] |
|||
rec = self.env[rel_model].search([], limit=1) |
|||
if rec: |
|||
data[field] = [rec.id] * len(data) |
|||
elif field not in data.columns and field in defaults: |
|||
data[field] = [defaults[field]] * len(data) |
|||
elif field == 'user_id' and hasattr(self.env, 'uid') and field not in data.columns: |
|||
data[field] = [self.env.uid] * len(data) |
|||
|
|||
for field in missing_required: |
|||
if (field in model_fields and |
|||
model_fields[field]['type'] in ['date', 'datetime'] |
|||
and (field not in data.columns or data[field].isna().all()) |
|||
): |
|||
now_str = datetime.now().strftime('%Y-%m-%d %H:%M:%S') |
|||
data[field] = [now_str] * len(data) |
|||
except Exception: |
|||
pass |
|||
|
|||
def _build_reference_cache(self, model, values, reference_cache): |
|||
cache_key = model |
|||
if cache_key not in reference_cache: |
|||
reference_cache[cache_key] = {} |
|||
|
|||
Model = self.env[model] |
|||
unique_values = list(set(str(v).strip() for v in values if pd.notna(v) and v not in ['', 0, '0'])) |
|||
if not unique_values: |
|||
return |
|||
|
|||
id_values = [] |
|||
for val in unique_values: |
|||
try: |
|||
id_val = int(float(val)) |
|||
id_values.append(id_val) |
|||
except Exception: |
|||
pass |
|||
|
|||
if id_values: |
|||
records = Model.browse(id_values).exists() |
|||
for record in records: |
|||
reference_cache[cache_key][str(record.id)] = record.id |
|||
|
|||
search_fields = ['name', 'complete_name', 'code'] |
|||
for field_name in search_fields: |
|||
if field_name in Model._fields and Model._fields[field_name].store: |
|||
try: |
|||
records = Model.search([(field_name, 'in', unique_values)]) |
|||
for record in records: |
|||
field_value = getattr(record, field_name, None) |
|||
if field_value: |
|||
reference_cache[cache_key][str(field_value)] = record.id |
|||
except Exception: |
|||
continue |
|||
|
|||
def _resolve_reference(self, model, value, reference_cache): |
|||
if pd.isna(value) or value in ['', 0, '0']: |
|||
return None |
|||
|
|||
cache_key = model |
|||
str_val = str(value).strip() |
|||
|
|||
if cache_key in reference_cache: |
|||
cached_id = reference_cache[cache_key].get(str_val) |
|||
if cached_id is not None: |
|||
return cached_id |
|||
|
|||
Model = self.env[model] |
|||
try: |
|||
record_id = int(float(str_val)) |
|||
record = Model.browse(record_id).exists() |
|||
if record: |
|||
return record.id |
|||
except Exception: |
|||
pass |
|||
|
|||
try: |
|||
return self.env.ref(str_val).id |
|||
except Exception: |
|||
pass |
|||
|
|||
if model == 'res.users': |
|||
user = Model.search([ |
|||
'|', '|', |
|||
('name', '=ilike', str_val), |
|||
('login', '=ilike', str_val), |
|||
('email', '=ilike', str_val) |
|||
], limit=1) |
|||
if user: |
|||
if cache_key not in reference_cache: |
|||
reference_cache[cache_key] = {} |
|||
reference_cache[cache_key][str_val] = user.id |
|||
return user.id |
|||
|
|||
search_fields = ['name', 'complete_name', 'code'] |
|||
for field_name in search_fields: |
|||
if field_name in Model._fields and Model._fields[field_name].store: |
|||
try: |
|||
record = Model.search([(field_name, '=ilike', str_val)], limit=1) |
|||
if record: |
|||
if cache_key not in reference_cache: |
|||
reference_cache[cache_key] = {} |
|||
reference_cache[cache_key][str_val] = record.id |
|||
return record.id |
|||
except Exception: |
|||
continue |
|||
|
|||
return None |
|||
|
|||
def get_required_fields(self, model_name): |
|||
Model = self.env[model_name] |
|||
model_fields = Model.fields_get() |
|||
required_fields = [] |
|||
for field_name, field in model_fields.items(): |
|||
if field.get('required') and field.get('store') and not field.get('deprecated', False): |
|||
required_fields.append({'name': field_name, 'type': field['type']}) |
|||
return required_fields |
|||
|
|||
def _get_sequence_for_model(self, model_name): |
|||
seq = self.env['ir.sequence'].search([('code', '=', model_name)], limit=1) |
|||
return seq or False |
|||
|
|||
def _generate_bulk_sequences(self, sequence, count): |
|||
if not sequence or count <= 0: |
|||
return [] |
|||
if hasattr(sequence, '_next_do'): |
|||
return [sequence._next_do() for _ in range(count)] |
|||
else: |
|||
return [sequence._next() for _ in range(count)] |
|||
|
|||
def _get_model_defaults(self, model_name): |
|||
try: |
|||
Model = self.env[model_name] |
|||
field_names = list(Model.fields_get().keys()) |
|||
defaults = Model.default_get(field_names) |
|||
return {k: v for k, v in defaults.items() if v is not None} |
|||
except Exception: |
|||
return {} |
|||
|
|||
def _prepare_generic_defaults(self, model_name): |
|||
return self._get_model_defaults(model_name) |
|||
|
|||
def _check_missing_required_fields(self, model_name, imported_fields, defaults): |
|||
Model = self.env[model_name] |
|||
model_fields = Model.fields_get() |
|||
required_fields = [] |
|||
for field_name, field_info in model_fields.items(): |
|||
if field_info.get('required') and field_info.get('store') and not field_info.get('deprecated', False): |
|||
required_fields.append(field_name) |
|||
missing_required = set(required_fields) - imported_fields |
|||
auto_generated_fields = self._get_auto_generated_fields(model_name, list(missing_required)) |
|||
missing_without_fallback = [] |
|||
for field in missing_required: |
|||
if field not in defaults and field not in auto_generated_fields: |
|||
missing_without_fallback.append(field) |
|||
return missing_without_fallback |
|||
|
|||
def _get_next_sequence_values(self, table_name, count): |
|||
try: |
|||
self.env.cr.execute(f"SELECT COALESCE(MAX(id), 0) FROM {table_name}") |
|||
max_id = self.env.cr.fetchone()[0] |
|||
ids_to_use = list(range(max_id + 1, max_id + count + 1)) |
|||
sequence_name = f"{table_name}_id_seq" |
|||
new_seq_val = max_id + count + 100 |
|||
self.env.cr.execute(f"SELECT setval('{sequence_name}', %s, false)", (new_seq_val,)) |
|||
return ids_to_use |
|||
except Exception as e: |
|||
try: |
|||
self.env.cr.execute(f"SELECT COALESCE(MAX(id), 0) FROM {table_name}") |
|||
max_id = self.env.cr.fetchone()[0] |
|||
return list(range(max_id + 1, max_id + count + 1)) |
|||
except Exception: |
|||
raise UserError(f"Unable to generate unique IDs: {str(e)}") |
|||
|
|||
def _sync_sequence_after_import(self, table_name): |
|||
try: |
|||
self.env.cr.execute(f"SELECT COALESCE(MAX(id), 0) FROM {table_name}") |
|||
max_id = self.env.cr.fetchone()[0] |
|||
sequence_name = f"{table_name}_id_seq" |
|||
new_seq_val = max_id + 1000 |
|||
self.env.cr.execute(f"SELECT setval('{sequence_name}', %s)", (new_seq_val,)) |
|||
except Exception: |
|||
try: |
|||
self.env.cr.execute(f"SELECT COALESCE(MAX(id), 0) FROM {table_name}") |
|||
max_id = self.env.cr.fetchone()[0] |
|||
sequence_name = f"{table_name}_id_seq" |
|||
self.env.cr.execute(f"SELECT setval('{sequence_name}', %s)", (max_id + 1,)) |
|||
except Exception: |
|||
pass |
|||
|
|||
def _prepare_audit_fields(self): |
|||
current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') |
|||
return { |
|||
'create_uid': self.env.uid, |
|||
'write_uid': self.env.uid, |
|||
'create_date': current_time, |
|||
'write_date': current_time |
|||
} |
|||
|
|||
@api.model |
|||
def copy_import(self, res_id, model, columns): |
|||
try: |
|||
reference_cache = {} |
|||
validation_result = self.validate_columns(res_id, model, columns) |
|||
if not validation_result.get('is_valid', False): |
|||
error_message = validation_result.get('error_message', 'Validation failed') |
|||
raise UserError(error_message) |
|||
|
|||
required_fields = [f['name'] for f in self.get_required_fields(model)] |
|||
model_fields = self.env[model].fields_get() |
|||
|
|||
column_mapping = {} |
|||
imported_fields = set() |
|||
for item in columns: |
|||
if 'fieldInfo' in item: |
|||
field_name = item['fieldInfo']['id'].split('/')[0] if '/' in item['fieldInfo']['id'] else item['fieldInfo']['id'] |
|||
column_mapping[item.get('name', field_name)] = field_name |
|||
imported_fields.add(field_name) |
|||
|
|||
defaults = self._prepare_generic_defaults(model) |
|||
missing_without_fallback = self._check_missing_required_fields(model, imported_fields, defaults) |
|||
if missing_without_fallback: |
|||
missing_fields_str = ', '.join(missing_without_fallback) |
|||
error_message = _( |
|||
"The following required fields are missing from your Excel file and cannot be auto-generated: %s. Please add these columns to your Excel file or ensure they have values." |
|||
) % missing_fields_str |
|||
raise UserError(error_message) |
|||
|
|||
missing_required = set(required_fields) - imported_fields |
|||
table_name = self.env[model]._table |
|||
|
|||
m2m_columns = [] |
|||
m2m_trigger_val = {} |
|||
has_complex_fields = False |
|||
|
|||
for item in columns: |
|||
if 'fieldInfo' not in item: |
|||
continue |
|||
if item["fieldInfo"].get("type") == "many2many": |
|||
has_complex_fields = True |
|||
val = self.get_m2m_details(item['fieldInfo']['model_name'], item['fieldInfo']['id']) |
|||
m2m = f"m2m__{item['fieldInfo']['id']}" |
|||
m2m_trigger_val[m2m] = { |
|||
"data_table": self.env[item['fieldInfo']['comodel_name']]._table, |
|||
"mapping_table": val['relation_table'], |
|||
"column1": val['column1'], |
|||
"column2": val['column2'], |
|||
} |
|||
m2m_columns.append(m2m) |
|||
self.env.cr.execute(f"ALTER TABLE {table_name} ADD COLUMN IF NOT EXISTS {m2m} TEXT;") |
|||
|
|||
model_record = self.env['ir.model'].search([('model', '=', model)], limit=1) |
|||
if not model_record: |
|||
raise UserError(_("Model '%s' does not exist.") % model) |
|||
|
|||
initial_count = self.env[model].search_count([]) |
|||
|
|||
import_record = self.env['base_import.import'].browse(res_id).file |
|||
file_stream = BytesIO(import_record) |
|||
|
|||
data = pd.read_excel(file_stream, dtype=str) |
|||
data = data.replace({pd.NA: None, '': None}) |
|||
data = data.drop_duplicates() |
|||
data = data.rename(columns=column_mapping) |
|||
|
|||
for field in missing_required: |
|||
if field not in data.columns and field in defaults: |
|||
data[field] = [defaults[field]] * len(data) |
|||
|
|||
self._handle_special_required_fields(data, model, model_fields, missing_required) |
|||
|
|||
if 'state' in model_fields and model_fields['state']['type'] == 'selection': |
|||
if 'state' not in data.columns: |
|||
state_default = defaults.get('state', 'draft') |
|||
data['state'] = [state_default] * len(data) |
|||
else: |
|||
state_default = defaults.get('state', 'draft') |
|||
state_values = [] |
|||
for val in data['state']: |
|||
if pd.isna(val) or (isinstance(val, str) and val.strip() == ''): |
|||
state_values.append(state_default) |
|||
else: |
|||
state_values.append(val) |
|||
data['state'] = state_values |
|||
|
|||
many2one_fields = {} |
|||
for column in data.columns: |
|||
if column in model_fields and model_fields[column]['type'] == 'many2one': |
|||
comodel = model_fields[column]['relation'] |
|||
many2one_fields[column] = comodel |
|||
self._build_reference_cache(comodel, data[column], reference_cache) |
|||
|
|||
for column, comodel in many2one_fields.items(): |
|||
resolved_values = [] |
|||
for value in data[column]: |
|||
resolved_id = self._resolve_reference(comodel, value, reference_cache) if pd.notna(value) else None |
|||
resolved_values.append(resolved_id) |
|||
data[column] = resolved_values |
|||
|
|||
for column in data.columns: |
|||
if column in model_fields and model_fields[column]['type'] == 'selection': |
|||
selection_values = model_fields[column]['selection'] |
|||
if isinstance(selection_values, list): |
|||
selection_map = {v.lower(): k for k, v in selection_values} |
|||
selection_map.update({k.lower(): k for k, v in selection_values}) |
|||
mapped_values = [] |
|||
for value in data[column]: |
|||
if pd.isna(value): |
|||
mapped_values.append(None) |
|||
else: |
|||
str_val = str(value).strip().lower() |
|||
mapped_values.append(selection_map.get(str_val, value)) |
|||
data[column] = mapped_values |
|||
|
|||
fields_to_import = list(imported_fields.union(missing_required)) |
|||
|
|||
if 'state' in model_fields and 'state' in data.columns and 'state' not in fields_to_import: |
|||
fields_to_import.append('state') |
|||
|
|||
available_fields = [f for f in fields_to_import if f in data.columns] |
|||
|
|||
for field in fields_to_import: |
|||
if field not in available_fields and (field in defaults or field in data.columns): |
|||
if field in data.columns: |
|||
available_fields.append(field) |
|||
elif field in defaults: |
|||
data[field] = defaults[field] |
|||
available_fields.append(field) |
|||
|
|||
final_fields = [f for f in available_fields if f in model_fields or f == 'id'] |
|||
|
|||
if not final_fields: |
|||
raise UserError(_("No valid fields found for import")) |
|||
|
|||
try: |
|||
self.env.cr.execute(f"DROP TRIGGER IF EXISTS trg_process_m2m_mapping ON {table_name};") |
|||
except Exception: |
|||
pass |
|||
|
|||
return self._postgres_bulk_import(data, model, final_fields, m2m_trigger_val, m2m_columns, |
|||
table_name, model_fields, initial_count, model_record, |
|||
has_complex_fields, reference_cache) |
|||
except UserError: |
|||
raise |
|||
except Exception as e: |
|||
raise UserError(_("Import failed: %s") % str(e)) |
|||
|
|||
def _postgres_bulk_import(self, data, model, final_fields, m2m_trigger_val, m2m_columns, |
|||
table_name, model_fields, initial_count, model_record, |
|||
has_complex_fields, reference_cache): |
|||
try: |
|||
if 'name' in model_fields: |
|||
sequence = self._get_sequence_for_model(model) |
|||
needs_sequence = False |
|||
name_in_data = 'name' in data.columns |
|||
|
|||
if not name_in_data: |
|||
needs_sequence = True |
|||
else: |
|||
non_null_names = data['name'].dropna() |
|||
if len(non_null_names) == 0: |
|||
needs_sequence = True |
|||
else: |
|||
name_check_results = [ |
|||
str(val).strip().lower() in ['new', '', 'false'] for val in non_null_names |
|||
] |
|||
needs_sequence = all(name_check_results) |
|||
|
|||
if sequence and needs_sequence: |
|||
record_count = len(data) |
|||
if record_count > 0: |
|||
try: |
|||
sequence_values = self._generate_bulk_sequences(sequence, record_count) |
|||
data['name'] = sequence_values |
|||
if 'name' not in final_fields: |
|||
final_fields.append('name') |
|||
except Exception: |
|||
pass |
|||
elif not sequence and needs_sequence: |
|||
timestamp = datetime.now().strftime('%Y%m%d-%H%M%S') |
|||
data['name'] = [f"New-{timestamp}-{i + 1}" for i in range(len(data))] |
|||
if 'name' not in final_fields: |
|||
final_fields.append('name') |
|||
|
|||
audit_fields = self._prepare_audit_fields() |
|||
audit_field_names = ['create_uid', 'write_uid', 'create_date', 'write_date'] |
|||
|
|||
for audit_field in audit_field_names: |
|||
if audit_field in model_fields and audit_field not in final_fields: |
|||
data[audit_field] = [audit_fields[audit_field]] * len(data) |
|||
final_fields.append(audit_field) |
|||
|
|||
if 'id' not in final_fields: |
|||
record_count = len(data) |
|||
if record_count > 0: |
|||
try: |
|||
next_ids = self._get_next_sequence_values(table_name, record_count) |
|||
data['id'] = next_ids |
|||
final_fields.insert(0, 'id') |
|||
except Exception: |
|||
if 'id' in final_fields: |
|||
final_fields.remove('id') |
|||
if 'id' in data.columns: |
|||
data = data.drop(columns=['id']) |
|||
|
|||
if has_complex_fields and m2m_trigger_val: |
|||
vals = json.dumps(m2m_trigger_val) |
|||
self.env.cr.execute( |
|||
f"CREATE OR REPLACE TRIGGER trg_process_m2m_mapping AFTER INSERT ON {table_name} " |
|||
f"FOR EACH ROW EXECUTE FUNCTION process_m2m_mapping('{vals}');" |
|||
) |
|||
|
|||
data = data[final_fields] |
|||
default_lang = self.env.context.get('lang') or getattr(self.env, 'lang', None) or 'en_US' |
|||
translatable_columns = set() |
|||
|
|||
for column in data.columns: |
|||
if column in model_fields: |
|||
field_info = model_fields[column] |
|||
if field_info.get('translate') and field_info.get('store'): |
|||
translatable_columns.add(column) |
|||
|
|||
def _to_jsonb_value(val): |
|||
if pd.isna(val) or val is None: |
|||
return None |
|||
if isinstance(val, dict): |
|||
try: |
|||
return json.dumps(val, ensure_ascii=False) |
|||
except Exception: |
|||
return json.dumps({default_lang: str(val)}, ensure_ascii=False) |
|||
s = str(val).strip() |
|||
if s == '': |
|||
return None |
|||
if s.startswith('{') or s.startswith('['): |
|||
try: |
|||
parsed = json.loads(s) |
|||
return json.dumps(parsed, ensure_ascii=False) |
|||
except Exception: |
|||
return json.dumps({default_lang: s}, ensure_ascii=False) |
|||
return json.dumps({default_lang: s}, ensure_ascii=False) |
|||
|
|||
try: |
|||
jsonb_values = [_to_jsonb_value(val) for val in data[column]] |
|||
data[column] = jsonb_values |
|||
except Exception: |
|||
pass |
|||
|
|||
for column in data.columns: |
|||
if column in model_fields and column not in translatable_columns: |
|||
field_info = model_fields[column] |
|||
field_type = field_info['type'] |
|||
|
|||
if field_type in ['char', 'text']: |
|||
data[column] = (data[column].astype(str) |
|||
.str.replace(r'[\n\r]+', ' ', regex=True) |
|||
.str.strip()) |
|||
data[column] = data[column].replace(['nan', 'None'], None) |
|||
elif field_type in ['integer', 'float']: |
|||
if model_fields[column].get('required', False): |
|||
data[column] = pd.to_numeric(data[column], errors='coerce').fillna(0) |
|||
else: |
|||
data[column] = pd.to_numeric(data[column], errors='coerce') |
|||
elif field_type == 'boolean': |
|||
data[column] = data[column].fillna(False) |
|||
data[column] = ['t' if bool(val) else 'f' for val in data[column]] |
|||
elif field_type in ['date', 'datetime']: |
|||
formatted_dates = [] |
|||
current_datetime = datetime.now() |
|||
|
|||
for val in data[column]: |
|||
if pd.isna(val) or val in ['', None, 'nan', 'None']: |
|||
formatted_dates.append(current_datetime.strftime('%Y-%m-%d %H:%M:%S')) |
|||
else: |
|||
try: |
|||
if isinstance(val, str): |
|||
parsed_date = pd.to_datetime(val, errors='coerce') |
|||
if pd.isna(parsed_date): |
|||
parsed_date = datetime.strptime(val, '%Y-%m-%d') |
|||
formatted_dates.append(parsed_date.strftime('%Y-%m-%d %H:%M:%S')) |
|||
elif hasattr(val, 'strftime'): |
|||
formatted_dates.append(val.strftime('%Y-%m-%d %H:%M:%S')) |
|||
else: |
|||
formatted_dates.append(str(val)) |
|||
except Exception: |
|||
formatted_dates.append(current_datetime.strftime('%Y-%m-%d %H:%M:%S')) |
|||
data[column] = formatted_dates |
|||
elif field_type == 'many2one': |
|||
data[column] = pd.to_numeric(data[column], errors='coerce').astype('Int64') |
|||
|
|||
csv_buffer = BytesIO() |
|||
data_for_copy = data.copy() |
|||
|
|||
for column in data_for_copy.columns: |
|||
if column in model_fields: |
|||
field_info = model_fields[column] |
|||
field_type = field_info['type'] |
|||
|
|||
if field_info.get('translate') and field_info.get('store'): |
|||
translate_values = [str(val) if val is not None and not pd.isna(val) else '' for val in data_for_copy[column]] |
|||
data_for_copy[column] = translate_values |
|||
elif field_type in ['integer', 'float', 'many2one']: |
|||
numeric_values = [] |
|||
for val in data_for_copy[column]: |
|||
if val is None or pd.isna(val): |
|||
numeric_values.append('') |
|||
else: |
|||
try: |
|||
if field_type in ['integer', 'many2one']: |
|||
numeric_values.append(str(int(float(val)))) |
|||
else: |
|||
numeric_values.append(str(val)) |
|||
except Exception: |
|||
numeric_values.append('') |
|||
data_for_copy[column] = numeric_values |
|||
else: |
|||
other_values = [str(val) if val is not None and not pd.isna(val) else '' for val in data_for_copy[column]] |
|||
data_for_copy[column] = other_values |
|||
|
|||
data_for_copy.to_csv( |
|||
csv_buffer, index=False, header=False, sep='|', |
|||
na_rep='', quoting=csv.QUOTE_MINIMAL, doublequote=True |
|||
) |
|||
csv_buffer.seek(0) |
|||
|
|||
self.env.cr.execute(f"ALTER TABLE {table_name} DISABLE TRIGGER ALL;") |
|||
if has_complex_fields and m2m_trigger_val: |
|||
self.env.cr.execute(f"ALTER TABLE {table_name} ENABLE TRIGGER trg_process_m2m_mapping;") |
|||
|
|||
fields_str = ",".join(final_fields) |
|||
copy_sql = f""" |
|||
COPY {table_name} ({fields_str}) |
|||
FROM STDIN WITH ( |
|||
FORMAT CSV, |
|||
HEADER FALSE, |
|||
DELIMITER '|', |
|||
NULL '', |
|||
QUOTE '"' |
|||
) |
|||
""" |
|||
|
|||
start_time = datetime.now() |
|||
self.env.cr.copy_expert(copy_sql, csv_buffer) |
|||
record_count = len(data) |
|||
|
|||
if record_count > 500: |
|||
self.env.cr.commit() |
|||
|
|||
end_time = datetime.now() |
|||
import_duration = (end_time - start_time).total_seconds() |
|||
|
|||
self._sync_sequence_after_import(table_name) |
|||
self.env.cr.execute(f"ALTER TABLE {table_name} ENABLE TRIGGER ALL;") |
|||
|
|||
if has_complex_fields and m2m_trigger_val: |
|||
self.remove_m2m_temp_columns(table_name, m2m_columns) |
|||
|
|||
self.env.invalidate_all() |
|||
self.env.cr.execute(f"ANALYZE {table_name};") |
|||
|
|||
final_count = self.env[model].search_count([]) |
|||
imported_count = final_count - initial_count |
|||
|
|||
return { |
|||
'name': model_record.name, |
|||
'record_count': imported_count, |
|||
'duration': import_duration |
|||
} |
|||
|
|||
except Exception as e: |
|||
try: |
|||
self.env.cr.execute(f"ALTER TABLE {table_name} ENABLE TRIGGER ALL;") |
|||
except Exception: |
|||
pass |
|||
|
|||
if has_complex_fields and m2m_trigger_val: |
|||
try: |
|||
self.remove_m2m_temp_columns(table_name, m2m_columns) |
|||
except Exception: |
|||
pass |
|||
|
|||
raise UserError(_("Failed to import data: %s") % str(e)) |
|||
|
|||
|
|||
class Import(models.TransientModel): |
|||
_inherit = 'base_import.import' |
|||
|
|||
@api.model |
|||
def get_fields_tree(self, model, depth=FIELDS_RECURSION_LIMIT): |
|||
Model = self.env[model] |
|||
importable_fields = [{ |
|||
'id': 'id', |
|||
'name': 'id', |
|||
'string': _("External ID"), |
|||
'required': False, |
|||
'fields': [], |
|||
'type': 'id', |
|||
}] |
|||
|
|||
if not depth: |
|||
return importable_fields |
|||
|
|||
model_fields = Model.fields_get() |
|||
for name, field in model_fields.items(): |
|||
if field.get('deprecated', False) is not False: |
|||
continue |
|||
if not field.get('store'): |
|||
continue |
|||
if field['type'] == 'one2many': |
|||
continue |
|||
|
|||
field_value = { |
|||
'id': name, |
|||
'name': name, |
|||
'string': field['string'], |
|||
'required': bool(field.get('required')), |
|||
'fields': [], |
|||
'type': field['type'], |
|||
'model_name': model |
|||
} |
|||
|
|||
if field['type'] in ('many2many', 'many2one'): |
|||
field_value['fields'] = [ |
|||
dict(field_value, name='id', string=_("External ID"), type='id'), |
|||
dict(field_value, name='.id', string=_("Database ID"), type='id'), |
|||
] |
|||
field_value['comodel_name'] = field['relation'] |
|||
|
|||
importable_fields.append(field_value) |
|||
|
|||
return importable_fields |
|||