[imp] add publish/unpublish button for products
This commit is contained in:
parent
61c1ad297c
commit
cd271b6478
4 changed files with 30 additions and 1 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
"category": "website",
|
"category": "website",
|
||||||
"version": "16.0.1.0.0",
|
"version": "16.0.1.0.0",
|
||||||
"depends": ["website_sale", "nfu_sale_order_batch_packaging"],
|
"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"]},
|
"assets": {"web.assets_frontend": ["nfu_ecommerce/static/src/js/website_sale.js"]},
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
|
from . import product_template
|
||||||
from . import sale_order
|
from . import sale_order
|
||||||
from . import sale_order_line
|
from . import sale_order_line
|
||||||
|
|
|
||||||
13
nfu_ecommerce/models/product_template.py
Normal file
13
nfu_ecommerce/models/product_template.py
Normal file
|
|
@ -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
|
||||||
15
nfu_ecommerce/views/product_template_views.xml
Normal file
15
nfu_ecommerce/views/product_template_views.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record id="product_template_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">product.template.product.tree.inherit.website</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_tree_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//header" position="inside">
|
||||||
|
<button string="Publish on Website" type="object" name="action_publish_on_website"/>
|
||||||
|
<button string="Unpublish on Website" type="object" name="action_unpublish_on_website"/>
|
||||||
|
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in a new issue