Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

@ -0,0 +1,46 @@
# POS Container Deposit
Odoo addon: pos_container_deposit
## Installation
```bash
pip install odoo-bringout-oca-pos-pos_container_deposit
```
## Dependencies
This addon depends on:
- point_of_sale
## Manifest Information
- **Name**: POS Container Deposit
- **Version**: 16.0.1.0.0
- **Category**: Point of Sale
- **License**: AGPL-3
- **Installable**: True
## Source
Based on [OCA/pos](https://github.com/OCA/pos) branch 16.0, addon `pos_container_deposit`.
## License
This package maintains the original AGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Reports: doc/REPORTS.md
- Security: doc/SECURITY.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph Pos_container_deposit Module - pos_container_deposit
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for pos_container_deposit. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,5 @@
# Dependencies
This addon depends on:
- [point_of_sale](../../odoo-bringout-oca-ocb-point_of_sale)

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon pos_container_deposit or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-pos-pos_container_deposit"
# or
uv pip install odoo-bringout-oca-pos-pos_container_deposit"
```

View file

@ -0,0 +1,14 @@
# Models
Detected core models and extensions in pos_container_deposit.
```mermaid
classDiagram
class pos_session
class product_product
class product_template
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: pos_container_deposit. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon pos_container_deposit
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View file

@ -0,0 +1,8 @@
# Security
This module does not define custom security rules or access controls beyond Odoo defaults.
Default Odoo security applies:
- Base user access through standard groups
- Model access inherited from dependencies
- No custom row-level security rules

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon pos_container_deposit
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,117 @@
=====================
POS Container Deposit
=====================
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:32a0d00fa71650c51313d74e5b39e1bbec3b17934e275fd3b2e875411d4422f4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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 <tom@sunflowerweb.nl>
Holger Brunn <mail@hunki-enterprises.com> (https://hunki-enterprises.com)
Stefan Rijnhart <stefan@opener.am>
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.

View file

@ -0,0 +1 @@
from . import models

View file

@ -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,
}

View file

@ -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>

View file

@ -0,0 +1,85 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_container_deposit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: pos_container_deposit
#: model:product.template,name:pos_container_deposit.demo_deposit_product_product_template
msgid "Bottle deposit .25"
msgstr "Bottle deposit .25"
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__is_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__is_deposit
msgid "Check this if this product is a container for which you charge deposit"
msgstr "Check this if this product is a container for which you charge deposit"
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_product__deposit_product_id
msgid "Deposit"
msgstr "Polog"
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid "Deposit not available"
msgstr "Deposit not available"
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_template__deposit_product_id
msgid "Deposit product"
msgstr "Deposit product"
#. module: pos_container_deposit
#: model:product.template,name:pos_container_deposit.demo_product_product_template
msgid "Generic sugar liquid"
msgstr "Generic sugar liquid"
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__deposit_product_id
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__deposit_product_id
msgid ""
"If this product is packaged in a container for which you charge deposit, add"
" a product here that stands for the deposit"
msgstr ""
#. 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 "Is Deposit"
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_pos_session
msgid "Point of Sale Session"
msgstr "Sesija POS-a"
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_template
msgid "Product"
msgstr "Artikal"
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_product
msgid "Product Variant"
msgstr "Varijanta proizvoda"
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid ""
"The product %s is configured as having a deposit but the deposit product %s "
"is not available in POS."
msgstr ""

View file

@ -0,0 +1,94 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_container_deposit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-02-03 22:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"
#. module: pos_container_deposit
#: model:product.template,name:pos_container_deposit.demo_deposit_product_product_template
msgid "Bottle deposit .25"
msgstr "Cauzione bottiglia .25"
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__is_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__is_deposit
msgid "Check this if this product is a container for which you charge deposit"
msgstr ""
"Selezionare se questo prodotto è un contenitore per il quale si applica una "
"cauzione"
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_product__deposit_product_id
msgid "Deposit"
msgstr "Deposito"
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid "Deposit not available"
msgstr "Deposito non disponibile"
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_template__deposit_product_id
msgid "Deposit product"
msgstr "Prodotto deposito"
#. module: pos_container_deposit
#: model:product.template,name:pos_container_deposit.demo_product_product_template
msgid "Generic sugar liquid"
msgstr "Liquido dolcificante generico"
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__deposit_product_id
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__deposit_product_id
msgid ""
"If this product is packaged in a container for which you charge deposit, add"
" a product here that stands for the deposit"
msgstr ""
"Se questo prodotto è imballato in un contenitore per il quale si applica una "
"cauzione, aggiungere qui un prodotto per la cauzione"
#. 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 "È una cauzione"
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_pos_session
msgid "Point of Sale Session"
msgstr "Sessione punto vendita"
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_template
msgid "Product"
msgstr "Prodotto"
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_product
msgid "Product Variant"
msgstr "Variante prodotto"
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid ""
"The product %s is configured as having a deposit but the deposit product %s "
"is not available in POS."
msgstr ""
"Il prodotto %s è configurato con una cauzione ma il prodotto cauzione %s non "
"è disponibile nel POS."

View file

@ -0,0 +1,94 @@
# 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:product.template,name:pos_container_deposit.demo_deposit_product_product_template
msgid "Bottle deposit .25"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__is_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__is_deposit
msgid "Check this if this product is a container for which you charge deposit"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_product__deposit_product_id
#, fuzzy
msgid "Deposit"
msgstr "Statiegeld"
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid "Deposit not available"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_template__deposit_product_id
msgid "Deposit product"
msgstr ""
#. module: pos_container_deposit
#: model:product.template,name:pos_container_deposit.demo_product_product_template
msgid "Generic sugar liquid"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__deposit_product_id
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__deposit_product_id
msgid ""
"If this product is packaged in a container for which you charge deposit, add "
"a product here that stands for the deposit"
msgstr ""
#. 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_pos_session
msgid "Point of Sale Session"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_template
#, fuzzy
msgid "Product"
msgstr "Productsjabloon"
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_product
#, fuzzy
msgid "Product Variant"
msgstr "Productsjabloon"
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid ""
"The product %s is configured as having a deposit but the deposit product %s "
"is not available in POS."
msgstr ""
#~ msgid "Select Deposit"
#~ msgstr "Statiegeldproduct"

View file

@ -0,0 +1,85 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_container_deposit
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: pos_container_deposit
#: model:product.template,name:pos_container_deposit.demo_deposit_product_product_template
msgid "Bottle deposit .25"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__is_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__is_deposit
msgid "Check this if this product is a container for which you charge deposit"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_product__deposit_product_id
msgid "Deposit"
msgstr ""
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid "Deposit not available"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,field_description:pos_container_deposit.field_product_template__deposit_product_id
msgid "Deposit product"
msgstr ""
#. module: pos_container_deposit
#: model:product.template,name:pos_container_deposit.demo_product_product_template
msgid "Generic sugar liquid"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model.fields,help:pos_container_deposit.field_product_product__deposit_product_id
#: model:ir.model.fields,help:pos_container_deposit.field_product_template__deposit_product_id
msgid ""
"If this product is packaged in a container for which you charge deposit, add"
" a product here that stands for the deposit"
msgstr ""
#. 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_pos_session
msgid "Point of Sale Session"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_template
msgid "Product"
msgstr ""
#. module: pos_container_deposit
#: model:ir.model,name:pos_container_deposit.model_product_product
msgid "Product Variant"
msgstr ""
#. module: pos_container_deposit
#. odoo-javascript
#: code:addons/pos_container_deposit/static/src/js/models.js:0
#, python-format
msgid ""
"The product %s is configured as having a deposit but the deposit product %s "
"is not available in POS."
msgstr ""

View file

@ -0,0 +1,3 @@
from . import pos_session
from . import product_product
from . import product_template

View file

@ -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

View file

@ -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",
)

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -0,0 +1,3 @@
Tom Blauwendraat <tom@sunflowerweb.nl>
Holger Brunn <mail@hunki-enterprises.com> (https://hunki-enterprises.com)
Stefan Rijnhart <stefan@opener.am>

View file

@ -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.

View file

@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View file

@ -0,0 +1,461 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>POS Container Deposit</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="pos-container-deposit">
<h1 class="title">POS Container Deposit</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:32a0d00fa71650c51313d74e5b39e1bbec3b17934e275fd3b2e875411d4422f4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/pos/tree/16.0/pos_container_deposit"><img alt="OCA/pos" src="https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_container_deposit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/pos&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows the use of deposit products for PoS products.</p>
<p>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.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#use-cases-context" id="toc-entry-1">Use Cases / Context</a></li>
<li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-3">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-6">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="use-cases-context">
<h1><a class="toc-backref" href="#toc-entry-1">Use Cases / Context</a></h1>
<p>Note there are several implementations of the concept of deposits with varying degrees of complexity:</p>
<ul class="simple">
<li><a class="reference external" href="https://odoo-community.org/shop/product-packaging-container-deposit-715405">product_packaging_container_deposit</a></li>
<li><a class="reference external" href="https://odoo-community.org/shop/pos-product-pack-716088">pos_product_pack</a></li>
</ul>
<p>This module focusses on simplicity for users who dont want to get into packaging.</p>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
<p>To configure this module, you need to go to <em>Point of Sale &gt; Products</em>.</p>
<ol class="arabic simple">
<li>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.</li>
<li>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.</li>
</ol>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
<p>To use this module, open a POS session and:</p>
<ol class="arabic simple">
<li>When a deposit product (eg. cola) is added, the bottle is added to the
order as well and the quantities are kept in sync.</li>
<li>When someone brings back bottles to the store, you can just add a bottle
and enter a negative sale quantity, thus refunding the bottle.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pos/issues">GitHub Issues</a>.
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
<a class="reference external" href="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**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
<ul class="simple">
<li>Sunflower IT</li>
<li>Open2bizz</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<p>Tom Blauwendraat &lt;<a class="reference external" href="mailto:tom&#64;sunflowerweb.nl">tom&#64;sunflowerweb.nl</a>&gt;
Holger Brunn &lt;<a class="reference external" href="mailto:mail&#64;hunki-enterprises.com">mail&#64;hunki-enterprises.com</a>&gt; (<a class="reference external" href="https://hunki-enterprises.com">https://hunki-enterprises.com</a>)
Stefan Rijnhart &lt;<a class="reference external" href="mailto:stefan&#64;opener.am">stefan&#64;opener.am</a>&gt;</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pos/tree/16.0/pos_container_deposit">OCA/pos</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,22 @@
/* Copyright 2024 Hunki Enterprises BV
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
odoo.define("pos_container_deposit.components", function (require) {
"use strict";
const Orderline = require("point_of_sale.Orderline");
const Registries = require("point_of_sale.Registries");
const PosDepositOrderlineExtension = (Orderline) =>
class PosDepositOrderline extends Orderline {
selectLine() {
/**
* Don't allow selecting deposit products
**/
if (!this.props.line.is_container_deposit) {
super.selectLine(...arguments);
}
}
};
Registries.Component.extend(Orderline, PosDepositOrderlineExtension);
});

