Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] payment_group: creation of entry from expenses paid by company #393

Merged
merged 1 commit into from Sep 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions account_payment_group/models/account_payment.py
Expand Up @@ -173,6 +173,11 @@ def create(self, vals_list):
for rec in recs.filtered(lambda x: not x.payment_group_id and not x.is_internal_transfer).with_context(
created_automatically=True):
if not rec.partner_id:
# avoid creating payment group when creating entry of expenses paid by company.
# In this cases odoo creates a payment but is't not line a normal one, it's a payment without partner
# and custom journal items so we better avoid the payment group on top of it
if rec._fields.get('expense_sheet_id') and rec.expense_sheet_id:
continue
raise ValidationError(_(
'Manual payments should not be created manually but created from Customer Receipts / Supplier Payments menus'))
rec.payment_group_id = rec.env['account.payment.group'].create({
Expand Down