Skip to content

Commit 079a2d8

Browse files
santostelmocyrilmanuel
authored andcommitted
[ADD] pos_partner_alternative_pricelist_load_background
1 parent cdf4062 commit 079a2d8

File tree

11 files changed

+530
-0
lines changed

11 files changed

+530
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
=================================================
2+
POS Partner Alternative 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_alternative_pricelist_load_background
18+
:alt: camptocamp/pos
19+
20+
|badge1| |badge2| |badge3|
21+
22+
When a customer is selected `pos_partner_pricelist_load_background` load pricelist defined in property_pricelist_id in background.
23+
With this module, the price lists linked to the customer's price list are also loaded in the background.
24+
25+
26+
**Table of contents**
27+
28+
.. contents::
29+
:local:
30+
31+
Bug Tracker
32+
===========
33+
34+
Bugs are tracked on `GitHub Issues <https://github.com/camptocamp/pos/issues>`_.
35+
In case of trouble, please check there if your issue has already been reported.
36+
If you spotted it first, help us smashing it by providing a detailed and welcomed
37+
`feedback <https://github.com/camptocamp/pos/issues/new?body=module:%20pos_partner_alternative_pricelist_load_background%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
38+
39+
Do not contact contributors directly about support or help with technical issues.
40+
41+
Credits
42+
=======
43+
44+
Authors
45+
~~~~~~~
46+
47+
* Camptocamp
48+
49+
Contributors
50+
~~~~~~~~~~~~
51+
52+
* Telmo Santos <telmo.santos@camptocamp.com>
53+
54+
Maintainers
55+
~~~~~~~~~~~
56+
57+
This module is part of the `camptocamp/pos <https://github.com/camptocamp/pos/tree/16.0/pos_partner_alternative_pricelist_load_background>`_ project on GitHub.
58+
59+
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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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 Alternative Pricelist Load Background",
6+
"summary": "Load partner alternative pricelist in background",
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": [
13+
"pos_product_pricelist_alternative",
14+
"pos_partner_pricelist_load_background",
15+
],
16+
"installable": True,
17+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import pos_session
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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_background(self, pricelist_id, product_ids):
10+
pricelists = super().get_pos_ui_partner_pricelist_background(
11+
pricelist_id, product_ids
12+
)
13+
# By design we do not calculate alternative prices on base pricelits
14+
if self.env.context.get("base_pricelist"):
15+
return pricelists
16+
pricelist_rec = self.env["product.pricelist"].browse(pricelist_id)
17+
alternative_pricelists = []
18+
for alt_pricelist_rec in pricelist_rec.alternative_pricelist_ids:
19+
alternative_pricelists += self.get_pos_ui_partner_pricelist_background(
20+
alt_pricelist_rec.id, product_ids
21+
)
22+
if alternative_pricelists:
23+
return pricelists + alternative_pricelists
24+
return pricelists
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Telmo Santos <telmo.santos@camptocamp.com>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
When a customer is selected `pos_partner_pricelist_load_background` load pricelist defined in property_pricelist_id in background.
2+
With this module, the price lists linked to the customer's price list are also loaded in the background.
3+

0 commit comments

Comments
 (0)