Skip to content

Commit

Permalink
[T7009]bad_connector_woocommerce:Migration to V17
Browse files Browse the repository at this point in the history
  • Loading branch information
PAA authored and PAA committed Dec 18, 2023
1 parent b165cda commit 304458d
Show file tree
Hide file tree
Showing 73 changed files with 993 additions and 1,196 deletions.
1 change: 0 additions & 1 deletion bad_connector_woocommerce/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* Add object woo.backend, woo.product.category, woo.product.image.url, woo.tax, woo.payment.gateway and woo.sale.status on submenu Connectors.
* Add object woo.settings, res.config.setting and woo.sale.status in Configuration submenu of woocommerce backend.
* Submenu of Configurations > WooCommerce Sale Status which is use to store all the WooCommerce Sale Order Status.
* Required field are Location,Client Key,Client Secret.
* 'Test' mode is used to test the environment using test data, while the 'Production' mode is used for the live environment that contains real customer data and requires production-level credentials.
* Create a module named bad_connector_woocommerce This module focuses on the import of "Customers", "Products","Product Attributes","Product Categories", "Taxes", "Orders" and export of "Orders" data between connected Woocommerce and Odoo.
* Add "Import Partners","Import Products","Import Product Templates","Import Product Attributes","Import Product Category", "Import Orders", "Sync Metadata" and "Import Taxes" and "Update Stock Inventory" at backend level.
Expand Down
2 changes: 1 addition & 1 deletion bad_connector_woocommerce/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Odoo Woocommerce Connector",
"version": "16.0.5.0.0",
"version": "17.0.1.0.0",
"category": "Connector",
"author": "BizzAppDev Systems Pvt. Ltd.",
"website": "http://www.bizzappdev.com",
Expand Down
46 changes: 14 additions & 32 deletions bad_connector_woocommerce/components/backend_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,38 +194,20 @@ def search(self, filters=None, **kwargs):
result = self._call(
resource_path=self._woo_model, arguments=filters, http_method="get"
)
if kwargs.get("_woo_product_stock", False):
setting_stock_result = self._call(
resource_path=kwargs.get("_woo_product_stock"),
arguments=filters,
http_method="get",
)
result["data"].append(setting_stock_result.get("data", []))

if kwargs.get("_woo_default_currency", False):
default_currency_result = self._call(
resource_path=kwargs.get("_woo_default_currency"),
arguments=filters,
http_method="get",
)
result["data"].append(default_currency_result.get("data"))

if kwargs.get("_woo_default_weight", False):
default_weight_result = self._call(
resource_path=kwargs.get("_woo_default_weight"),
arguments=filters,
http_method="get",
)
result["data"].append(default_weight_result.get("data"))

if kwargs.get("_woo_default_dimension", False):
default_dimension_result = self._call(
resource_path=kwargs.get("_woo_default_dimension"),
arguments=filters,
http_method="get",
)
result["data"].append(default_dimension_result.get("data"))

additional_resources = [
"_woo_product_stock",
"_woo_default_currency",
"_woo_default_weight",
"_woo_default_dimension",
]
for resource_key in additional_resources:
if kwargs.get(resource_key, False):
resource_result = self._call(
resource_path=kwargs.get(resource_key),
arguments=filters,
http_method="get",
)
result["data"].append(resource_result.get("data", []))
return result

def read(self, external_id=None, attributes=None):
Expand Down
4 changes: 2 additions & 2 deletions bad_connector_woocommerce/components/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _import_dependencies(self):
record = self.remote_record
model, key = dependency
datas = record.get(key)
if not isinstance(datas, (list, tuple)):
if not isinstance(datas, (list | tuple)):
datas = [{"id": datas}]
for data in datas:
external_id = data.get("id")
Expand All @@ -168,7 +168,7 @@ def _import_dependencies(self):
record = self.remote_record
model, key = dependency
datas = record.get(key)
if not isinstance(datas, (list, tuple)):
if not isinstance(datas, (list | tuple)):
datas = [{"id": datas}]
for data in datas:
external_id = data.get("id")
Expand Down
224 changes: 111 additions & 113 deletions bad_connector_woocommerce/data/ir_cron_data.xml
Original file line number Diff line number Diff line change
@@ -1,115 +1,113 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<!-- Import Partners -->
<record id="ir_cron_woocommerce_import_partners" model="ir.cron">
<field name="name">Woocommerce: Import Partners</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_partners()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Products -->
<record id="ir_cron_woocommerce_import_products" model="ir.cron">
<field name="name">Woocommerce: Import Products</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_products()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Attributes -->
<record id="ir_cron_woocommerce_import_product_attribute" model="ir.cron">
<field name="name">Woocommerce: Import Product Attributes</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_attributes()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Categories -->
<record id="ir_cron_woocommerce_import_product_category" model="ir.cron">
<field name="name">Woocommerce: Import Product Categories</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_categories()</field>
<field name="interval_number">15</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Tags -->
<record id="ir_cron_woocommerce_import_product_tag" model="ir.cron">
<field name="name">Woocommerce: Import Product Tags</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_tags()</field>
<field name="interval_number">15</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Account Taxes -->
<record id="ir_cron_woocommerce_import_tax" model="ir.cron">
<field name="name">Woocommerce: Import Account Taxes</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_account_tax()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Sale Orders -->
<record id="ir_cron_woocommerce_import_sale_order" model="ir.cron">
<field name="name">Woocommerce: Import Sale Orders</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_sale_orders()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Export Sale Order status -->
<record id="ir_cron_woo_sale_order_export" model="ir.cron">
<field name="name">Woocommerce: Export Sale Order status</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_export_sale_order_status()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Country and there States-->
<record id="ir_cron_woocommerce_import_country_state" model="ir.cron">
<field name="name">Woocommerce: Import Metadata</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_metadata()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Export Stock Inventory -->
<record id="ir_cron_woo_product_product_export" model="ir.cron">
<field name="name">Woocommerce: Export Stock Inventory</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_update_stock_qty()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Templates -->
<record id="ir_cron_woocommerce_import_product_templates" model="ir.cron">
<field name="name">Woocommerce: Import Product Templates</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_templates()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
</data>
<odoo noupdate="1">
<!-- Import Partners -->
<record id="ir_cron_woocommerce_import_partners" model="ir.cron">
<field name="name">Woocommerce: Import Partners</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_partners()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Products -->
<record id="ir_cron_woocommerce_import_products" model="ir.cron">
<field name="name">Woocommerce: Import Products</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_products()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Attributes -->
<record id="ir_cron_woocommerce_import_product_attribute" model="ir.cron">
<field name="name">Woocommerce: Import Product Attributes</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_attributes()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Categories -->
<record id="ir_cron_woocommerce_import_product_category" model="ir.cron">
<field name="name">Woocommerce: Import Product Categories</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_categories()</field>
<field name="interval_number">15</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Tags -->
<record id="ir_cron_woocommerce_import_product_tag" model="ir.cron">
<field name="name">Woocommerce: Import Product Tags</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_tags()</field>
<field name="interval_number">15</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Account Taxes -->
<record id="ir_cron_woocommerce_import_tax" model="ir.cron">
<field name="name">Woocommerce: Import Account Taxes</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_account_tax()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Sale Orders -->
<record id="ir_cron_woocommerce_import_sale_order" model="ir.cron">
<field name="name">Woocommerce: Import Sale Orders</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_sale_orders()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Export Sale Order status -->
<record id="ir_cron_woo_sale_order_export" model="ir.cron">
<field name="name">Woocommerce: Export Sale Order status</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_export_sale_order_status()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Country and there States-->
<record id="ir_cron_woocommerce_import_country_state" model="ir.cron">
<field name="name">Woocommerce: Import Metadata</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_metadata()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Export Stock Inventory -->
<record id="ir_cron_woo_product_product_export" model="ir.cron">
<field name="name">Woocommerce: Export Stock Inventory</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_update_stock_qty()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
<!-- Import Product Templates -->
<record id="ir_cron_woocommerce_import_product_templates" model="ir.cron">
<field name="name">Woocommerce: Import Product Templates</field>
<field name="model_id" ref="model_woo_backend" />
<field name="state">code</field>
<field name="code">model.cron_import_product_templates()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
</record>
</odoo>
Loading

0 comments on commit 304458d

Please sign in to comment.