Skip to content

Conversation

@dnplkndll
Copy link

@dnplkndll dnplkndll commented Jan 27, 2025

account_avatax_exemption_sign_oca

proposing a new module to streamline the sale tax pdf exemption sign and storage using the sign_oca app and the account_avatax_exemption

we created and used this internal for several years now. Will be adding the account_avatax_exemption_dms next for paper based scan. not in digital signature and then hope to next gave a portal feature allowing the customer to upload or sign request a renewal requirement on a given state sales tax exemption

I wanted to propose the inclusion in oca with very general use case and can then complete test and migrate.

@JordiBForgeFlow @dreispt @atchuthan

@dnplkndll dnplkndll changed the title [16.0][ADD] account_avatax_exemption_sign_oca [16.0][ADD][WIP] account_avatax_exemption_sign_oca Jan 27, 2025
@kobros-tech
Copy link
Contributor

@dnplkndll
They might need us to add a description of the purpose of this module.

I will work on tests

@kobros-tech kobros-tech force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch 5 times, most recently from fa73a89 to bdee966 Compare January 28, 2025 18:48
Copy link
Contributor

@AlexPForgeFlow AlexPForgeFlow left a comment

Choose a reason for hiding this comment

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

Module account_avatax_exemption should be removed from MR as does not belong to this repo.

Comment on lines 12 to 16
@api.depends("state")
def _cancel_sign_request_id(self):
for rec in self:
if rec.state == "cancel":
rec.sign_oca_request_id.cancel()
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
@api.depends("state")
def _cancel_sign_request_id(self):
for rec in self:
if rec.state == "cancel":
rec.sign_oca_request_id.cancel()
def write(self, vals):
if vals.get("state") == "cancel":
self.sign_oca_request_id.cancel()
res = super().write(vals)

