Add payment method to demo

Closes #13227
This commit is contained in:
Cédric Krier
2024-10-26 21:31:45 +02:00
parent 17fb714e38
commit bec00bd8de
+15
View File
@@ -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')