diff --git a/nfu_ecommerce/__manifest__.py b/nfu_ecommerce/__manifest__.py index b5aec0a..0a65af3 100644 --- a/nfu_ecommerce/__manifest__.py +++ b/nfu_ecommerce/__manifest__.py @@ -6,7 +6,7 @@ "category": "website", "version": "16.0.1.0.0", "depends": ["website_sale", "nfu_sale_order_batch_packaging"], - "data": ["views/templates.xml"], + "data": ["views/product_template_views.xml", "views/templates.xml"], "assets": {"web.assets_frontend": ["nfu_ecommerce/static/src/js/website_sale.js"]}, "license": "LGPL-3", } diff --git a/nfu_ecommerce/models/__init__.py b/nfu_ecommerce/models/__init__.py index 2d7ee6c..53fa79a 100644 --- a/nfu_ecommerce/models/__init__.py +++ b/nfu_ecommerce/models/__init__.py @@ -1,2 +1,3 @@ +from . import product_template from . import sale_order from . import sale_order_line diff --git a/nfu_ecommerce/models/product_template.py b/nfu_ecommerce/models/product_template.py new file mode 100644 index 0000000..b785776 --- /dev/null +++ b/nfu_ecommerce/models/product_template.py @@ -0,0 +1,13 @@ +from odoo import models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + def action_publish_on_website(self): + for product in self: + product.is_published = True + + def action_unpublish_on_website(self): + for product in self: + product.is_published = False diff --git a/nfu_ecommerce/views/product_template_views.xml b/nfu_ecommerce/views/product_template_views.xml new file mode 100644 index 0000000..b710e18 --- /dev/null +++ b/nfu_ecommerce/views/product_template_views.xml @@ -0,0 +1,15 @@ + + + + product.template.product.tree.inherit.website + product.template + + + +