View file

@ -0,0 +1,152 @@
/* Copyright 2024 Hunki Enterprises BV
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
*/
odoo.define("pos_container_deposit.models", function (require) {
"use strict";
const {Order, Orderline} = require("point_of_sale.models");
const Registries = require("point_of_sale.Registries");
const {Gui} = require("point_of_sale.Gui");
const core = require("web.core");
const _t = core._t;
const PosDepositOrderExtension = (Order) =>
class PosDepositOrder extends Order {
add_product(product) {
/**
* Show an error message when adding a product with a container deposit product that is not loaded
**/
var deposit = null;
if (product.deposit_product_id) {
deposit = this.pos.db.product_by_id[product.deposit_product_id[0]];
if (!deposit) {
Gui.showPopup("ErrorPopup", {
title: _t("Deposit not available"),
body: _.str.sprintf(
_t(
"The product %s is configured as having a deposit but the deposit product %s is not available in POS."
),
product.display_name,
product.deposit_product_id[1]
),
});
return false;
}
}
super.add_product(...arguments);
}
add_orderline(line) {
/**
* When adding a product with container deposit, add its container deposit product
**/
super.add_orderline(...arguments);
if (line.container_deposit_product && !line.container_deposit_line) {
this.add_product(line.container_deposit_product, {
quantity: line.get_quantity(),
});
line.container_deposit_line = this.get_last_orderline();
line.container_deposit_line.is_container_deposit = true;
this.select_orderline(line);
}
}
select_orderline(line) {
/**
* Never select an orderline with deposit, select one next to it instead
**/
if (line && line.is_container_deposit) {
const line_index = this.orderlines.indexOf(line);
if (line_index >= 0 && this.orderlines.length > 1) {
super.select_orderline(
this.orderlines[line_index ? line_index - 1 : 0]
);
}
} else {
super.select_orderline(...arguments);
}
}
};
const PosDepositOrderlineExtension = (Orderline) =>
class PosDepositOrderLine extends Orderline {
constructor() {
/**
* Set container deposit specific properties
**/
super(...arguments);
const deposit_product = this.product
? this.pos.db.get_product_by_id(this.product.id).deposit_product_id
: null;
if (deposit_product) {
this.container_deposit_product = this.pos.db.get_product_by_id(
deposit_product[0]
);
}
}
init_from_JSON(json) {
/**
* Restore container deposit specific properties and link between line with deposit and deposit line
**/
super.init_from_JSON(json);
if (json.container_deposit_line_id) {
this.container_deposit_line =
this.order.get_orderline(json.container_deposit_line_id) ||
json.container_deposit_line_id;
}
if (json.is_container_deposit) {
for (var i = 0; i < this.order.orderlines.length; i++) {
if (
this.order.orderlines[i].container_deposit_line === this.id
) {
this.order.orderlines[i].container_deposit_line = this;
break;
}
}
this.is_container_deposit = true;
}
}
export_as_JSON() {
/**
* Export deposit line as id
**/
const result = super.export_as_JSON();
result.is_container_deposit = this.is_container_deposit;
if (this.container_deposit_line) {
result.container_deposit_line_id = this.container_deposit_line.id;
}
return result;
}
set_quantity(quantity, keep_price) {
/**
* When setting quantity of a product with deposit, also add to its deposit line
**/
const difference =
quantity === "remove" ? -this.quantity : quantity - this.quantity;
const deposit_line = this.container_deposit_line;
const result = super.set_quantity(...arguments);
if ((difference || quantity === "remove") && deposit_line) {
var deposit_quantity = deposit_line.quantity + difference;
deposit_line.set_quantity(
deposit_quantity
? deposit_quantity
: quantity === "remove"
? quantity
: deposit_quantity,
keep_price
);
}
return result;
}
can_be_merged_with(orderline) {
/**
* Never merge deposit orderlines
**/
if (this.is_container_deposit || orderline.is_container_deposit) {
return false;
}
return super.can_be_merged_with(...arguments);
}
};
Registries.Model.extend(Order, PosDepositOrderExtension);
Registries.Model.extend(Orderline, PosDepositOrderlineExtension);
});

