-
-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by legalsylvain
- Loading branch information
Showing
25 changed files
with
1,100 additions
and
1 deletion.
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,117 @@ | ||
===================== | ||
POS Container Deposit | ||
===================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:08eafc2a868af163a631280209611f70bcd159c77f08568a6e8c9b93a7088910 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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%2Fpos-lightgray.png?logo=github | ||
:target: https://github.com/OCA/pos/tree/16.0/pos_container_deposit | ||
:alt: OCA/pos | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_container_deposit | ||
: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/pos&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows the use of deposit products for PoS products. | ||
|
||
An example of such a deposit product would be a bottle of cola, where the bottle is | ||
being sold for an extra 25 cents, which you get back when you bring the bottle back to | ||
the store intact. Whenever the cola is added to a PoS order, the bottle is added too. | ||
If the cola quantity changes, the bottle quantity will change as well. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Use Cases / Context | ||
=================== | ||
|
||
Note there are several implementations of the concept of deposits with varying degrees of complexity: | ||
|
||
- `product_packaging_container_deposit <https://odoo-community.org/shop/product-packaging-container-deposit-715405>`_ | ||
- `pos_product_pack <https://odoo-community.org/shop/pos-product-pack-716088>`_ | ||
|
||
This module focusses on simplicity for users who don't want to get into packaging. | ||
|
||
Configuration | ||
============= | ||
|
||
To configure this module, you need to go to *Point of Sale > Products*. | ||
|
||
#. Select or add at least one 'deposit product', such as 'Bottle 1L', | ||
with a non-zero price and with the checkbox 'Is Deposit' set to True. | ||
|
||
#. Select or add at least one product of which 'Use Deposit' is checked, | ||
such as '1 liter of cola'. In the accompanying product selection field, | ||
select the bottle. The two products are now linked. | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, open a POS session and: | ||
|
||
#. When a deposit product (eg. cola) is added, the bottle is added to the | ||
order as well and the quantities are kept in sync. | ||
|
||
#. When someone brings back bottles to the store, you can just add a bottle | ||
and enter a negative sale quantity, thus refunding the bottle. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pos/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/pos/issues/new?body=module:%20pos_container_deposit%0Aversion:%2016.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 | ||
~~~~~~~ | ||
|
||
* Sunflower IT | ||
* Open2bizz | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
Tom Blauwendraat <[email protected]> | ||
Holger Brunn <[email protected]> (https://hunki-enterprises.com) | ||
Stefan Rijnhart <[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/pos <https://github.com/OCA/pos/tree/16.0/pos_container_deposit>`_ 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 @@ | ||
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,26 @@ | ||
{ | ||
"name": "POS Container Deposit", | ||
"version": "16.0.1.0.0", | ||
"category": "Point of Sale", | ||
"summary": "This module is used to manage container deposits for products" | ||
" in Point of Sale.", | ||
"author": "Sunflower IT, Open2bizz, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/pos", | ||
"license": "AGPL-3", | ||
"depends": ["point_of_sale"], | ||
"data": [ | ||
"views/product_template.xml", | ||
], | ||
"demo": [ | ||
"demo/product_product.xml", | ||
], | ||
"assets": { | ||
"web.assets_tests": [ | ||
"pos_container_deposit/static/tests/tours/*.js", | ||
], | ||
"point_of_sale.assets": [ | ||
"pos_container_deposit/static/src/js/*.js", | ||
], | ||
}, | ||
"installable": 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,17 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
<record id="demo_deposit_product" model="product.product"> | ||
<field name="name">Bottle deposit .25</field> | ||
<field name="sale_ok" eval="True" /> | ||
<field name="is_deposit" eval="True" /> | ||
<field name="available_in_pos" eval="True" /> | ||
<field name="lst_price">0.25</field> | ||
</record> | ||
<record id="demo_product" model="product.product"> | ||
<field name="name">Generic sugar liquid</field> | ||
<field name="sale_ok" eval="True" /> | ||
<field name="available_in_pos" eval="True" /> | ||
<field name="deposit_product_id" ref="demo_deposit_product" /> | ||
<field name="lst_price">1.75</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,40 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * pos_container_deposit | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 8.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2021-04-07 08:23+0000\n" | ||
"PO-Revision-Date: 2015-12-07 14:46+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"Language: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: pos_container_deposit | ||
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_product__is_deposit | ||
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_template__is_deposit | ||
msgid "Is Deposit" | ||
msgstr "" | ||
|
||
#. module: pos_container_deposit | ||
#: model:ir.model,name:pos_container_deposit.model_product_template | ||
msgid "Product Template" | ||
msgstr "Productsjabloon" | ||
|
||
#. module: pos_container_deposit | ||
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_product__select_deposit | ||
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_template__select_deposit | ||
msgid "Select Deposit" | ||
msgstr "Statiegeldproduct" | ||
|
||
#. module: pos_container_deposit | ||
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_product__use_deposit | ||
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_template__use_deposit | ||
msgid "Use Deposit" | ||
msgstr "Statiegeld" |
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,3 @@ | ||
from . import pos_session | ||
from . import product_product | ||
from . import product_template |
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,13 @@ | ||
from odoo import models | ||
|
||
|
||
class PosSession(models.Model): | ||
_inherit = "pos.session" | ||
|
||
def _loader_params_product_product(self): | ||
""" | ||
Load all deposit products and add deposit related fields | ||
""" | ||
result = super()._loader_params_product_product() | ||
result["search_params"]["fields"] += ["deposit_product_id", "is_deposit"] | ||
return result |
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,16 @@ | ||
# Copyright 2021 Sunflower IT | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ProductProduct(models.Model): | ||
_inherit = "product.product" | ||
|
||
deposit_product_id = fields.Many2one( | ||
"product.product", | ||
"Deposit", | ||
domain=[("is_deposit", "!=", False)], | ||
help="If this product is packaged in a container for which you charge deposit, " | ||
"add a product here that stands for the deposit", | ||
) |
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,58 @@ | ||
# Copyright 2024 Hunki Enterprises BV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
is_deposit = fields.Boolean( | ||
help="Check this if this product is a container for which you charge deposit", | ||
) | ||
deposit_product_id = fields.Many2one( | ||
"product.product", | ||
"Deposit product", | ||
domain=[("is_deposit", "!=", False)], | ||
help="If this product is packaged in a container for which you charge deposit, " | ||
"add a product here that stands for the deposit", | ||
compute="_compute_deposit_product_id", | ||
inverse="_inverse_deposit_product_id", | ||
search="_search_deposit_product_id", | ||
) | ||
|
||
@api.depends("product_variant_ids.deposit_product_id") | ||
def _compute_deposit_product_id(self): | ||
for this in self: | ||
this.deposit_product_id = ( | ||
this.product_variant_ids.deposit_product_id | ||
if this.product_variant_count == 1 | ||
else False | ||
) | ||
|
||
def _inverse_deposit_product_id(self): | ||
for this in self: | ||
if this.product_variant_count > 1: | ||
continue | ||
this.product_variant_ids.write( | ||
{ | ||
"deposit_product_id": this.deposit_product_id, | ||
} | ||
) | ||
|
||
def _search_deposit_product_id(self, operator, value): | ||
return [("product_variant_ids.deposit_product_id", operator, value)] | ||
|
||
def copy(self, default=None): | ||
""" | ||
Take care that copies include the deposit product | ||
""" | ||
if default is None: | ||
default = {} | ||
default.setdefault("deposit_product_id", self.deposit_product_id.id) | ||
return super().copy(default=default) | ||
|
||
def _get_related_fields_variant_template(self): | ||
result = super()._get_related_fields_variant_template() | ||
result.append("deposit_product_id") | ||
return result |
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,8 @@ | ||
To configure this module, you need to go to *Point of Sale > Products*. | ||
|
||
#. Select or add at least one 'deposit product', such as 'Bottle 1L', | ||
with a non-zero price and with the checkbox 'Is Deposit' set to True. | ||
|
||
#. Select or add at least one product of which 'Use Deposit' is checked, | ||
such as '1 liter of cola'. In the accompanying product selection field, | ||
select the bottle. The two products are now linked. |
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 @@ | ||
Note there are several implementations of the concept of deposits with varying degrees of complexity: | ||
|
||
- `product_packaging_container_deposit <https://odoo-community.org/shop/product-packaging-container-deposit-715405>`_ | ||
- `pos_product_pack <https://odoo-community.org/shop/pos-product-pack-716088>`_ | ||
|
||
This module focusses on simplicity for users who don't want to get into packaging. |
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,3 @@ | ||
Tom Blauwendraat <[email protected]> | ||
Holger Brunn <[email protected]> (https://hunki-enterprises.com) | ||
Stefan Rijnhart <[email protected]> |
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 @@ | ||
This module allows the use of deposit products for PoS products. | ||
|
||
An example of such a deposit product would be a bottle of cola, where the bottle is | ||
being sold for an extra 25 cents, which you get back when you bring the bottle back to | ||
the store intact. Whenever the cola is added to a PoS order, the bottle is added too. | ||
If the cola quantity changes, the bottle quantity will change as well. |
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,7 @@ | ||
To use this module, open a POS session and: | ||
|
||
#. When a deposit product (eg. cola) is added, the bottle is added to the | ||
order as well and the quantities are kept in sync. | ||
|
||
#. When someone brings back bottles to the store, you can just add a bottle | ||
and enter a negative sale quantity, thus refunding the bottle. |
Oops, something went wrong.