Example use case:
- Create a Supplier and set a bank account.
- Creating a purchase order with a Supplier Bank Account
- The payment method of the payment method must have the Bank Account Required box unchecked.
- Confirm the purchase order and create the invoice with the "Create Bill" button.
- The invoice must have the bank account empty.
TT46502
Steps to reproduce the problem:
- Have a partner without payment mode.
- Create a PO with such partner.
- No payment mode is filled.
- Now fill the payment mode in the partner.
- Create the invoice for the PO.
Current behavior:
The invoice has empty payment mode.
Expected behavior:
The invoice has the partner payment mode. Someone may think that having
no payment mode in the PO may prevail over the partner's payment mode,
or even their flows may consist in empyting the payment mode in the PO
for not binding it with anything yet, but that strategy has more holes
than the one implemented here, as the flow presented proves.
You can then use another one like having an extra payment mode
"Undetermined" or similar for doing such classification as a more
resilient strategy.
It includes a regression test that fails before the change and now is
correct.
TT38608
Without this fix, the partner_bank_id was being reset to False on change of 'company_id'
in the _onchange_purchase_auto_complete method in account.move in the following unit test:
def test_from_purchase_order_invoicing_bank
That's because in commit 9be9766535 we switched to
getting payment method from env.ref('account.account_payment_method_manual_out'), which has
bank_account_required == False by default, while before that we were creating payment method for
which we were explicitly setting bank_account_required as True
Also tag unit test as post_install