forked from OCA/e-commerce
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding website_sale_cart_selectable (OCA#134)
[ADD] website_sale_cart_selectable Signed-off-by: Carmen Bianca BAKKER <[email protected]>
- Loading branch information
1 parent
f56e877
commit fab4ffc
Showing
8 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
============================ | ||
Website Sale Cart Selectable | ||
============================ | ||
|
||
This module was written to extend the functionality of the website to control | ||
button add to cart. Button add to cart can now be set to be published or not. | ||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
1. Clone the branch 8.0 of the repository https://github.com/OCA/e-commerce | ||
2. Add the path to this repository in your configuration (addons-path) | ||
3. Update the module list | ||
4. Go to menu *Setting -> Modules -> Local Modules* | ||
5. Search For *Website Sale Cart Selectable* | ||
6. Install the module | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
1. Go to menu *Sales -> Products -> Products* | ||
2. Edit or create one. | ||
3. Within the *Sales* tab, there will be a new field named *Button Add To Cart* | ||
4. If you want the button add to cart visible on the website, just click into *Published*. | ||
If you dont want the button add to cart visible on the website, just click into *Not Published* | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/113/8.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/e-commerce/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Images | ||
------ | ||
|
||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Michael Viriyananda <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
'name': 'Website Sale Cart Selectable', | ||
'version': '8.0.1.0.0', | ||
'summary': 'Enables to controlling button add to cart per product', | ||
'author': 'OpenSynergy Indonesia,Odoo Community Association (OCA)', | ||
'website': 'https://opensynergy-indonesia.com', | ||
'category': 'Website', | ||
'depends': ['website_sale'], | ||
'data': [ | ||
'views/product_view.xml', | ||
'views/website_sale_template.xml' | ||
], | ||
'installable': True, | ||
'license': 'AGPL-3', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import product |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
# © 2016 OpenSynergy Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openerp import fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = 'product.template' | ||
|
||
website_btn_addtocart_published = fields.Boolean( | ||
string='Button Add To Cart', | ||
copy=False, | ||
default=True) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<openerp> | ||
<data> | ||
|
||
<record model="ir.ui.view" id="res_product_view_form"> | ||
<field name="name">Product Add To Cart</field> | ||
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="website_sale.product_template_form_view"/> | ||
<field name="arch" type="xml"> | ||
<field name="website_published" class="pull-right" widget="website_button" position="after"> | ||
<field name="website_btn_addtocart_published" class="pull-right" widget="website_button"/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
</data> | ||
</openerp> |
27 changes: 27 additions & 0 deletions
27
website_sale_cart_selectable/views/website_sale_template.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
<template id="products_add_to_cart" inherit_id="website_sale.products_add_to_cart"> | ||
<xpath expr="//a[@class='btn btn-default btn-xs fa fa-shopping-cart a-submit']" position="replace"> | ||
<t t-if="product.website_btn_addtocart_published == True"> | ||
<a class="btn btn-default btn-xs fa fa-shopping-cart a-submit"/> | ||
</t> | ||
</xpath> | ||
<xpath expr="//a[@class='btn btn-default btn-xs fa fa-shopping-cart']" position="replace"> | ||
<t t-if="product.website_btn_addtocart_published == True"> | ||
<a class="btn btn-default btn-xs fa fa-shopping-cart" t-att-href="keep('/shop/product/%s' % slug(product), page=(pager['page']['num'] if pager['page']['num']>1 else None))"/> | ||
</t> | ||
</xpath> | ||
</template> | ||
|
||
<template id="product" inherit_id="website_sale.product"> | ||
<xpath expr="//a[@class='btn btn-primary btn-lg mt8 js_check_product a-submit']" position="replace"> | ||
<t t-if="product.website_btn_addtocart_published == True"> | ||
<a id="add_to_cart" class="btn btn-primary btn-lg mt8 js_check_product a-submit" href="#">Add to Cart</a> | ||
</t> | ||
</xpath> | ||
</template> | ||
|
||
</data> | ||
</openerp> |