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

[17.0][ADD] pos_session_sequence: New module pos_session_sequence #1280

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
98 changes: 98 additions & 0 deletions pos_session_sequence/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
====================
POS Session Sequence
====================

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

.. |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/17.0/pos_session_sequence
:alt: OCA/pos
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_session_sequence
: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=17.0
:alt: Try me on Runboat

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

This module allows you to configure multiple sequences for every session
in different points of sale.

**Table of contents**

.. contents::
:local:

Usage
=====

To use this module, you need to:

- Go to Configuration > Settings
- Setup ``Session Ids Sequence`` for the Point of Sale
- Open the session for the point of sale and you will see the name
computed with the sequence

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_session_sequence%0Aversion:%2017.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
-------

* Antoni Marroig
* APSL-Nagarro

Contributors
------------

[APSL-Nagarro](https://apsl.tech):

- Antoni Marroig <[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.

.. |maintainer-peluko00| image:: https://github.com/peluko00.png?size=40px
:target: https://github.com/peluko00
:alt: peluko00

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-peluko00|

This module is part of the `OCA/pos <https://github.com/OCA/pos/tree/17.0/pos_session_sequence>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions pos_session_sequence/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import models
23 changes: 23 additions & 0 deletions pos_session_sequence/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "POS Session Sequence",
"summary": "Generates a sequence of POS sessions",
"version": "17.0.1.0.0",
"category": "Uncategorized",
"website": "https://github.com/OCA/pos",
"author": "Antoni Marroig, APSL-Nagarro, Odoo Community Association (OCA)",
"maintainers": ["peluko00"],
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"point_of_sale",
],
"data": [
"views/res_config_settings_views.xml",
],
"demo": [
"demo/pos_session_sequence.xml",
],
}
12 changes: 12 additions & 0 deletions pos_session_sequence/demo/pos_session_sequence.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="pos_session_seq" model="ir.sequence">
<field name="name">POS Session Demo</field>
<field name="prefix">POS/%(y)s</field>
<field name="padding">5</field>
<field name="company_id" eval="False" />
</record>
<record id="point_of_sale.pos_config_main" model="pos.config">
<field name="session_sequence_id" eval="pos_session_seq" />
</record>
</odoo>
51 changes: 51 additions & 0 deletions pos_session_sequence/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_session_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-23 17:14+0000\n"
"PO-Revision-Date: 2024-12-23 17:14+0000\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_session_sequence
#: model:ir.model,name:pos_session_sequence.model_res_config_settings
msgid "Config Settings"
msgstr "Paràmetres de configuració"

#. module: pos_session_sequence
#: model_terms:ir.ui.view,arch_db:pos_session_sequence.res_config_settings_view_form_inherit
msgid "Generation of your sessions references"
msgstr "Generació de referències de les vostres sessions"

#. module: pos_session_sequence
#: model:ir.model,name:pos_session_sequence.model_pos_config
msgid "Point of Sale Configuration"
msgstr "Configuració del Punt de Venda"

#. module: pos_session_sequence
#: model:ir.model,name:pos_session_sequence.model_pos_session
msgid "Point of Sale Session"
msgstr "Sessió del Punt de Venda"

#. module: pos_session_sequence
#: model:ir.model.fields,field_description:pos_session_sequence.field_pos_config__session_sequence_id
#: model:ir.model.fields,field_description:pos_session_sequence.field_res_config_settings__pos_session_sequence_id
msgid "Session IDs Sequence"
msgstr "Seqüència d'IDs de sessió"

#. module: pos_session_sequence
#: model:ir.model.fields,help:pos_session_sequence.field_pos_config__session_sequence_id
#: model:ir.model.fields,help:pos_session_sequence.field_res_config_settings__pos_session_sequence_id
msgid ""
"This sequence is automatically created by Odoo but you can change it to "
"customize the reference numbers of your sessions."
msgstr "Aquesta seqüència la crea automàticament Odoo, però podeu canviar-la i "
"personalitzeu els números de referència de les vostres sessions."
51 changes: 51 additions & 0 deletions pos_session_sequence/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_session_sequence
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-12-23 17:14+0000\n"
"PO-Revision-Date: 2024-12-23 17:14+0000\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_session_sequence
#: model:ir.model,name:pos_session_sequence.model_res_config_settings
msgid "Config Settings"
msgstr "Ajustes de configuración"

#. module: pos_session_sequence
#: model_terms:ir.ui.view,arch_db:pos_session_sequence.res_config_settings_view_form_inherit
msgid "Generation of your sessions references"
msgstr "Generación de referencias de tus sesiones."

#. module: pos_session_sequence
#: model:ir.model,name:pos_session_sequence.model_pos_config
msgid "Point of Sale Configuration"
msgstr "Configuración del TPV"

#. module: pos_session_sequence
#: model:ir.model,name:pos_session_sequence.model_pos_session
msgid "Point of Sale Session"
msgstr "Sesión TPV"

#. module: pos_session_sequence
#: model:ir.model.fields,field_description:pos_session_sequence.field_pos_config__session_sequence_id
#: model:ir.model.fields,field_description:pos_session_sequence.field_res_config_settings__pos_session_sequence_id
msgid "Session IDs Sequence"
msgstr "Secuencia de IDs de sesión"

#. module: pos_session_sequence
#: model:ir.model.fields,help:pos_session_sequence.field_pos_config__session_sequence_id
#: model:ir.model.fields,help:pos_session_sequence.field_res_config_settings__pos_session_sequence_id
msgid ""
"This sequence is automatically created by Odoo but you can change it to "
"customize the reference numbers of your sessions."
msgstr "Odoo crea automáticamente esta secuencia, pero puedes cambiarla y "
"personaliza los números de referencia de tus sesiones."
5 changes: 5 additions & 0 deletions pos_session_sequence/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import pos_config
from . import pos_session
from . import res_config_settings
21 changes: 21 additions & 0 deletions pos_session_sequence/models/pos_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

def _default_session_sequence_id(self):
return self.env.ref("point_of_sale.seq_pos_session").id

session_sequence_id = fields.Many2one(
"ir.sequence",
string="Session IDs Sequence",
help="This sequence is automatically created by Odoo but you can change it "
"to customize the reference numbers of your sessions.",
copy=False,
ondelete="restrict",
default=_default_session_sequence_id,
)
16 changes: 16 additions & 0 deletions pos_session_sequence/models/pos_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


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

@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
if res.config_id.session_sequence_id:
pos_name = res.config_id.session_sequence_id._next()
res.update({"name": pos_name})
return res
12 changes: 12 additions & 0 deletions pos_session_sequence/models/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2024 Antoni Marroig(APSL-Nagarro)<[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


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

pos_session_sequence_id = fields.Many2one(
related="pos_config_id.session_sequence_id"
)
3 changes: 3 additions & 0 deletions pos_session_sequence/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions pos_session_sequence/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\[APSL-Nagarro\](<https://apsl.tech>):
- Antoni Marroig \<<[email protected]>\>
2 changes: 2 additions & 0 deletions pos_session_sequence/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows you to configure multiple sequences for every session in different points of sale.

6 changes: 6 additions & 0 deletions pos_session_sequence/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

To use this module, you need to:

- Go to Configuration > Settings
- Setup `Session Ids Sequence` for the Point of Sale
- Open the session for the point of sale and you will see the name computed with the sequence
Binary file added pos_session_sequence/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading