Skip to content

Commit

Permalink
Add shopinvader_sale_packaging_wishlist
Browse files Browse the repository at this point in the history
  • Loading branch information
simahawk committed Aug 17, 2020
1 parent 62e8049 commit 9e61eba
Show file tree
Hide file tree
Showing 14 changed files with 739 additions and 31 deletions.
66 changes: 66 additions & 0 deletions shopinvader_sale_packaging_wishlist/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
====================
Shopinvader Wishlist
====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fodoo--shopinvader-lightgray.png?logo=github
:target: https://github.com/shopinvader/odoo-shopinvader/tree/13.0/shopinvader_wishlist
:alt: shopinvader/odoo-shopinvader

|badge1| |badge2| |badge3|

Expose wishlist features for Shopinvader websites.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/odoo-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/odoo-shopinvader/issues/new?body=module:%20shopinvader_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]>
* Laurent Mignon <[email protected]>

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

The development of this module has been financially supported by:

* Camptocamp
* Cosanum

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

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

You are welcome to contribute.
1 change: 1 addition & 0 deletions shopinvader_sale_packaging_wishlist/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import services
20 changes: 20 additions & 0 deletions shopinvader_sale_packaging_wishlist/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2020 Camptocamp (http://www.camptocamp.com).
# @author Simone Orsi <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


{
"name": "Shopinvader Wishlist Packaging",
"summary": """Add packaging information to wishlists""",
"version": "13.0.1.0.0",
"license": "AGPL-3",
"author": "Camptocamp,Odoo Community Association (OCA)",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"depends": [
"shopinvader_sale_packaging",
"shopinvader_wishlist",
"sale_product_set_packaging_qty",
],
"installable": True,
"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_sale_packaging_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
1 change: 1 addition & 0 deletions shopinvader_sale_packaging_wishlist/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add packaging info to wishlist items.
1 change: 1 addition & 0 deletions shopinvader_sale_packaging_wishlist/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import wishlist
54 changes: 54 additions & 0 deletions shopinvader_sale_packaging_wishlist/services/wishlist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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):
_name = "shopinvader.wishlist.service"
_inherit = [
"shopinvader.wishlist.service",
"shopinvader.packaging.service.mixin",
]

def _validator_line_schema(self):
res = super()._validator_line_schema()
res.update(self._validator_packaging_info())
return res

def _json_parser_line(self):
return super()._json_parser_line() + self._json_parser_line_packaging()

def _json_parser_line_packaging(self):
return [
(
"product_id:packaging_by_qty",
self._json_parser_product_packaging,
),
("product_packaging_id:packaging", ("id", "name")),
"product_packaging_qty:packaging_qty",
]

def _json_parser_product(self):
return super()._json_parser_product() + [
"packaging",
"sell_only_by_packaging",
]

def _json_parser_product_packaging(self, rec, fname):
return self._packaging_info_by_qty(rec.product_id, rec.quantity)

def _prepare_item(self, record, params):
res = super()._prepare_item(record, params)
pkg_params = self._packaging_values_from_params(params)
if pkg_params:
res.update(pkg_params)
return res

def _packaging_values_from_params(self, params):
res = super()._packaging_values_from_params(params)
if "product_packaging" in res:
# On sale.order.line they named a m2o field w/out `_id` :/
res["product_packaging_id"] = res.pop("product_packaging")
return res
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9e61eba

Please sign in to comment.