diff --git a/README.md b/README.md
index ba67616..26fb5ba 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ addon | version | summary
[account_payment_order_return](account_payment_order_return/) | 2.0.1.0.1| Account Payment Order Return
[account_payment_purchase_stock](account_payment_purchase_stock/) | 2.0.1.0.0| Integrate Account Payment Purchase with Stock
[account_payment_partner](account_payment_partner/) | 2.0.1.1.2| Adds payment mode on partners and invoices
-[account_payment_order](account_payment_order/) | 2.0.1.0.4| Account Payment Order
+[account_payment_order](account_payment_order/) | 2.0.1.2.0| Account Payment Order
[account_payment_purchase](account_payment_purchase/) | 2.0.1.0.0| Adds Bank Account and Payment Mode on Purchase Orders
[account_payment_mode](account_payment_mode/) | 2.0.1.0.1| Account Payment Mode
[account_banking_sepa_direct_debit](account_banking_sepa_direct_debit/) | 2.0.1.1.0| Create SEPA files for Direct Debit
diff --git a/account_payment_order/__manifest__.py b/account_payment_order/__manifest__.py
index cc24752..d4905ed 100644
--- a/account_payment_order/__manifest__.py
+++ b/account_payment_order/__manifest__.py
@@ -8,7 +8,7 @@
{
"name": "Account Payment Order",
- "version": "2.0.1.0.4",
+ "version": "2.0.1.2.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV, "
"Therp BV, "
diff --git a/account_payment_order/models/account_payment_order.py b/account_payment_order/models/account_payment_order.py
index 6197482..d817cfb 100644
--- a/account_payment_order/models/account_payment_order.py
+++ b/account_payment_order/models/account_payment_order.py
@@ -420,6 +420,7 @@ class AccountPaymentOrder(models.Model):
return True
def _prepare_move(self, bank_lines=None):
+ move_date = False
if self.payment_type == "outbound":
ref = _("Payment order %s") % self.name
else:
@@ -428,6 +429,8 @@ class AccountPaymentOrder(models.Model):
ref += " - " + bank_lines.name
if self.payment_mode_id.offsetting_account == "bank_account":
journal_id = self.journal_id.id
+ if bank_lines:
+ move_date = bank_lines[0].date
elif self.payment_mode_id.offsetting_account == "transfer_account":
journal_id = self.payment_mode_id.transfer_journal_id.id
vals = {
@@ -436,6 +439,8 @@ class AccountPaymentOrder(models.Model):
"payment_order_id": self.id,
"line_ids": [],
}
+ if move_date:
+ vals.update({"date": move_date})
total_company_currency = total_payment_currency = 0
for bline in bank_lines:
total_company_currency += bline.amount_company_currency
diff --git a/account_payment_order/security/payment_security.xml b/account_payment_order/security/payment_security.xml
index 5b68e7f..e22231b 100644
--- a/account_payment_order/security/payment_security.xml
+++ b/account_payment_order/security/payment_security.xml
@@ -7,7 +7,7 @@
name="users"
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"
/>
-
+
diff --git a/account_payment_order/tests/test_payment_order_outbound.py b/account_payment_order/tests/test_payment_order_outbound.py
index 0b0ae98..06f6f8d 100644
--- a/account_payment_order/tests/test_payment_order_outbound.py
+++ b/account_payment_order/tests/test_payment_order_outbound.py
@@ -140,6 +140,7 @@ class TestPaymentOrderOutbound(TransactionCase):
order.draft2open()
order.open2generated()
order.generated2uploaded()
+ self.assertEqual(order.move_ids[0].date, order.bank_line_ids[0].date)
order.action_done()
self.assertEqual(order.state, "done")
diff --git a/account_payment_order/views/account_invoice_view.xml b/account_payment_order/views/account_invoice_view.xml
index 6afb70d..5c81d90 100644
--- a/account_payment_order/views/account_invoice_view.xml
+++ b/account_payment_order/views/account_invoice_view.xml
@@ -42,11 +42,10 @@
-
+
diff --git a/account_payment_order/views/account_payment_mode.xml b/account_payment_order/views/account_payment_mode.xml
index 8e149c1..45ec3aa 100644
--- a/account_payment_order/views/account_payment_mode.xml
+++ b/account_payment_order/views/account_payment_mode.xml
@@ -57,7 +57,10 @@
name="move_option"
attrs="{'invisible': [('generate_move', '=', False)], 'required': [('generate_move', '=', True)]}"
/>
-
+