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] l10n_id_efaktur: NPWP and NIK #163707

Open
wants to merge 1 commit into
base: 15.0
Choose a base branch
from

Conversation

nni-odoo
Copy link
Contributor

Due to recent rule changes for E-faktur, now NIK and NPWP are complement to each other. Which means now, when the person is filling in 000000000000000, e-faktur should be taking the NIK as NPWP column in e-Faktur

3815006


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@nni-odoo nni-odoo requested a review from vin-odoo April 29, 2024 02:20
@robodoo
Copy link
Contributor

robodoo commented Apr 29, 2024

@C3POdoo C3POdoo added the RD research & development, internal work label Apr 29, 2024
Copy link
Contributor

@vin-odoo vin-odoo left a comment

Choose a reason for hiding this comment

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

To check:

commercial_partner must be used when fetching fields that are not address related.
l10n_id_tax_name seems to not be used anymore, isn't this a mistake?

addons/l10n_id_efaktur/models/account_move.py Outdated Show resolved Hide resolved
addons/l10n_id_efaktur/models/account_move.py Outdated Show resolved Hide resolved
@nni-odoo
Copy link
Contributor Author

@vin-odoo good point you've raised. I think ideallly we would be putting it in l10n_id_tax_name. However, based on my discussion with JGR, now if the npwp is '000000000000000', then the etax name is automatically become {NIK}#NIK#NAMA#{customer name}.
Not sure if you think the better implementation is if npwp=000000000000000 => we auto-change the l10n_id_tax_name to the format above. Let me know what you think

@vin-odoo
Copy link
Contributor

@nni-odoo My issue here is that you not only change the behavior when invoice_npwp[:15] == '000000000000000' but also when it's not.
Before if not 00000 you would take the tax name if set, but now you don't anymore.

@nni-odoo
Copy link
Contributor Author

nni-odoo commented Apr 29, 2024

@vin-odoo from what I understand is people don't usually use it, so then they will just use the customer name (commercial_partner.name) in the end, which means this field is useless 🤔
I'll log a note to JGR to ask about this just to make sure

Edit: I'll just make it use l10n_id_tax_name too

addons/l10n_id_efaktur/models/account_move.py Show resolved Hide resolved
addons/l10n_id_efaktur/models/account_move.py Outdated Show resolved Hide resolved
addons/l10n_id_efaktur/models/account_move.py Outdated Show resolved Hide resolved
addons/l10n_id_efaktur/models/account_move.py Outdated Show resolved Hide resolved
addons/l10n_id_efaktur/tests/test_l10n_id_efaktur.py Outdated Show resolved Hide resolved
Due to recent rule changes for E-faktur, now NIK and NPWP are complement to each other.
Consequently, changes that are caused are:
- No auto-assignat for NPWP to 000000000000000. User has to fill in NPWP, NIK or both. If not fulfilled, an error should show up.
- Minimum length of NPWP is 15
- When NPWP is 000000000000000 and user fills in NIK, change the name shown to {NIK}#NIK#NAMA#{name}

Unit tests to satisfy the above changes have also been added

3815006
@nni-odoo
Copy link
Contributor Author

nni-odoo commented May 9, 2024

@vin-odoo amended the commit message. I've also added the unit tests accordingly

Copy link
Contributor

@vin-odoo vin-odoo left a comment

Choose a reason for hiding this comment

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

LGTM, please mark the pr as ready for review :)

'views': [[self.env.ref('base.view_partner_form').id, 'form']],
}
msg = _("Please make sure that you've input the appropriate NPWP or NIK for the following customer")
raise RedirectWarning(msg, action_error, _("Edit Customer Information"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice :) during the forward port (in 17.2, or just master to make it easier) you can simplify this

Suggested change
raise RedirectWarning(msg, action_error, _("Edit Customer Information"))
raise RedirectWarning(
msg,
commercial_partner._get_records_action(),
_("Edit Customer Information")
)

_get_records_action can take as args whatever you would like to add to the action.
By default, it will dynamically set the view_mode based on the amount of records in self.

@vin-odoo vin-odoo marked this pull request as ready for review May 14, 2024 01:35
@C3POdoo C3POdoo requested review from a team and clbr-odoo and removed request for a team May 14, 2024 01:36
Copy link
Contributor

@clbr-odoo clbr-odoo left a comment

Choose a reason for hiding this comment

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

Small nitpicking while I ran into this PR, I'll leave the rest to VIN 👍

Comment on lines 7 to +9
from odoo.exceptions import UserError, ValidationError
from odoo.tools import float_round, float_repr
from odoo.exceptions import RedirectWarning
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
from odoo.exceptions import UserError, ValidationError
from odoo.tools import float_round, float_repr
from odoo.exceptions import RedirectWarning
from odoo.exceptions import RedirectWarning, UserError, ValidationError
from odoo.tools import float_round, float_repr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants