forked from OCA/e-commerce
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'em230418/14.0-mig-website_sale_affiliat…
…e' into 14.0
- Loading branch information
Showing
98 changed files
with
22,571 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/website_sale_affiliate/odoo/addons/website_sale_affiliate
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 @@ | ||
../../../../website_sale_affiliate |
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,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
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,115 @@ | ||
================= | ||
Affiliate Program | ||
================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:23190d8c4c1e8fceddf5e8d03b8b4d96e2cda899540a9f3baff2ded30fadcf04 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html | ||
:alt: License: LGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github | ||
:target: https://github.com/OCA/e-commerce/tree/14.0/website_sale_affiliate | ||
:alt: OCA/e-commerce | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/e-commerce-14-0/e-commerce-14-0-website_sale_affiliate | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=14.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows for the creation of affiliates and the tracking of | ||
sales conversions generated by them. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you must first create at least one affiliate (found | ||
in Website/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} | ||
|
||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_sale_affiliate%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* LasLabs | ||
|
||
Contributors | ||
------------ | ||
|
||
- Brent Hughes <[email protected]> | ||
- Dave Lasley <[email protected]> | ||
- Eugene Molotov <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/14.0/website_sale_affiliate>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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": "Create an e-commerce affiliate program for the tracking of " | ||
"referrals and conversions.", | ||
"version": "14.0.1.0.0", | ||
"category": "E-Commerce", | ||
"website": "https://github.com/OCA/e-commerce", | ||
"author": "LasLabs, Odoo Community Association (OCA)", | ||
"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,32 @@ | ||
# Copyright 2017 LasLabs Inc. | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl) | ||
|
||
from odoo.http import request, route | ||
|
||
from odoo.addons.website_sale.controllers.main import WebsiteSale as Base | ||
|
||
|
||
class WebsiteSale(Base): | ||
def _store_affiliate_info(self, **kwargs): | ||
Affiliate = request.env["sale.affiliate"] | ||
affiliate = Affiliate.sudo().find_from_kwargs(**kwargs) | ||
if not affiliate: | ||
return | ||
|
||
affiliate_request = affiliate.get_request(**kwargs) | ||
if not affiliate_request: | ||
return # pragma: no cover | ||
|
||
request.session["affiliate_request"] = affiliate_request.id | ||
|
||
@route() | ||
def shop(self, *args, **post): | ||
res = super(WebsiteSale, self).shop(*args, **post) | ||
self._store_affiliate_info(**post) | ||
return res | ||
|
||
@route() | ||
def product(self, *args, **kwargs): | ||
res = super(WebsiteSale, self).product(*args, **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,10 @@ | ||
<?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,28 @@ | ||
<?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 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 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.