From bec00bd8de0fda27d5ee662daff28e13e16a630f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 26 Oct 2024 21:31:45 +0200 Subject: [PATCH] Add payment method to demo Closes #13227 --- demo/account_invoice.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/demo/account_invoice.py b/demo/account_invoice.py index 24dce401fc..15636602ec 100644 --- a/demo/account_invoice.py +++ b/demo/account_invoice.py @@ -15,6 +15,9 @@ from .tools import skip_warning def setup(config, modules, company): Party = Model.get('party.party') PaymentTerm = Model.get('account.invoice.payment_term') + PaymentMethod = Model.get('account.invoice.payment.method') + Journal = Model.get('account.journal') + Account = Model.get('account.account') payment_term = PaymentTerm(name='30 days') line = payment_term.lines.new() @@ -29,6 +32,18 @@ def setup(config, modules, company): 'supplier_payment_term': payment_term.id, }, config.context) + cash_account, = Account.find([ + ('company', '=', company.id), + ('code', '=', '1.1.1'), + ], limit=1) + + payment_method = PaymentMethod() + payment_method.name = "Cash" + payment_method.journal, = Journal.find([('type', '=', 'cash')], limit=1) + payment_method.credit_account = cash_account + payment_method.debit_account = cash_account + payment_method.save() + def setup_post(config, modules, company): Invoice = Model.get('account.invoice')