Automatic Update form OCA2FC Migrator

This commit is contained in:
Flectra Community Bot 2021-08-01 02:11:43 +00:00 committed by OCA2FC Migrator Bot
parent 455dc1f242
commit 3e64cf1c30
7 changed files with 86 additions and 6 deletions

View File

@ -14,11 +14,11 @@ addon | version | summary
[account_payment_sale](account_payment_sale/) | 2.0.1.0.0| Adds payment mode on sale orders
[account_banking_pain_base](account_banking_pain_base/) | 2.0.1.0.0| Base module for PAIN file generation
[account_banking_mandate](account_banking_mandate/) | 2.0.1.1.0| Banking mandates
[account_payment_order](account_payment_order/) | 2.0.1.2.2| Account Payment Order
[account_payment_order](account_payment_order/) | 2.0.1.2.3| Account Payment Order
[account_payment_purchase_stock](account_payment_purchase_stock/) | 2.0.1.0.0| Integrate Account Payment Purchase with Stock
[account_banking_sepa_credit_transfer](account_banking_sepa_credit_transfer/) | 2.0.1.0.0| Create SEPA XML files for Credit Transfers
[account_payment_mode](account_payment_mode/) | 2.0.1.0.1| Account Payment Mode
[account_payment_partner](account_payment_partner/) | 2.0.1.2.1| Adds payment mode on partners and invoices
[account_payment_partner](account_payment_partner/) | 2.0.1.2.2| Adds payment mode on partners and invoices
[account_payment_order_return](account_payment_order_return/) | 2.0.1.0.1| Account Payment Order Return

View File

@ -8,7 +8,7 @@
{
"name": "Account Payment Order",
"version": "2.0.1.2.2",
"version": "2.0.1.2.3",
"license": "AGPL-3",
"author": "ACSONE SA/NV, "
"Therp BV, "

View File

@ -90,6 +90,7 @@ class AccountMoveLine(models.Model):
"communication_type": communication_type,
"currency_id": currency_id,
"amount_currency": amount_currency,
"date": False,
# date is set when the user confirms the payment order
}
return vals

View File

@ -299,7 +299,7 @@ class AccountPaymentOrder(models.Model):
payline.draft2open_payment_line_check()
# Compute requested payment date
if order.date_prefered == "due":
requested_date = payline.ml_maturity_date or today
requested_date = payline.ml_maturity_date or payline.date or today
elif order.date_prefered == "fixed":
requested_date = order.date_scheduled or today
else:

View File

@ -196,3 +196,82 @@ class TestPaymentOrderOutbound(TransactionCase):
)
with self.assertRaises(ValidationError):
outbound_order.date_scheduled = date.today() - timedelta(days=1)
def test_manual_line_and_manual_date(self):
# Create payment order
outbound_order = self.env["account.payment.order"].create(
{
"date_prefered": "due",
"payment_type": "outbound",
"payment_mode_id": self.mode.id,
"journal_id": self.journal.id,
"description": "order with manual line",
}
)
self.assertEqual(len(outbound_order.payment_line_ids), 0)
# Create a manual payment order line with custom date
vals = {
"order_id": outbound_order.id,
"partner_id": self.env.ref("base.res_partner_4").id,
"partner_bank_id": self.env.ref("base.res_partner_4").bank_ids[0].id,
"communication": "manual line and manual date",
"currency_id": outbound_order.payment_mode_id.company_id.currency_id.id,
"amount_currency": 192.38,
"date": date.today() + timedelta(days=8),
}
self.env["account.payment.line"].create(vals)
self.assertEqual(len(outbound_order.payment_line_ids), 1)
self.assertEqual(
outbound_order.payment_line_ids[0].date, date.today() + timedelta(days=8)
)
# Create a manual payment order line with normal date
vals = {
"order_id": outbound_order.id,
"partner_id": self.env.ref("base.res_partner_4").id,
"partner_bank_id": self.env.ref("base.res_partner_4").bank_ids[0].id,
"communication": "manual line",
"currency_id": outbound_order.payment_mode_id.company_id.currency_id.id,
"amount_currency": 200.38,
}
self.env["account.payment.line"].create(vals)
self.assertEqual(len(outbound_order.payment_line_ids), 2)
self.assertEqual(outbound_order.payment_line_ids[1].date, False)
# Open payment order
self.assertEqual(len(outbound_order.bank_line_ids), 0)
outbound_order.draft2open()
self.assertEqual(outbound_order.bank_line_count, 2)
self.assertEqual(
outbound_order.payment_line_ids[0].date,
outbound_order.payment_line_ids[0].bank_line_id.date,
)
self.assertEqual(outbound_order.payment_line_ids[1].date, date.today())
self.assertEqual(outbound_order.payment_line_ids[1].bank_line_id.date, date.today())
# Generate and upload
outbound_order.open2generated()
outbound_order.generated2uploaded()
self.assertEqual(outbound_order.state, "uploaded")
with self.assertRaises(UserError):
outbound_order.unlink()
bank_line = outbound_order.bank_line_ids
with self.assertRaises(UserError):
bank_line.unlink()
outbound_order.action_done_cancel()
self.assertEqual(outbound_order.state, "cancel")
outbound_order.cancel2draft()
outbound_order.unlink()
self.assertEqual(
len(
self.env["account.payment.order"].search(
[("description", "=", "order with manual line")]
)
),
0,
)

View File

@ -6,7 +6,7 @@
{
"name": "Account Payment Partner",
"version": "2.0.1.2.1",
"version": "2.0.1.2.2",
"category": "Banking addons",
"license": "AGPL-3",
"summary": "Adds payment mode on partners and invoices",

View File

@ -149,5 +149,5 @@ class AccountMove(models.Model):
if self.env.context.get("active_model") == "sale.order": # pragma: no cover
virtual_move = self.new(vals)
virtual_move._compute_partner_bank()
vals["partner_bank_id"] = virtual_move.partner_bank_id
vals["partner_bank_id"] = virtual_move.partner_bank_id.id
return super().create(vals)