-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] pos_partner_alternative_pricelist_load_background
- Loading branch information
1 parent
f808797
commit 7596472
Showing
9 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
14 changes: 14 additions & 0 deletions
14
pos_partner_alternative_pricelist_load_background/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2024 Camptocamp (https://www.camptocamp.com). | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "POS Partner Alternative Pricelist Load Background", | ||
"summary": "Load partner alternative pricelist in background", | ||
"version": "16.0.1.0.0", | ||
"author": "Camptocamp, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/pos", | ||
"license": "AGPL-3", | ||
"category": "Point of Sale", | ||
"depends": ["pos_partner_pricelist_load_background"], | ||
"installable": True, | ||
} |
1 change: 1 addition & 0 deletions
1
pos_partner_alternative_pricelist_load_background/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import pos_session |
25 changes: 25 additions & 0 deletions
25
pos_partner_alternative_pricelist_load_background/models/pos_session.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2024 Camptocamp | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from odoo import models | ||
|
||
|
||
class POSSession(models.Model): | ||
_inherit = "pos.session" | ||
|
||
def _get_alternative_pricelists(self, pricelist): | ||
"""Get recordset of alternative pricelists linked to the given pricelist.""" | ||
for alt_pricelist in pricelist.alternative_pricelist_ids: | ||
pricelist |= self._get_alternative_pricelists(alt_pricelist) | ||
return pricelist | ||
|
||
|
||
def get_pos_ui_partner_pricelist(self, partner_id): | ||
pricelist = ( | ||
self.env["res.partner"].browse(partner_id).property_product_pricelist | ||
) | ||
if pricelist.alternative_pricelist_ids: | ||
alternative_pricelists = self._get_alternative_pricelists(pricelist) | ||
return self.get_pos_ui_product_pricelist( | ||
{"search_params": {"domain": [["id", "in", alternative_pricelists.ids]]}} | ||
) | ||
return super().get_pos_ui_partner_pricelist(partner_id) |
1 change: 1 addition & 0 deletions
1
pos_partner_alternative_pricelist_load_background/readme/CONTRIBUTORS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Telmo Santos <[email protected]> |
3 changes: 3 additions & 0 deletions
3
pos_partner_alternative_pricelist_load_background/readme/DESCRIPTION.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
When a customer is selected `pos_partner_pricelist_load_background` load pricelist defined in property_pricelist_id in background. | ||
With this module, the price lists linked to the customer's price list are also loaded in the background. | ||
|
1 change: 1 addition & 0 deletions
1
...e_pricelist_load_background/odoo/addons/pos_partner_alternative_pricelist_load_background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../pos_partner_alternative_pricelist_load_background |
6 changes: 6 additions & 0 deletions
6
setup/pos_partner_alternative_pricelist_load_background/setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
odoo-addon-pos_partner_pricelist_load_background@ git+https://github.com/OCA/pos.git@refs/pull/1243/head#subdirectory=setup/pos_partner_pricelist_load_background |