View file

@ -0,0 +1,46 @@
odoo.define("pos_container_deposit.test_tour", function (require) {
"use strict";
const {ProductScreen} = require("point_of_sale.tour.ProductScreenTourMethods");
const {getSteps, startSteps} = require("point_of_sale.tour.utils");
const Tour = require("web_tour.tour");
const product_name = "Generic sugar liquid";
const deposit_product_name = "Bottle deposit .25";
startSteps();
ProductScreen.do.clickHomeCategory();
ProductScreen.do.clickDisplayedProduct(product_name);
ProductScreen.do.clickDisplayedProduct(product_name);
ProductScreen.check.checkOrderlinesNumber(2);
ProductScreen.check.selectedOrderlineHas(product_name);
getSteps().push({
content: `selecting orderline with product '${deposit_product_name}' and quantity '2.0'`,
trigger: `.order .orderline:not(:has(.selected)) .product-name:contains("${deposit_product_name}") ~ .info-list em:contains("2.0")`,
});
ProductScreen.check.selectedOrderlineHas(product_name);
ProductScreen.do.pressNumpad("Price");
ProductScreen.check.modeIsActive("Price");
ProductScreen.do.pressNumpad("5");
ProductScreen.check.selectedOrderlineHas(product_name, "2", "10");
ProductScreen.do.clickDisplayedProduct(product_name);
ProductScreen.do.clickDisplayedProduct(product_name);
ProductScreen.check.checkOrderlinesNumber(4);
ProductScreen.do.pressNumpad("Qty");
ProductScreen.do.pressNumpad("Backspace");
ProductScreen.do.pressNumpad("Backspace");
ProductScreen.check.modeIsActive("Qty");
ProductScreen.check.selectedOrderlineHas(product_name, "2", "10");
ProductScreen.check.checkOrderlinesNumber(2);
ProductScreen.do.pressNumpad("Qty");
ProductScreen.do.pressNumpad("Backspace");
ProductScreen.do.pressNumpad("Backspace");
ProductScreen.check.modeIsActive("Qty");
ProductScreen.check.orderIsEmpty();
Tour.register(
"pos_container_deposit.test_tour",
{test: true, url: "/pos/ui"},
getSteps()
);
});

