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

[MIG] account_avatax_exemption_base: Migration to 17.0 #41

Open
wants to merge 1 commit into
base: 17_nc_mig_account_avatax_exemption_base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.19
_commit: v1.21.1
_src_path: gh:oca/oca-addons-repo-template
additional_ruff_rules: []
ci: GitHub
Expand Down
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ exclude: |
readme/.*\.(rst|md)$|
# Ignore build and dist directories in addons
/build/|/dist/|
# Ignore test files in addons
/tests/samples/.*|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
Expand All @@ -41,7 +43,7 @@ repos:
hooks:
- id: whool-init
- repo: https://github.com/oca/maintainer-tools
rev: f71041f22b8cd68cf7c77b73a14ca8d8cd190a60
rev: 9a170331575a265c092ee6b24b845ec508e8ef75
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
Expand Down Expand Up @@ -110,7 +112,7 @@ repos:
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: v8.0.19
rev: v9.0.4
hooks:
- id: pylint_odoo
name: pylint with optional checks
Expand Down
1 change: 1 addition & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ fix = true
extend-select = [
"B",
"C90",
"E501", # line too long (default 88)
"I", # isort
"UP", # pyupgrade
]
Expand Down
27 changes: 8 additions & 19 deletions account_avatax_exemption_base/models/exemption.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ class ResPartnerExemptionLine(models.Model):
add_exemption_number = fields.Boolean()
exemption_number = fields.Char()

@api.model
def create(self, vals):
if vals.get("name", _("New")) == _("New"):
vals["name"] = self.env["ir.sequence"].next_by_code(
"exemption.line.sequence"
) or _("New")
return super().create(vals)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get("name", _("New")) == _("New"):
vals["name"] = self.env["ir.sequence"].next_by_code(
"exemption.line.sequence"
) or _("New")
return super().create(vals_list)


class ResPartnerExemptionBusinessType(models.Model):
Expand Down Expand Up @@ -126,18 +127,6 @@ def name_get(self):
res.append((record.id, name))
return res

# TODO: Need to check, avalara.salestax not found and also field.
# @api.onchange("partner_id")
# def onchange_partner_id(self):
# avalara_salestax = (
# self.env["avalara.salestax"]
# .sudo()
# .search([("exemption_export", "=", True)], limit=1)
# )
# if avalara_salestax.use_commercial_entity:
# self.partner_id = self.partner_id.commercial_partner_id.id
# return {"domain": {"partner_id": [("parent_id", "=", False)]}}

@api.onchange("exemption_type", "group_of_state")
def onchange_exemption_type(self):
self.business_type = self.exemption_type.business_type.id
Expand Down
10 changes: 5 additions & 5 deletions account_avatax_exemption_base/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ access_res_partner_exemption,access_res_partner_exemption,model_res_partner_exem
access_res_partner_exemption_line,access_res_partner_exemption_line,model_res_partner_exemption_line,base.group_user,1,1,1,1
access_res_partner_exemption_type,access_res_partner_exemption_type,model_res_partner_exemption_type,base.group_user,1,1,1,1
access_res_partner_exemption_business_type,access_res_partner_exemption_business_type,model_res_partner_exemption_business_type,base.group_user,1,1,1,1
access_portal_group_of_states,access_portal_group_of_states,model_res_partner_group_state,,1,0,0,0
access_portal_res_partner_exemption,access_portal_res_partner_exemption,model_res_partner_exemption,,1,1,1,0
access_portal_res_partner_exemption_line,access_portal_res_partner_exemption_line,model_res_partner_exemption_line,,1,0,0,0
access_portal_res_partner_exemption_type,access_portal_res_partner_exemption_type,model_res_partner_exemption_type,,1,0,0,0
access_portal_res_partner_exemption_business_type,access_portal_res_partner_exemption_business_type,model_res_partner_exemption_business_type,,1,0,0,0
access_portal_group_of_states,access_portal_group_of_states,model_res_partner_group_state,base.group_user,1,0,0,0
access_portal_res_partner_exemption,access_portal_res_partner_exemption,model_res_partner_exemption,base.group_user,1,1,1,0
access_portal_res_partner_exemption_line,access_portal_res_partner_exemption_line,model_res_partner_exemption_line,base.group_user,1,0,0,0
access_portal_res_partner_exemption_type,access_portal_res_partner_exemption_type,model_res_partner_exemption_type,base.group_user,1,0,0,0
access_portal_res_partner_exemption_business_type,access_portal_res_partner_exemption_business_type,model_res_partner_exemption_business_type,base.group_user,1,0,0,0
12 changes: 7 additions & 5 deletions account_avatax_exemption_base/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -424,7 +424,9 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
10 changes: 4 additions & 6 deletions account_avatax_exemption_base/views/avalara_exemption_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,10 @@
required="1"
readonly="state != 'draft'"
/>
<!-- attrs="{'readonly': ['&amp;',('expiry_date','!=',False),('state','!=','draft'),'|',('expiry_date','!=',False)]}" -->
<field
name="expiry_date"
required="1"
readonly="expiry_date != False and state != 'draft' or expiry_date != False"
readonly="expiry_date or (expiry_date and state !='draft')"
force_save="1"
/>
</group>
Expand Down Expand Up @@ -205,7 +204,6 @@
</group>
<group>
<field name="add_exemption_number" />
<!-- attrs="{'invisible': [('add_exemption_number','=',False)]}" -->
<field
name="exemption_number"
invisible="not add_exemption_number"
Expand Down Expand Up @@ -260,19 +258,19 @@
parent="menu_exemption"
sequence="31"
/>
<menuitem
<menuitem
id="menu_exemption_type"
action="exemption_type_act_window"
parent="menu_exemption"
sequence="31"
/>
<menuitem
<menuitem
id="menu_exemption_reason_type"
action="exemption_reason_type_act_window"
parent="menu_exemption"
sequence="31"
/>
<menuitem
<menuitem
id="menu_avatax_exemption"
action="exemption_act_window"
parent="menu_exemption"
Expand Down