From af08d7defa64300e1bf33a79f052e4e860e48d3b Mon Sep 17 00:00:00 2001 From: Sakthivel Date: Fri, 7 Jun 2024 13:16:23 +0530 Subject: [PATCH] [MIG] account_avatax_exemption_base: Migration to 17.0 --- .copier-answers.yml | 2 +- .pre-commit-config.yaml | 6 +++-- .ruff.toml | 1 + .../models/exemption.py | 27 ++++++------------- .../security/ir.model.access.csv | 10 +++---- .../static/description/index.html | 12 +++++---- .../views/avalara_exemption_view.xml | 10 +++---- 7 files changed, 30 insertions(+), 38 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 50ba0903f..3cd4fcc6a 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d4fc0da61..361ca3e78 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: @@ -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 @@ -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 diff --git a/.ruff.toml b/.ruff.toml index 634db8e79..0240c75f6 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -6,6 +6,7 @@ fix = true extend-select = [ "B", "C90", + "E501", # line too long (default 88) "I", # isort "UP", # pyupgrade ] diff --git a/account_avatax_exemption_base/models/exemption.py b/account_avatax_exemption_base/models/exemption.py index 0100bf737..64c4221a9 100644 --- a/account_avatax_exemption_base/models/exemption.py +++ b/account_avatax_exemption_base/models/exemption.py @@ -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): @@ -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 diff --git a/account_avatax_exemption_base/security/ir.model.access.csv b/account_avatax_exemption_base/security/ir.model.access.csv index e97b897ec..76a1e3465 100644 --- a/account_avatax_exemption_base/security/ir.model.access.csv +++ b/account_avatax_exemption_base/security/ir.model.access.csv @@ -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 diff --git a/account_avatax_exemption_base/static/description/index.html b/account_avatax_exemption_base/static/description/index.html index d70c4c37a..bd07f9431 100644 --- a/account_avatax_exemption_base/static/description/index.html +++ b/account_avatax_exemption_base/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -: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. @@ -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 } @@ -301,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -424,7 +424,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

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.

diff --git a/account_avatax_exemption_base/views/avalara_exemption_view.xml b/account_avatax_exemption_base/views/avalara_exemption_view.xml index f8d04856f..4c7042e23 100644 --- a/account_avatax_exemption_base/views/avalara_exemption_view.xml +++ b/account_avatax_exemption_base/views/avalara_exemption_view.xml @@ -166,11 +166,10 @@ required="1" readonly="state != 'draft'" /> - @@ -205,7 +204,6 @@ - - - -