Content-Length: 390452 | pFad | https://github.com/odoo/odoo/pull/193213

8E [ADD] l10n_sa_edi_branch: Added Branch CRN by alny-odoo · Pull Request #193213 · odoo/odoo · GitHub
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

[ADD] l10n_sa_edi_branch: Added Branch CRN #193213

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

Conversation

alny-odoo
Copy link
Contributor

@alny-odoo alny-odoo commented Jan 10, 2025

#Task

As per ZATCA rule BR-KSA-08: In the case where a company has multiple commercial registrations, such as different branches, the seller should fill the commercial registration of the branch in respect of which the Tax Invoice is being issued. In the case of Odoo, the branch CRN will be set on the Journal.

Description of the issue/feature this PR addresses:
Currently there is no option to link a Branch CRN to a company, as the only option is to have multiple companies with the same VAT but different Additional Identification Number values.

Current behavior before PR:
Additional Identification Number submitted to ZATCA is set directly on the company and does not allow for multiple branches by company

Desired behavior after PR is merged:
Additional Identification Number (CRN) submitted to ZATCA can be set on the Journal which allows to have different registration numbers per journal


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

@alny-odoo alny-odoo self-assigned this Jan 10, 2025
@robodoo
Copy link
Contributor

robodoo commented Jan 10, 2025

Pull request status dashboard

@C3POdoo C3POdoo requested review from a team and alialfie and removed request for a team January 10, 2025 11:58
@C3POdoo C3POdoo added the RD research & development, internal work label Jan 10, 2025
@alny-odoo alny-odoo force-pushed the 16.0-l10n_sa_edi-imp-alny branch from 28e06fd to 9b10c74 Compare January 10, 2025 12:15
@alny-odoo alny-odoo changed the title 16.0 l10n_sa_edi_branch module [ADD] l10n_sa_edi_branch: Added Branch CRN Jan 10, 2025
@alny-odoo alny-odoo force-pushed the 16.0-l10n_sa_edi-imp-alny branch 2 times, most recently from 3f4acb5 to 991fee5 Compare January 10, 2025 13:54
Copy link
Contributor

@alialfie alialfie left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! Just a few things to mention:
1- Please add the translation files.
2- Nitpicking, but to follow the git guidelines, let's add the task id at the end of the commit message in this format task-4119982.
3- The commit's full description should also follow the guidelines.

addons/l10n_sa_edi_branch/models/__init__.py Outdated Show resolved Hide resolved
Comment on lines 16 to 18
@api.depends("company_id.l10n_sa_use_branch_cr")
def _compute_l10n_sa_branch_cr(self):
self.l10n_sa_branch_cr = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Reading this the first time was confusing, I thought "why is he setting l10n_sa_branch_cr to False whenever l10n_sa_use_branch_cr changes, regardless of its value?" but then reading the chatter on the task page, I understood why. I think it could be better to only do this if l10n_sa_use_branch_cr is False too, or at least writing a comment explaining this as it's a bit odd.

Also, why do we even need this? You're checking if invoice.journal_id.l10n_sa_use_branch_cr and invoice.journal_id.l10n_sa_branch_cr so even if there is a value in l10n_sa_branch_cr, it won't be used if the checkbox is not checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a filtered for records that have l10n_sa_use_branch_cr as False, and added a comment however I kept the check incase the field was added through studio and populated but the setting was turned off.

class ResCompany(models.Model):
_inherit = "res.company"

l10n_sa_use_branch_cr = fields.Boolean(string='Branch CRN')
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the string value be "Use branch CRN"? Same question for the rest of the field/method names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using Branch CRN was just preferred from Yatin since it looks better on the config settings.
image

addons/l10n_sa_edi_branch/models/account_journal.py Outdated Show resolved Hide resolved
Additional Identification Number (CRN) submitted to ZATCA can be set on the Journal if a new Branch CRN setting is enabled.
This allows to have different registration numbers per sales journal.

This change is required as per ZATCA rule BR-KSA-08: In the case where a company has multiple commercial registrations, such as different branches,
the seller should fill the commercial registration of the branch in respect of which the Tax Invoice is being issued.
In the case of Odoo, the branch CRN will be set on the Journal.

task-4119982
@alny-odoo alny-odoo force-pushed the 16.0-l10n_sa_edi-imp-alny branch from 991fee5 to 2b2a129 Compare January 14, 2025 11:35
@alny-odoo alny-odoo requested a review from alialfie January 14, 2025 11:43
Copy link
Contributor

@alialfie alialfie left a comment

Choose a reason for hiding this comment

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

Good job!
Two more things I noticed before it's okay for me. Thanks!

Comment on lines +7 to +14
l10n_sa_branch_crn = fields.Char("Branch CRN",
copy=False,
help="Can be used when the company has multiple branches that share the same VAT number, but have different commercial registration numbers.\
Keep this field empty to use the Identification Number set on the company.",
compute="_compute_l10n_sa_branch_crn",
store=True,
readonly=False,
tracking=True)
Copy link
Contributor

@alialfie alialfie Jan 14, 2025

Choose a reason for hiding this comment

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

Suggested change
l10n_sa_branch_crn = fields.Char("Branch CRN",
copy=False,
help="Can be used when the company has multiple branches that share the same VAT number, but have different commercial registration numbers.\
Keep this field empty to use the Identification Number set on the company.",
compute="_compute_l10n_sa_branch_crn",
store=True,
readonly=False,
tracking=True)
l10n_sa_branch_crn = fields.Char(
"Branch CRN",
copy=False,
help="Can be used when the company has multiple branches that share the same VAT number, "
"but have different commercial registration numbers. Keep this field empty to use "
"the Identification Number set on the company.",
compute="_compute_l10n_sa_branch_cr",
store=True,
readonly=False,
tracking=True,
)

formatting + comma at the end

# Part of Odoo. See LICENSE file for full copyright and licensing details.

{
'name': 'Saudi Arabia - E-Invoicing Branches',
Copy link
Contributor

Choose a reason for hiding this comment

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

Please also include the translations for the strings in the manifest. They should be added to base/i18n/base.pot

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.

4 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/odoo/odoo/pull/193213

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy