diff --git a/CHANGELOG b/CHANGELOG
index fecd30c9a0..9a98527e21 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,4 @@
+* Allow only lines with maturity date to be paid
* Allow processing receivable payment without approval
* Add submitted state to payment
* Permit to edit amount for manual payment in processing
diff --git a/account.py b/account.py
index a91600ada4..e6acb794cf 100644
--- a/account.py
+++ b/account.py
@@ -419,10 +419,7 @@ class PayLine(Wizard):
amount=line.payment_amount,
line=line,
)
- date = self.start.date or line.maturity_date
- # Use default value when empty
- if date:
- payment.date = date
+ payment.date = self.start.date or line.maturity_date
return payment
def do_pay(self, action):
diff --git a/account.xml b/account.xml
index 4e38769bba..767504b99d 100644
--- a/account.xml
+++ b/account.xml
@@ -27,7 +27,7 @@ this repository contains the full copyright notices and license terms. -->
Lines to Pay
account.move.line
diff --git a/payment.py b/payment.py
index 30b5428122..61dceb3205 100644
--- a/payment.py
+++ b/payment.py
@@ -322,6 +322,7 @@ class Payment(Workflow, ModelSQL, ModelView):
If(Eval('state') == 'draft',
[
('reconciliation', '=', None),
+ ('maturity_date', '!=', None),
],
[]),
['OR',
diff --git a/tests/scenario_account_payment.rst b/tests/scenario_account_payment.rst
index c3a92176e0..606f2829a4 100644
--- a/tests/scenario_account_payment.rst
+++ b/tests/scenario_account_payment.rst
@@ -70,7 +70,8 @@ Create payable move::
>>> Move = Model.get('account.move')
>>> move = Move()
>>> move.journal = expense_journal
- >>> line = move.lines.new(account=payable, party=supplier,
+ >>> line = move.lines.new(
+ ... account=payable, party=supplier, maturity_date=tomorrow,
... credit=Decimal('50.00'))
>>> line = move.lines.new(account=expense, debit=Decimal('50.00'))
>>> move.click('post')
diff --git a/tests/scenario_account_payment_planning.rst b/tests/scenario_account_payment_planning.rst
index 4c50ec56c7..bd78753002 100644
--- a/tests/scenario_account_payment_planning.rst
+++ b/tests/scenario_account_payment_planning.rst
@@ -84,15 +84,3 @@ The date on the payment wizard is used for payment date::
>>> payment, = Payment.find()
>>> payment.date == tomorrow
True
-
-If the line does not have any maturity date it is scheduled for today::
-
- >>> payment.delete()
- >>> line.maturity_date = None
- >>> line.save()
- >>> pay_line = Wizard('account.move.line.pay', [line])
- >>> pay_line.execute('next_')
- >>> pay_line.execute('next_')
- >>> payment, = line.payments
- >>> payment.date == today
- True