Skip to content

Commit

Permalink
[MIG] shopinvader_customer_price_wishlist: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chafique-delli authored and kevinkhao committed Oct 6, 2021
1 parent bd7d8ed commit cc7aa29
Show file tree
Hide file tree
Showing 11 changed files with 608 additions and 0 deletions.
67 changes: 67 additions & 0 deletions shopinvader_customer_price_wishlist/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
==========================
Shopinvader Customer Price
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fshopinvader-lightgray.png?logo=github
:target: https://github.com/shopinvader/shopinvader/tree/13.0/shopinvader_customer_price_wishlist
:alt: shopinvader/shopinvader

|badge1| |badge2| |badge3|

Glue auto-installable module for `shopinvader_customer_price` and `shopinvader_wishlist`.

Overrides wishlist items prices with customer specific prices.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/shopinvader/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 <https://github.com/shopinvader/shopinvader/issues/new?body=module:%20shopinvader_customer_price_wishlist%0Aversion:%2013.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
~~~~~~~

* Camptocamp

Contributors
~~~~~~~~~~~~

* Simone Orsi <[email protected]>

Other credits
~~~~~~~~~~~~~

The development of this module has been financially supported by:

* Camptocamp
* Cosanum

Maintainers
~~~~~~~~~~~

This module is part of the `shopinvader/shopinvader <https://github.com/shopinvader/shopinvader/tree/13.0/shopinvader_customer_price_wishlist>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions shopinvader_customer_price_wishlist/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import services
13 changes: 13 additions & 0 deletions shopinvader_customer_price_wishlist/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Shopinvader Customer Price",
"summary": """Expose customer's specific prices.""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Camptocamp,Odoo Community Association (OCA)",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"depends": ["shopinvader_customer_price", "shopinvader_wishlist"],
"auto_install": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Simone Orsi <[email protected]>
4 changes: 4 additions & 0 deletions shopinvader_customer_price_wishlist/readme/CREDITS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The development of this module has been financially supported by:

* Camptocamp
* Cosanum
3 changes: 3 additions & 0 deletions shopinvader_customer_price_wishlist/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Glue auto-installable module for `shopinvader_customer_price` and `shopinvader_wishlist`.

Overrides wishlist items prices with customer specific prices.
1 change: 1 addition & 0 deletions shopinvader_customer_price_wishlist/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import wishlist
30 changes: 30 additions & 0 deletions shopinvader_customer_price_wishlist/services/wishlist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright 2020 Camptocamp (http://www.camptocamp.com).
# @author Simone Orsi <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component


class WishlistService(Component):
_inherit = "shopinvader.wishlist.service"

_customer_price_service = None

@property
def customer_price_service(self):
if self._customer_price_service:
return self._customer_price_service
self._customer_price_service = self.component(usage="customer_price")
return self._customer_price_service

def _json_parser_product_price(self, rec, fname):
return self.customer_price_service._get_price(rec, fname)

# TODO: if we had a centralized way to retrieve prices for customers
# we could avoid this module completely.
def _json_parser_product_data(self, rec, fname):
res = super()._json_parser_product_data(rec, fname)
res["price"] = self._json_parser_product_price(
rec.shopinvader_variant_id, fname
)
return res
Loading

0 comments on commit cc7aa29

Please sign in to comment.