-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1532 from CompassionCH/devel
2021-06-10 Release
- Loading branch information
Showing
34 changed files
with
346 additions
and
326 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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
# from . import test_webservice | ||
from . import test_compassion_hold |
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,38 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2021 Compassion CH (http://www.compassion.ch) | ||
# Releasing children from poverty in Jesus' name | ||
# @author: Jonathan Guerne <guernej@compassion.ch> | ||
# | ||
# The licence is in the file __manifest__.py | ||
# | ||
############################################################################## | ||
import mock | ||
from datetime import datetime | ||
from dateutil.relativedelta import relativedelta | ||
from odoo.exceptions import UserError | ||
|
||
from odoo.tests import tagged, TransactionCase | ||
|
||
mock_update_hold = ( | ||
"odoo.addons.child_compassion.models.compassion_hold" ".CompassionHold.update_hold" | ||
) | ||
|
||
|
||
@tagged("wip_test") | ||
class TestHold(TransactionCase): | ||
|
||
@mock.patch(mock_update_hold) | ||
def test_no_date_change_after_expiration(self, update_hold): | ||
""" | ||
Assert changing the expiration date of an already expired hold | ||
will throw an error | ||
""" | ||
|
||
update_hold.return_value = True | ||
|
||
test_hold = self.env["compassion.hold"].create({ | ||
"expiration_date": datetime.now() - relativedelta(day=1) | ||
}) | ||
|
||
self.assertRaises(UserError, test_hold.write, {"expiration_date": datetime.now()}) |
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
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 @@ | ||
<odoo> | ||
<record id="automated_action" model="base.automation"> | ||
<field name="name">Cancel Draft Transaction after 10 min</field> | ||
<field name="model_id" ref="model_payment_transaction"/> | ||
<field name="trigger">on_time</field> | ||
<field name="trg_date_range">10</field> | ||
<field name="trg_date_range_type">minutes</field> | ||
<field name="active" eval="False"/> | ||
<field name="filter_domain">[("state", "=", "draft")]</field> | ||
<field name="state">code</field> | ||
<field name="trg_date_id" ref="payment.field_payment_transaction__create_date"></field> | ||
<field name="code">records._set_transaction_cancel()</field> | ||
</record> | ||
</odoo> |
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
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
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,18 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2021 Compassion CH (http://www.compassion.ch) | ||
# @author: Robin Berguerand <robin.berguerand@gmail.com> | ||
# | ||
# The licence is in the file __manifest__.py | ||
# | ||
############################################################################## | ||
from odoo import models, fields | ||
|
||
|
||
class AccountInvoice(models.Model): | ||
_inherit = "account.invoice" | ||
|
||
auto_cancel_no_transaction = fields.Boolean( | ||
default=False, help='If true, cancel the invoice if the linked payment ' | ||
'transaction is cancelled' | ||
) |
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
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,19 @@ | ||
############################################################################## | ||
# | ||
# Copyright (C) 2021 Compassion CH (http://www.compassion.ch) | ||
# @author: Robin Berguerand <robin.berguerand@gmail.com> | ||
# | ||
# The licence is in the file __manifest__.py | ||
# | ||
############################################################################## | ||
from odoo import models, fields | ||
|
||
|
||
class PaymentTransaction(models.Model): | ||
_inherit = "payment.transaction" | ||
|
||
def _set_transaction_cancel(self): | ||
for invoice in self.invoice_ids.filtered('auto_cancel_no_transaction'): | ||
invoice.action_invoice_cancel() | ||
return super()._set_transaction_cancel() | ||
|
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.