I like to update invoices to paid via python. I already figured out that i need to update:
amount_residual
invoice_payment_state
invoice_payments_widget
has_reconciled_entries
I see that the widget looks like this but im not sure if this need to create as a simple string or if this is a separated db-entry
{
"title": "Abz\\u00fcglich Zahlung",
"outstanding": false,
"content": [
{
"name": "Kundenzahlung: KR-202101-0004",
"journal_name": "Gesch\\u00e4ftskonto",
"amount": 61.88,
"currency": "\\u20ac",
"digits": [
69,
2
],
"position": "after",
"date": "2021-01-31",
"payment_id": 912,
"account_payment_id": 30,
"payment_method_name": "Manuell",
"move_id": 316,
"ref": "BNK1/2021/0007 (KR-202101-0004)"
}
]
}
Second i see that the widget is pointing to a "account.payment" entry with i need to create first, but im not sure with fields i need to fill out and with fields get computed automatically using the .create() methode
{'id': 30,
'name': 'KR-202101-0030',
'payment_reference': False,
'move_name': 'BNK1/2021/0007',
'destination_account_id': (295, '1410 Forderungen aus Lieferungen u.Leistung'),
'destination_journal_id': False,
'invoice_ids': [315],
'reconciled_invoice_ids': [315],
'has_invoices': True,
'reconciled_invoices_count': 1,
'move_line_ids': [912, 913],
'move_reconciled': True,
'state': 'posted',
'payment_type': 'inbound',
'payment_method_id': (1, 'Manuell'),
'payment_method_code': 'manual',
'partner_type': 'customer',
'partner_id': (25, 'Test Benutzer'),
'amount': 61.88, 'currency_id': (1, 'EUR'),
'payment_date': datetime.date(2021, 1, 31),
'communication': 'KR-202101-0004',
'journal_id': (12, 'Geschäftskonto (EUR)'),
'company_id': (1, 'Test Benutzer'),
'hide_payment_method': True,
'payment_difference': 0.0,
'payment_difference_handling': 'open',
'writeoff_account_id': False,
'writeoff_label': 'Write-Off',
'partner_bank_account_id': (4, 'DE40 1111 1111 1111 1111 11'),
'show_partner_bank_account': False,
'require_partner_bank_account': False,
'payment_transaction_id': False,
'payment_token_id': False,
'activity_ids': [],
'activity_state': False,
'activity_user_id': False,
'activity_type_id': False,
'activity_date_deadline': False,
'activity_summary': False,
'activity_exception_decoration': False,
'activity_exception_icon': False,
'message_is_follower': True,
'message_follower_ids': [597],
'message_partner_ids': [3],
'message_channel_ids': [],
'message_ids': [704],
'message_unread': False,
'message_unread_counter': 0,
'message_needaction': False,
'message_needaction_counter': 0,
'message_has_error': False,
'message_has_error_counter': 0,
'message_attachment_count': 0,
'message_main_attachment_id': False,
'website_message_ids': [],
'message_has_sms_error': False,
'display_name': 'KR-202101-0030',
'create_uid': (2, 'Administrator'),
'create_date': datetime.datetime(2021, 1, 31, 10, 31, 31, 179015),
'write_uid': (2, 'Administrator'),
'write_date': datetime.datetime(2021, 1, 31, 10, 31, 31, 285653),
'__last_update': datetime.datetime(2021, 1, 31, 10, 31, 31, 285653)
}
Or is there some simple way to create most of it automatically