@api.depends only would be triggered to compute fields (don't apply in this field), so I suggest changing the logic to handle cases on write method.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks, I added this module in a separate PR.

here I added it only because we wanted to test sign exemption and the module for exemption is not merged in 16.0 branch.

we tried to add it from the PR in test requirements as dependency but didn't succeed.

we can resume discussion about exemption module in its open PR for 16.0 branch.

@dnplkndll dnplkndll force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch from bdee966 to 56c46fe Compare February 15, 2025 02:51
@dnplkndll dnplkndll force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch from 56c46fe to 913cca7 Compare February 15, 2025 02:56
@kobros-tech kobros-tech force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch from 9bbf926 to 16eeba1 Compare March 20, 2025 20:50
@kobros-tech
Copy link
Contributor

@dnplkndll
@AlexPForgeFlow

There were some tests needed update after we modified the functionality under write method.

Copy link
Contributor

@AlexPForgeFlow AlexPForgeFlow left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@dnplkndll dnplkndll changed the title [16.0][ADD][WIP] account_avatax_exemption_sign_oca [16.0][ADD] account_avatax_exemption_sign_oca Mar 22, 2025
@kobros-tech kobros-tech force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch 4 times, most recently from 5ca1344 to 948d6e8 Compare April 9, 2025 08:44
@kobros-tech
Copy link
Contributor

Observe in the exemption view I display the exemption name, and due to:
OCA/account-fiscal-rule#512

I fix an issue with name as there was a treatment with a virtual name, but now now is really exited in the database and editable thanks to the constrain I introduce there.

@kobros-tech
Copy link
Contributor

kobros-tech commented Apr 9, 2025

By the way, jut to remind myself and other devs. onchange is concerning view changes ONLY but constrains are not bound to views.

I didn't commit the same of the [16.0][ADD] dms_account_avatax_exemption #395 here as the module is specific, and the exemption modules themselves are handled in the view by default.

@kobros-tech
Copy link
Contributor

@AlexPForgeFlow

what do you think of this commit?
948d6e8faec5cb9a5ca1db1e653eb408aadd9846

@kobros-tech
Copy link
Contributor

I still have one more suggestion to show up the sign_request field in the view if it is there same as what we did in the dms exemption connector so we can go between both views easily and quickily.

@AlexPForgeFlow
Copy link
Contributor

@kobros-tech regarding this commit 948d6e8 .
It's true what you say that onchange methods are for managing changes in the UI, but I do not see any inconvenience on calling them directly (I have seen many implementations calling onchange method directly, also odoo itself). Because at the end, it's a method as all the others, the main difference it's that with tag @api.onchange method will be triggered when a specific field in the UI is changed.
With your proposal, also I see the problem of having duplicated code.

@kobros-tech
Copy link
Contributor

kobros-tech commented Apr 9, 2025

@kobros-tech regarding this commit 948d6e8 . It's true what you say that onchange methods are for managing changes in the UI, but I do not see any inconvenience on calling them directly (I have seen many implementations calling onchange method directly, also odoo itself). Because at the end, it's a method as all the others, the main difference it's that with tag @api.onchange method will be triggered when a specific field in the UI is changed. With your proposal, also I see the problem of having duplicated code.

all right here is the log of the issue in detail:
with on_change line is deleted, yes but also the exemption itself is deleted and the error is raised up, so I changed the UI method with the pure model method.
with my approach exemption is ceated even if the line is removed and the error is no longer raising up!

WRITE called on exemption res.partner.exemption(51,) with vals: {'name': 'Demo Type - 123456 - YourCompany, Mitchell Admin'}
CREATE exemption vals: {'partner_id': 3, 'exemption_type': 19, 'sign_oca_request_id': 24, 'exemption_number': '123456'}
CREATE exemption line vals: {'exemption_id': 51, 'name': 'CERT00023'}
CREATED LINE ID: 24 | exemption_id: 51

{'partner_id': 3, 'exemption_type': 19, 'sign_oca_request_id': 24, 'exemption_number': '123456'}
res.partner.exemption(51,)
res.partner.exemption.line(24,)
res.partner.exemption(51,) res.partner.exemption.line(24,) res.partner(3,)

WRITE called on exemption res.partner.exemption(51,) with vals: {'business_type': 1}
WRITE called on exemption res.partner.exemption(51,) with vals: {'state_ids': [(6, 0, [])]}
WRITE called on exemption res.partner.exemption(51,) with vals: {'expiry_date': datetime.date(2025, 5, 8)}
WRITE called on exemption res.partner.exemption(51,) with vals: {'exemption_line_ids': [(6, 0, [])]}
WRITE called on exemption line res.partner.exemption.line(24,) with vals: {'exemption_id': False}
2025-04-08 21:59:24,519 107736 ERROR account_avatax_exemption_sign_oca_16_1 odoo.sql_db: bad query: UPDATE "res_partner_exemption_line" SET "exemption_id" = NULL, "partner_id" = NULL, "write_date" = '2025-04-08T21:59:23.699852'::timestamp, "write_uid" = 2 WHERE id IN (24)
ERROR: null value in column "exemption_id" of relation "res_partner_exemption_line" violates not-null constraint
DETAIL: Failing row contains (24, null, null, null, 1, 2, CERT00023, null, null, t, null, null, 2025-04-08 21:59:23.699852, 2025-04-08 21:59:23.699852).

2025-04-08 21:59:24,535 107736 WARNING account_avatax_exemption_sign_oca_16_1 odoo.http: The operation cannot be completed:

  • Create/update: a mandatory field is not set.
  • Delete: another model requires the record being deleted. If possible, archive it instead.

Model: Avatax Exemption Line (res.partner.exemption.line)
Field: Exemption (exemption_id)

@kobros-tech
Copy link
Contributor

@AlexPForgeFlow
sorry for the line pasting in big format :)

@kobros-tech
Copy link
Contributor

@AlexPForgeFlow
you see now odoo takes both records of exemption and line together and deleted one and the other one that we care about.

That is the side effect of using onchange method, I don't complain about api decorators I use in backend but in this case issue happened.

@AlexPForgeFlow
Copy link
Contributor

@kobros-tech When you say the line is deleted, are you referring the exemption lines from a partner?
Can you give me more details about the issue or steps to reproduce, in order to understand the problem and try to help?

@kobros-tech kobros-tech force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch from 0d08770 to a01a068 Compare April 9, 2025 12:40
@kobros-tech
Copy link
Contributor

This commit is essential for connecting survey, sign, and exemption together:
dbb361f

@kobros-tech
Copy link
Contributor

@kobros-tech When you say the line is deleted, are you referring the exemption lines from a partner? Can you give me more details about the issue or steps to reproduce, in order to understand the problem and try to help?

you only need to change my methods with on change methods, but you only see this if exemption is created in the backend like when you validate a sign request for exemption.

so using this PR and sign oca you need to interchange current methods and will see an error warning preventing you from validating the sign request.

@kobros-tech kobros-tech force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch from a01a068 to 70ff4a3 Compare April 10, 2025 00:12
@dnplkndll
Copy link
Author

@pedrobaeza what is the process from here on an ADD?

@pedrobaeza pedrobaeza added this to the 16.0 milestone Apr 16, 2025
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

I'm struggling with these things:

  • The name of the module: it's something more on the sign part, or the Avatax one? That would determine the starting part of the name
  • Being any side or the other for the name, Avatax is something very specific of.. USA? Being here in this general repo seems to not be the correct place.
  • The README is very short explaining concepts and the purpose of the module. What is Avatax exemption? How is this related to sign?...

@dnplkndll
Copy link
Author

name:
I was not sure either. the main feature is to store what we need to provide auditors to document the reason a partner is not getting taxed. we have agriculture and resleller. each state has a different version and so you have 100+ templates and then have to store for 3+ years in order to defense an audit ( I did this twice )
so there is a requirement to put in emailed and scanned docs into the system to back up the ERP record of the customer taxability type then give in build a given state to the auditor.
we need a sign and dms system to store all the data and back up the accounting system tax.
the main work here is sign. nothing really but a link to the exemption crate but needs both.
country specific:
EE introduced avatax as well. I guess in USA I know here but do not know how needed other places? maybe are simpler to implement than the 1000 counties and state rules on different product classes and changing. it is just too much to implement and then keep up to date. of course that is assuming there are not reliable data feeds on the state or would not. be as hard.

I am indifferent and can ask on the other project side it appropriate. @dreispt

readme
@nilshamerlinck we just went over all this could you propose a good readme having just reviewed for first time?

@pedrobaeza
Copy link
Member

Thanks for the explanation, so, of I understood correctly, this is not something related specifically to Avatax, but tax exemption in general. Or the module contains something tied to the Avatax platform?

@dnplkndll
Copy link
Author

essentially the purpose if to add the document to support the customer exemption. but that is a good point are the exemptions used by other sales tax systems? I am not sure as to my knowledge we developed this as the first customer sales tax exemption management tool. We should probably be made general purpose to support any sales tax system. However we were not able to use the taxcloud that was the official system on 13.0 as it did not even support customer sales tax exmeptions fort reasons alike agricultural use. I am not certain if that has evened. Do you know of any other systems to review and support in addition to the avatax api?

@dnplkndll
Copy link
Author

@pedrobaeza oh as to where to put it? just following the maintenance, project convention where is seemed like the sign relates module extensions are in sign. same issue on the PDF supporting document in dms OCA/dms#395 Both depend on an exemption doc to support with a signed doc.

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale label Aug 31, 2025
@kobros-tech
Copy link
Contributor

@pedrobaeza

Did you ask to add this module to another project, which one in your opinion?

@pedrobaeza
Copy link
Member

AFAIK, l10n-usa is hosting the avatax modules.

@kobros-tech kobros-tech force-pushed the 16.0-add-account_avatax_exemption_sign_oca branch from 70ff4a3 to 94a97cd Compare September 1, 2025 19:40
@github-actions github-actions bot removed the stale label Sep 7, 2025
@pedrobaeza
Copy link
Member

I'm now seeing that the dependent module is in https://github.com/OCA/account-fiscal-rule/tree/16.0/account_avatax_exemption, so there should go this one.

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale label Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants