diff --git a/apps_product_creator/__manifest__.py b/apps_product_creator/__manifest__.py index e1066a18..28a72622 100644 --- a/apps_product_creator/__manifest__.py +++ b/apps_product_creator/__manifest__.py @@ -12,10 +12,12 @@ 'github_connector_oca', 'github_connector_odoo', 'product', + 'website_sale', ], 'data': [ 'data/ir_cron.xml', 'data/product_attribute.xml', + 'data/product_public_categ_data.xml', 'views/view_odoo_module.xml', 'views/view_product_product.xml', ], diff --git a/apps_product_creator/data/product_public_categ_data.xml b/apps_product_creator/data/product_public_categ_data.xml new file mode 100644 index 00000000..213e77e6 --- /dev/null +++ b/apps_product_creator/data/product_public_categ_data.xml @@ -0,0 +1,76 @@ + + + + + Accounting + 1 + + + Discuss + 2 + + + Document Management + 3 + + + eCommerce + 4 + + + Human Resources + 5 + + + Industries + 6 + + + Localization + 7 + + + Manufacturing + 8 + + + Point of Sale + 9 + + + Productivity + 10 + + + Project + 11 + + + Purchases + 12 + + + Sales + 13 + + + Warehouse + 14 + + + Website + 15 + + + Extra Tools + 16 + + + Other + 17 + + diff --git a/apps_product_creator/models/odoo_module.py b/apps_product_creator/models/odoo_module.py index f089c170..74610a95 100644 --- a/apps_product_creator/models/odoo_module.py +++ b/apps_product_creator/models/odoo_module.py @@ -84,6 +84,7 @@ def _prepare_template(self): """ self.ensure_one() attribute_obj = self.env['product.attribute.value'] + categ_obj = self.env['product.public.category'] series = self.module_version_ids.mapped( 'repository_branch_id.organization_serie_id.name') attributes = attribute_obj.search([('name', 'in', series)]) @@ -93,6 +94,11 @@ def _prepare_template(self): 'attribute_id': attribute.id, 'value_ids': [(6, 0, attributes.ids)], } + version_categ = self.module_version_ids.mapped('category_id') + category = categ_obj.search( + [('name', '=', version_categ.name)], limit=1) + if not category: + category = self.env.ref('apps_product_creator.other') values = { 'odoo_module_id': self.id, 'type': 'service', @@ -103,7 +109,8 @@ def _prepare_template(self): 'image': self.image, 'attribute_line_ids': [ (0, 0, attribute_line_values), - ] + ], + 'public_categ_ids': [(4, category._ids)] or None, } return values diff --git a/website_apps_store/views/templates.xml b/website_apps_store/views/templates.xml index 3fa68cfa..76af2355 100644 --- a/website_apps_store/views/templates.xml +++ b/website_apps_store/views/templates.xml @@ -13,6 +13,9 @@