Skip to content

[4782][ADD] account_payment_no_exchange_diff#27

Closed
AungKoKoLin1997 wants to merge 8 commits into
16.0from
4782-account_move_line_journal_entry
Closed

[4782][ADD] account_payment_no_exchange_diff#27
AungKoKoLin1997 wants to merge 8 commits into
16.0from
4782-account_move_line_journal_entry

Conversation

@AungKoKoLin1997
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the module name to account_move_line_create_payment_entry?

@@ -0,0 +1,13 @@
<odoo>
<record
id="model_account_move_line_action_create_journal_entry"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
id="model_account_move_line_action_create_journal_entry"
id="model_account_move_line_action_create_payment_entry"

id="model_account_move_line_action_create_journal_entry"
model="ir.actions.server"
>
<field name="name">Create Journal Entry</field>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<field name="name">Create Journal Entry</field>
<field name="name">Create Payment Entry</field>

Comment thread account_move_line_create_journal_entry/models/account_move_line.py Outdated
Comment thread account_move_line_create_journal_entry/models/account_move_line.py Outdated
Comment thread account_move_line_create_journal_entry/models/account_move_line.py Outdated
Comment thread account_move_line_create_journal_entry/models/account_move_line.py Outdated
Comment thread account_move_line_create_journal_entry/readme/CONTEXT.md Outdated
Comment thread account_move_line_create_journal_entry/readme/DESCRIPTION.md Outdated
Comment thread account_move_line_create_journal_entry/__manifest__.py Outdated
Comment thread account_move_line_create_journal_entry/__manifest__.py Outdated
@AungKoKoLin1997 AungKoKoLin1997 changed the title [4782][ADD] account_move_line_create_journal_entry [4782][ADD] account_move_line_create_payment_entry Feb 10, 2025
Copy link
Copy Markdown
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review.

Comment on lines +14 to +15
if len(set(self.mapped("move_type"))) > 1:
raise UserError(_("All selected records must have the same move type."))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to allow processing different move types together?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

raise UserError(_("All selected records must have the same partner."))
if len(set(self.mapped("move_type"))) > 1:
raise UserError(_("All selected records must have the same move type."))
return {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before reaching here, please add more checks:

  • Show error if the account is neither payable nor receivable.
  • Show error if the selected record has already been reconciled.

_name = "account.payment.entry.wizard"
_description = "Payment Entry Wizard"

account_id = fields.Many2one(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we let users select a journal of the bank type instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the journal entry, I think we can only use the general type journal, isn't?

Comment on lines +54 to +57
move_line_ids = self.move_line_ids | entry.line_ids.filtered(
lambda x: x.account_id.id != self.account_id.id
)
move_line_ids.reconcile()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like it can handle the payment for multiple payable lines. Contrary to my previous comment, actually, we shouldn't be reconciling items here, as the user should be making manual adjustment to the generated journal entry, adding a line for exchange gain/loss.

Suggested change
move_line_ids = self.move_line_ids | entry.line_ids.filtered(
lambda x: x.account_id.id != self.account_id.id
)
move_line_ids.reconcile()

Copy link
Copy Markdown
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we just discussed, let's redesign to make use of the existing Register Payment wizard.

@AungKoKoLin1997 AungKoKoLin1997 changed the title [4782][ADD] account_move_line_create_payment_entry [4782][ADD] account_move_create_payment_entry Feb 19, 2025
Copy link
Copy Markdown
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this server action, can we just add a button "Create Draft Payment (w/o exchange difference)" in the standard "Register Payment" wizard?

Copy link
Copy Markdown
Contributor Author

@AungKoKoLin1997 AungKoKoLin1997 Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are limitations with current design and did some adjustment to cover it because the context is of this module is covered by current design.

If we just add the new button and without passing any context to make adjustment when open the wizards, there are some points we need to consider and implement.

Scenario 1
When users don't enable group_payment and select multiple account moves, separate payments will be created for each account move. As a result, we need to create a journal entry for each move and link it to its corresponding payment. However, there is no direct relationship between the payment and the move (as the move field does not exist in the register payment wizard; instead, we only have reconciled_invoice_ids in the payment). This makes it difficult to determine which payment corresponds to which move, creating a problem when linking our created journal entries to the payments.

Scenario 2
If we enable group_payment and change the amount in the register payment wizard, we need to recalculate the amount for the journal entry (JE).

For example:

INV 001 - $100 (Y 14,000)
INV 002 - $100 (Y 15,000)
If the amount in the register payment form is changed to 150, we need to create a journal entry with two lines:

Y 14,000
Y 7,500
Therefore, we must check the amount entered in the register payment wizard, distribute it among the selected moves, recalculate the amounts using the exchange rate on each move's date, and prepare the journal entry's account move lines accordingly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, as Yoshi-san mentioned, I also think that instead of creating a new action, it would be clearer to add a button for the optional feature in the payment process and handle it that way. However, if the adjustment takes several hours, I believe we should keep the current design.

Comment thread account_move_create_payment_entry/wizards/account_payment_register.py Outdated
@yostashiro
Copy link
Copy Markdown
Member

How about account_payment_no_exchange_diff as the module name?

@AungKoKoLin1997 AungKoKoLin1997 changed the title [4782][ADD] account_move_create_payment_entry [4782][ADD] account_payment_no_exchange_diff Mar 19, 2025
@AungKoKoLin1997
Copy link
Copy Markdown
Contributor Author

How about account_payment_no_exchange_diff as the module name?

Done!

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 4782-account_move_line_journal_entry branch from cf21904 to c0a2ccf Compare June 17, 2025 07:35
@kanda999
Copy link
Copy Markdown
Contributor

Close PR as this module is no longer in use.

@kanda999 kanda999 closed this Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants