Skip to content

Commit

Permalink
Merge PR #1041 into 13.0
Browse files Browse the repository at this point in the history
Signed-off-by simahawk
  • Loading branch information
OCA-git-bot committed Jan 10, 2020
2 parents 61e38a4 + 51f4cdd commit 4df7e6a
Show file tree
Hide file tree
Showing 17 changed files with 796 additions and 0 deletions.
93 changes: 93 additions & 0 deletions sale_wishlist/README.rst
@@ -0,0 +1,93 @@
=============
Sale 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-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/12.0/sale_wishlist
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-12-0/sale-workflow-12-0-sale_wishlist
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/167/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

Extends `sale_product_set` features to add a new typology: wishlist.
This module can serve as base to handle multiple wishlists for a customer,
being or not e-commerce related.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

* Define a *product set* as sale manager and select typology "wishlist"
* Assign it to a partner
* On the partner you'll see a smart button that brings you to customer's wishlists
* Once you clicked on it you can create more wishlists for that customer.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/OCA/sale-workflow/issues/new?body=module:%20sale_wishlist%0Aversion:%2012.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 SA

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

* Simone Orsi <simone.orsi@camptocamp.com>

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

The development of this module has been financially supported by:

* Camptocamp
* Cosanum

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/sale-workflow <https://github.com/OCA/sale-workflow/tree/12.0/sale_wishlist>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions sale_wishlist/__init__.py
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions sale_wishlist/__manifest__.py
@@ -0,0 +1,14 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Sale Wishlist",
"summary": """
Handle sale wishlist for partners""",
"version": "13.0.1.0.0",
"license": "AGPL-3",
"author": "Camptocamp SA,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"depends": ["sale_product_set"],
"data": ["views/product_set.xml", "views/partner.xml"],
}
58 changes: 58 additions & 0 deletions sale_wishlist/i18n/sale_wishlist.pot
@@ -0,0 +1,58 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_wishlist
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_wishlist
#: model:ir.model.fields,field_description:sale_wishlist.field_res_partner__wishlists_count
#: model:ir.model.fields,field_description:sale_wishlist.field_res_users__wishlists_count
msgid "# Wishlists"
msgstr ""

#. module: sale_wishlist
#: model_terms:ir.ui.view,arch_db:sale_wishlist.res_partner_view_form
msgid "<span class=\"o_stat_text\">Wishlists</span>"
msgstr ""

#. module: sale_wishlist
#: model:ir.model,name:sale_wishlist.model_res_partner
msgid "Contact"
msgstr ""

#. module: sale_wishlist
#: selection:product.set,typology:0
msgid "Default"
msgstr ""

#. module: sale_wishlist
#: model:ir.model,name:sale_wishlist.model_product_set
msgid "Product set"
msgstr ""

#. module: sale_wishlist
#: model:ir.model.fields,field_description:sale_wishlist.field_product_set__typology
#: model_terms:ir.ui.view,arch_db:sale_wishlist.view_product_set_search
msgid "Typology"
msgstr ""

#. module: sale_wishlist
#: selection:product.set,typology:0
msgid "Wishlist"
msgstr ""

#. module: sale_wishlist
#: code:addons/sale_wishlist/models/res_partner.py:39
#, python-format
msgid "Wishlists"
msgstr ""

2 changes: 2 additions & 0 deletions sale_wishlist/models/__init__.py
@@ -0,0 +1,2 @@
from . import product_set
from . import res_partner
13 changes: 13 additions & 0 deletions sale_wishlist/models/product_set.py
@@ -0,0 +1,13 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class ProductSet(models.Model):

_inherit = "product.set"

typology = fields.Selection(
selection=[("set", "Default"), ("wishlist", "Wishlist")], default="set"
)
43 changes: 43 additions & 0 deletions sale_wishlist/models/res_partner.py
@@ -0,0 +1,43 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, fields, models


class ResPartner(models.Model):

_inherit = "res.partner"

wishlists_count = fields.Integer(
compute="_compute_wishlists_count", string="# Wishlists"
)

def _compute_wishlists_count(self):
# do just one query for all records
data = self.env["product.set"].read_group(
self._wishlist_domain(), ["partner_id"], ["partner_id"]
)
data_mapped = {
count["partner_id"][0]: count["partner_id_count"] for count in data
}
for rec in self:
rec.wishlists_count = data_mapped.get(rec.id, 0)

def _wishlist_domain(self):
return [("partner_id", "in", self.ids), ("typology", "=", "wishlist")]

def action_view_wishlists(self):
self.ensure_one()
action = self.env.ref("sale_product_set.act_open_product_set_view")
res = action.read()[0]
res.update(
{
"name": _("Wishlists"),
"domain": self._wishlist_domain(),
"context": {
"default_typology": "wishlist",
"default_partner_id": self.id,
},
}
)
return res
1 change: 1 addition & 0 deletions sale_wishlist/readme/CONTRIBUTORS.rst
@@ -0,0 +1 @@
* Simone Orsi <simone.orsi@camptocamp.com>
4 changes: 4 additions & 0 deletions sale_wishlist/readme/CREDITS.rst
@@ -0,0 +1,4 @@
The development of this module has been financially supported by:

* Camptocamp
* Cosanum
3 changes: 3 additions & 0 deletions sale_wishlist/readme/DESCRIPTION.rst
@@ -0,0 +1,3 @@
Extends `sale_product_set` features to add a new typology: wishlist.
This module can serve as base to handle multiple wishlists for a customer,
being or not e-commerce related.
6 changes: 6 additions & 0 deletions sale_wishlist/readme/USAGE.rst
@@ -0,0 +1,6 @@
To use this module, you need to:

* Define a *product set* as sale manager and select typology "wishlist"
* Assign it to a partner
* On the partner you'll see a smart button that brings you to customer's wishlists
* Once you clicked on it you can create more wishlists for that customer.
Binary file added sale_wishlist/static/description/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4df7e6a

Please sign in to comment.