-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by dreispt
- Loading branch information
Showing
11 changed files
with
78 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 |
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,13 @@ | ||
# Copyright 2021 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "eBill Postfinance Customer Free Reference", | ||
"summary": "Glue module: ebill_postfinance and sale_order_customer_free_ref", | ||
"version": "14.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "Camptocamp,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/l10n-switzerland", | ||
"depends": ["ebill_postfinance", "sale_order_customer_free_ref"], | ||
"auto_install": 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,2 @@ | ||
from . import account_move | ||
from . import sale_order |
15 changes: 15 additions & 0 deletions
15
ebill_postfinance_customer_free_ref/models/account_move.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,15 @@ | ||
# Copyright 2021-2022 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class AccountMove(models.Model): | ||
_inherit = "account.move" | ||
|
||
def get_postfinance_other_reference(self): | ||
ref = super().get_postfinance_other_reference() | ||
for order in self.invoice_line_ids.sale_line_ids.mapped("order_id"): | ||
if order.customer_order_free_ref: | ||
ref.append({"type": "CR", "no": order.customer_order_free_ref}) | ||
return ref |
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 2021-2022 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
|
||
_inherit = "sale.order" | ||
|
||
@api.depends("customer_order_number") | ||
def _compute_postfinance_ebill_client_order_ref(self): | ||
for order in self: | ||
order.postfinance_ebill_client_order_ref = order.customer_order_number |
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 @@ | ||
* Thierry Ducrest <[email protected]> |
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,4 @@ | ||
This module interconnects the `sale_order_customer_free_ref` from EDI with the `ebill_postfinance` module. | ||
|
||
The order reference in the XML messge is set with the `customer_order_number` field. | ||
And the `customer_order_free_ref` is added as a <OTHER-REFERENCE> node. |
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 test_postfinance_customer_free_ref |
20 changes: 20 additions & 0 deletions
20
ebill_postfinance_customer_free_ref/tests/test_postfinance_customer_free_ref.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,20 @@ | ||
# Copyright 2021-2022 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) | ||
|
||
from ...ebill_postfinance.tests.common import CommonCase | ||
|
||
|
||
class TestEbillPosfinanceCustomerFreeRef(CommonCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.invoice.name = "INV_TEST_01" | ||
cls.sale.customer_order_number = "888" | ||
cls.sale.customer_order_free_ref = "FREE" | ||
|
||
def test_one(self): | ||
self.assertEqual(self.sale.postfinance_ebill_client_order_ref, "888") | ||
self.assertEqual( | ||
self.invoice.get_postfinance_other_reference(), | ||
[{"type": "CR", "no": "FREE"}], | ||
) |
1 change: 1 addition & 0 deletions
1
setup/ebill_postfinance_customer_free_ref/odoo/addons/ebill_postfinance_customer_free_ref
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 @@ | ||
../../../../ebill_postfinance_customer_free_ref |
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, | ||
) |