Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD][16.0] pos_default_quantity #1238

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6cb05bc
[ADD] pos_default_quantity: sets default orderline quantity
robinkeunen Feb 27, 2019
e7ac5cd
[ADD] pos_default_quantity: readme
robinkeunen Mar 11, 2019
f4c7447
[FIX] pos_default_quantity: don't set default quantity on restored lines
robinkeunen Dec 23, 2019
e920da6
[MIG] pos_default_quantity: migration to 10.0
vvrossem Apr 15, 2020
6aebfb7
[MIG] pos_default_quantity: migration to 11.0
vvrossem Apr 15, 2020
ecd706f
[MIG] pos_default_quantity: migration to 12.0
vvrossem Apr 15, 2020
8c84df2
[FIX] pos_default_quantity: adaptation to 12.0
vvrossem Apr 15, 2020
b490836
[IMP] pos_default_quantity: black formatter
vvrossem Apr 15, 2020
d70dba3
[CHG] pos_default_quantity: default value to 1
vvrossem Apr 15, 2020
48bb2ea
[FIX] pos_default_quantity: request changes
vvrossem May 6, 2020
20de7ab
[IMP] CI config and fixes
robinkeunen Jun 23, 2020
674c178
[FIX] precommit configuration
robinkeunen Sep 13, 2021
6afda80
[FIX] SCRLfs → SC
carmenbianca Jun 29, 2022
6c1c5fa
[UPD] README.rst
github-grap-bot Jun 29, 2022
b7d07d4
[IMP] Apply pre-commit, SCRLfs → SC
carmenbianca Jul 19, 2022
1fcfe81
[UPD] Update pos_default_quantity.pot
Jul 19, 2022
2ec6135
pos_default_quantity 12.0.1.0.1
github-grap-bot Jul 19, 2022
2499c5d
[FIX] pos_default_quantity: Improve description of module
carmenbianca Sep 24, 2024
ccb59e8
[FIX] pos_default_quantity: Use standard naming
carmenbianca Sep 24, 2024
56c7f82
[MIG] pos_default_quantity: Migration to 13.0
carmenbianca Sep 24, 2024
d57d4b2
[MIG] pos_default_quantity: Migration to 14.0
carmenbianca Sep 24, 2024
2c57c0c
[MIG] pos_default_quantity: Migration to 15.0
carmenbianca Sep 24, 2024
e8d9efa
[MIG] pos_default_quantity: Migration to 16.0
carmenbianca Sep 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions pos_default_quantity/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
===================================
Set Default Product Quantity in POS
===================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:60cae0baeb14f08a93c001a1e81418b21104863d6a2dd8560f9b9c352eb26de8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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_default_quantity
: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_default_quantity
: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 adds a field for a default quantity to Unit of Measure Categories.
When this is filled in, and when this functionality is enabled in the Point of
Sale configuration, then adding that product to an order in the Point of Sale
will set the quantity to that value by default.

**Table of contents**

.. contents::
:local:

Configuration
=============

In order to set this up, you need to do a few things:

- Make sure that you have permissions to manage multiple units of measure.
- In the settings of Inventory, enable units of measure.
- For each relevant unit of measure category, determine a default product quantity
(default: 1).
- For each relevant Point of Sale, find 'Set default product quantity' in the
'Inventory' section of its settings, and toggle it on.

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_default_quantity%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
~~~~~~~

* Coop IT Easy SC

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

* Robin Keunen <robin.keunen@coopiteasy.be>
* Vincent Van Rossem <vincent@coopiteasy.be>

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_default_quantity>`_ 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 pos_default_quantity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions pos_default_quantity/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2019 Coop IT Easy SC
# Robin Keunen <robin@coopiteasy.be>
# Vincent Van Rossem <vincent@coopiteasy.be>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Set Default Product Quantity in POS",
"version": "16.0.1.0.0",
"author": "Coop IT Easy SC, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pos",
"license": "AGPL-3",
"category": "Point of Sale",
"summary": """
When adding an order line in the point of sale, this module sets the
quantity to a configured default.
""",
"depends": ["point_of_sale"],
"data": [
"views/res_config_settings_views.xml",
"views/uom_category_views.xml",
],
"assets": {
"point_of_sale.assets": [
"pos_default_quantity/static/src/js/**/*.js",
]
},
}
36 changes: 36 additions & 0 deletions pos_default_quantity/i18n/pos_default_quantity.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_default_quantity
#
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: pos_default_quantity
#: model:ir.model.fields,field_description:pos_default_quantity.field_uom_category__pos_default_qty
msgid "POS Default Quantity"
msgstr ""

#. module: pos_default_quantity
#: model:ir.model,name:pos_default_quantity.model_pos_config
msgid "Point of Sale Configuration"
msgstr ""

#. module: pos_default_quantity
#: model:ir.model,name:pos_default_quantity.model_uom_category
msgid "Product UoM Categories"
msgstr ""

#. module: pos_default_quantity
#: model:ir.model.fields,field_description:pos_default_quantity.field_pos_config__set_default_product_quantity
#: model_terms:ir.ui.view,arch_db:pos_default_quantity.view_pos_config_form
msgid "Sets default product quantity in POS"
msgstr ""

5 changes: 5 additions & 0 deletions pos_default_quantity/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import pos_config
from . import pos_session
from . import product_template
from . import res_config_settings
from . import uom_category
13 changes: 13 additions & 0 deletions pos_default_quantity/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# © 2016 Robin Keunen, Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import fields, models


class PosConfig(models.Model):
_inherit = "pos.config"

set_default_product_quantity = fields.Boolean(
string="Set default product quantity in POS", default=False
)
14 changes: 14 additions & 0 deletions pos_default_quantity/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import models


class PosSession(models.Model):
_inherit = "pos.session"

def _loader_params_product_product(self):
result = super()._loader_params_product_product()
result["search_params"]["fields"].append("pos_default_qty")
return result
11 changes: 11 additions & 0 deletions pos_default_quantity/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

pos_default_qty = fields.Float(related="uom_id.category_id.pos_default_qty")
14 changes: 14 additions & 0 deletions pos_default_quantity/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: 2024 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

from odoo import fields, models


class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

pos_set_default_product_quantity = fields.Boolean(
related="pos_config_id.set_default_product_quantity",
readonly=False,
)
16 changes: 16 additions & 0 deletions pos_default_quantity/models/uom_category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# © 2016 Robin Keunen, Coop IT Easy SC
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import fields, models


class UoMCategory(models.Model):
_inherit = "uom.category"

# TODO: Should this be hidden behind a boolean toggle?
pos_default_qty = fields.Float(
string="POS Default Quantity",
required=True,
default=1,
)
8 changes: 8 additions & 0 deletions pos_default_quantity/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
In order to set this up, you need to do a few things:

- Make sure that you have permissions to manage multiple units of measure.
- In the settings of Inventory, enable units of measure.
- For each relevant unit of measure category, determine a default product quantity
(default: 1).
- For each relevant Point of Sale, find 'Set default product quantity' in the
'Inventory' section of its settings, and toggle it on.
2 changes: 2 additions & 0 deletions pos_default_quantity/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Robin Keunen <robin.keunen@coopiteasy.be>
* Vincent Van Rossem <vincent@coopiteasy.be>
4 changes: 4 additions & 0 deletions pos_default_quantity/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This module adds a field for a default quantity to Unit of Measure Categories.
When this is filled in, and when this functionality is enabled in the Point of
Sale configuration, then adding that product to an order in the Point of Sale
will set the quantity to that value by default.
Loading
Loading