-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
11.0 mig website sale affiliate #232
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
49cac6d
[ADD] website_sale_affiliate: Create module (#199)
hughesbm f3635e2
OCA Transbot updated translations from Transifex
oca-transbot 02c7bd6
[MIG] website_sale_affiliate: Migration of website_sale_affiliates fr…
DarkoNikolovski 96a81be
[FIX] website_sale_affiliate: PEP8 Corrections
DarkoNikolovski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,82 @@ | ||
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/lgpl | ||
:alt: License: LGPL-3 | ||
|
||
================= | ||
Affiliate Program | ||
================= | ||
|
||
This module allows for the creation of affiliates and the tracking of sales conversions generated by them. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you must first create at least one affiliate (found in Sales/Affiliate Program). | ||
|
||
Once an affiliate has been created, append one of the following to a compatible shop or product url (see below) to track the affiliate's conversions: | ||
|
||
* ?aff_ref=\ *affiliate_id* | ||
* ?aff_ref=\ *affiliate_id*\&aff_key=\ *custom_key* | ||
|
||
The "affiliate_id" is the ID displayed on the affiliate's record, e.g. "1". | ||
|
||
The "custom_key" (optional) is a url-friendly string of your choice used to track a specific campaign, e.g. "anniversary_sale". Associated affiliate requests will be named after this key, if provided. | ||
|
||
**Example:** /shop?aff_ref=1&aff_key=anniversary_sale | ||
|
||
Compatible URLs | ||
--------------- | ||
|
||
* /shop | ||
* /shop/category/{category} | ||
* /shop/category/{category}/page/{page} | ||
* /shop/page/{page} | ||
* /shop/product/{product} | ||
|
||
.. 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/10.0 | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* Evaluate usefulness of IP as a fallback affiliate request identifier | ||
|
||
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 smash it by providing 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 | ||
------------ | ||
|
||
* Brent Hughes <brent.hughes@laslabs.com> | ||
* Darko Nikolovski <darko@versada.eu> | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
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 @@ | ||
# Copyright 2017 LasLabs Inc. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) | ||
|
||
from . import controllers | ||
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,28 @@ | ||
# Copyright 2017 LasLabs Inc. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) | ||
|
||
{ | ||
"name": "Affiliate Program", | ||
"summary": "This module allows creation of affiliates and " | ||
"tracking the sales conversions generated by them.", | ||
"version": "11.0.1.0.0", | ||
"category": "Website", | ||
"website": "https://laslabs.com", | ||
"author": "LasLabs, Odoo Community Association (OCA), Versada", | ||
"license": "LGPL-3", | ||
"application": False, | ||
"installable": True, | ||
"depends": [ | ||
"website_sale", | ||
], | ||
"data": [ | ||
"data/sale_affiliate_data.xml", | ||
"security/ir.model.access.csv", | ||
"views/sale_affiliate_view.xml", | ||
"views/sale_affiliate_request_view.xml", | ||
"views/sale_order_view.xml", | ||
], | ||
"demo": [ | ||
"demo/sale_affiliate_demo.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,4 @@ | ||
# Copyright 2017 LasLabs Inc. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) | ||
|
||
from . import main |
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,30 @@ | ||
# Copyright 2017 LasLabs Inc. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) | ||
|
||
from odoo.addons.website_sale.controllers.main import WebsiteSale as Base | ||
from odoo.http import request, route | ||
|
||
|
||
class WebsiteSale(Base): | ||
def _store_affiliate_info(self, **kwargs): | ||
Affiliate = request.env['sale.affiliate'] | ||
affiliate = Affiliate.sudo().find_from_kwargs(**kwargs) | ||
try: | ||
affiliate_request = affiliate.get_request(**kwargs) | ||
request.session['affiliate_request'] = affiliate_request.id | ||
except (AttributeError, ValueError): | ||
pass | ||
|
||
@route() | ||
def shop(self, page=0, category=None, search='', ppg=False, **post): | ||
res = super(WebsiteSale, self).shop(page, category, | ||
search, ppg, **post) | ||
self._store_affiliate_info(**post) | ||
return res | ||
|
||
@route() | ||
def product(self, product, category='', search='', **kwargs): | ||
res = super(WebsiteSale, self).product(product, category='', | ||
search='', **kwargs) | ||
self._store_affiliate_info(**kwargs) | ||
return res |
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,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2017 LasLabs Inc. | ||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> | ||
|
||
<odoo noupdate="1"> | ||
<record id="request_sequence" model="ir.sequence"> | ||
<field name="name">Affiliate Request Sequence</field> | ||
<field name="padding">10</field> | ||
<field name="number_next">1</field> | ||
</record> | ||
</odoo> |
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,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2017 LasLabs Inc. | ||
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> | ||
|
||
<odoo noupdate="1"> | ||
<record id="sale_affiliate_myaffiliate" model="sale.affiliate"> | ||
<field name="name">MyAffiliate</field> | ||
<field name="company_id" ref="base.main_company"></field> | ||
<field name="valid_hours">24</field> | ||
<field name="valid_sales">1</field> | ||
</record> | ||
|
||
<record id="sale_affiliate_request_firesale" model="sale.affiliate.request"> | ||
<field name="name">firesale</field> | ||
<field name="affiliate_id" ref="sale_affiliate_myaffiliate"></field> | ||
<field name="ip">0.0.0.0</field> | ||
<field name="referrer">referrer</field> | ||
<field name="user_agent">user agent</field> | ||
<field name="accept_language">language</field> | ||
</record> | ||
|
||
<record id="sale.sale_order_1" model="sale.order"> | ||
<field name="affiliate_request_id" ref="sale_affiliate_request_firesale"/> | ||
</record> | ||
|
||
<record id="sale.sale_order_2" model="sale.order"> | ||
<field name="affiliate_request_id" ref="sale_affiliate_request_firesale"/> | ||
</record> | ||
</odoo> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'website': 'https://github.com/OCA/e-commerce',