Skip to content

Commit 9c85e95

Browse files
committed
[ADD]pos_partner_pricelist_load_background
1 parent f808797 commit 9c85e95

File tree

12 files changed

+636
-0
lines changed

12 files changed

+636
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
=====================================
2+
POS Partner Pricelist Load Background
3+
=====================================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-camptocamp%2Fpos-lightgray.png?logo=github
17+
:target: https://github.com/camptocamp/pos/tree/16.0/pos_partner_pricelist_load_background
18+
:alt: camptocamp/pos
19+
20+
|badge1| |badge2| |badge3|
21+
22+
This module allow you to load a pricelist for a customer in the background.
23+
24+
**Context**
25+
In the POS, we can configure a list of available pricelists. These price lists are loaded during start-up and only these can be chosen for any order.
26+
When a customer is selected, the POS will try to find the customer's pricelist (property_pricelist_id) among the available pricelists.
27+
If it's found, the pricelist is selected otherwise a default one will be selected instead.
28+
29+
**Whith this module**
30+
When a customer is selected, his pricelist (property_pricelist_id) is loaded and available to be chosen.
31+
32+
**Table of contents**
33+
34+
.. contents::
35+
:local:
36+
37+
Bug Tracker
38+
===========
39+
40+
Bugs are tracked on `GitHub Issues <https://github.com/camptocamp/pos/issues>`_.
41+
In case of trouble, please check there if your issue has already been reported.
42+
If you spotted it first, help us smashing it by providing a detailed and welcomed
43+
`feedback <https://github.com/camptocamp/pos/issues/new?body=module:%20pos_partner_pricelist_load_background%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
44+
45+
Do not contact contributors directly about support or help with technical issues.
46+
47+
Credits
48+
=======
49+
50+
Authors
51+
~~~~~~~
52+
53+
* Camptocamp
54+
55+
Contributors
56+
~~~~~~~~~~~~
57+
58+
* Telmo Santos <telmo.santos@camptocamp.com>
59+
* Iván Todorovich <ivan.todorovich@camptocamp.com>
60+
61+
Maintainers
62+
~~~~~~~~~~~
63+
64+
This module is part of the `camptocamp/pos <https://github.com/camptocamp/pos/tree/16.0/pos_partner_pricelist_load_background>`_ project on GitHub.
65+
66+
You are welcome to contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2024 Camptocamp (https://www.camptocamp.com).
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "POS Partner Pricelist Load Background",
6+
"summary": "",
7+
"version": "16.0.1.0.0",
8+
"author": "Camptocamp, Odoo Community Association (OCA)",
9+
"website": "https://github.com/OCA/pos",
10+
"license": "AGPL-3",
11+
"category": "Point of Sale",
12+
"depends": ["point_of_sale"],
13+
"installable": True,
14+
"assets": {
15+
"point_of_sale.assets": [
16+
"pos_partner_pricelist_load_background/static/src/js/**/*.js",
17+
],
18+
},
19+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import pos_session
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2024 Camptocamp
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
from odoo import models
4+
5+
6+
class POSSession(models.Model):
7+
_inherit = "pos.session"
8+
9+
def get_pos_ui_partner_pricelist(self, partner_id):
10+
pricelist = (
11+
self.env["res.partner"].browse(partner_id).property_product_pricelist
12+
)
13+
return self.get_pos_ui_product_pricelist(
14+
{"search_params": {"domain": [["id", "in", [pricelist.id]]]}}
15+
)
16+
17+
def get_pos_ui_product_pricelist(self, params):
18+
return self._get_pos_ui_product_pricelist(params)
19+
20+
def get_pos_ui_pricelist_product_product(self, pricelist_id):
21+
product_ids = (
22+
self.env["product.pricelist.item"]
23+
.search([("pricelist_id", "=", pricelist_id)])
24+
.mapped("product_id")
25+
.ids
26+
)
27+
28+
return self.get_pos_ui_product_product_by_params(
29+
{"domain": [["id", "in", product_ids]]}
30+
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* Telmo Santos <telmo.santos@camptocamp.com>
2+
* Iván Todorovich <ivan.todorovich@camptocamp.com>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This module allow you to load a pricelist for a customer in the background.
2+
3+
**Context**
4+
In the POS, we can configure a list of available pricelists. These price lists are loaded during start-up and only these can be chosen for any order.
5+
When a customer is selected, the POS will try to find the customer's pricelist (property_pricelist_id) among the available pricelists.
6+
If it's found, the pricelist is selected otherwise a default one will be selected instead.
7+
8+
**Whith this module**
9+
When a customer is selected, his pricelist (property_pricelist_id) is loaded and available to be chosen.

0 commit comments

Comments
 (0)