View file

@ -0,0 +1,2 @@
from . import test_pos_container_deposit
from . import test_pos_container_deposit_frontend

View file

@ -0,0 +1,49 @@
# Copyright 2024 Hunki Enterprises BV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestPosDeposit(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.deposit_product = cls.env.ref("pos_container_deposit.demo_deposit_product")
cls.product = cls.env.ref("pos_container_deposit.demo_product")
cls.product_template = cls.product.product_tmpl_id
def test_product_behavior(self):
"""
Test that product search, write, copy behaves as expected with deposit products
"""
self.assertIn(
self.product,
self.env["product.product"].search(
[
("deposit_product_id", "=", self.deposit_product.id),
]
),
)
self.assertIn(
self.product_template,
self.env["product.template"].search(
[
("deposit_product_id", "=", self.deposit_product.id),
]
),
)
self.product_template.deposit_product_id = False
self.assertFalse(self.product.deposit_product_id)
self.product.deposit_product_id = self.deposit_product
self.assertEqual(self.product_template.deposit_product_id, self.deposit_product)
product2 = self.product.copy({})
self.assertEqual(product2.deposit_product_id, self.deposit_product)
self.assertEqual(self.product_template.deposit_product_id, self.deposit_product)
template2 = self.product_template.copy()
self.assertEqual(template2.deposit_product_id, self.deposit_product)
def test_pos_session(self):
"""
Be sure the extra field and domain are included
"""
params = self.env["pos.session"]._loader_params_product_product()
self.assertIn("deposit_product_id", params["search_params"]["fields"])

View file

@ -0,0 +1,14 @@
from odoo.tests.common import tagged
from odoo.addons.point_of_sale.tests.test_frontend import TestPointOfSaleHttpCommon
@tagged("post_install", "-at_install")
class TestPosContainerDeposit(TestPointOfSaleHttpCommon):
def run_tour(self):
self.main_pos_config.open_ui()
self.start_tour(
"/pos/ui?config_id=%d" % self.main_pos_config.id,
"pos_container_deposit.test_tour",
login="accountman",
)

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="product_template_form_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="point_of_sale.product_template_form_view" />
<field name="arch" type="xml">
<group name="pos" position="inside">
<field
name="is_deposit"
attrs="{'invisible': ['|', '|', '|', ('deposit_product_id', '!=', False), ('sale_ok', '=', False), ('type', '=', 'service'), ('available_in_pos', '=', False)]}"
/>
<field
name="deposit_product_id"
attrs="{'invisible': ['|', '|', '|', '|', ('is_deposit', '!=', False), ('sale_ok', '=', False), ('type', '=', 'service'), ('available_in_pos', '=', False), '&amp;', ('product_variant_count', '&gt;', 1), ('is_product_variant', '=', False)]}"
/>
</group>
</field>
</record>
<record id="product_template_search_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view" />
<field name="arch" type="xml">
<separator position="before">
<field name="deposit_product_id" domain="[('is_deposit', '=', True)]" />
</separator>
</field>
</record>
</odoo>

View file

@ -0,0 +1,42 @@
[project]
name = "odoo-bringout-oca-pos-pos_container_deposit"
version = "16.0.0"
description = "POS Container Deposit - This module is used to manage container deposits for products in Point of Sale."
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-ocb-point_of_sale>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["pos_container_deposit"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]