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] pre-commit #83

Open
wants to merge 16 commits into
base: 18.0
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
12 changes: 12 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: 719579f
_src_path: https://github.com/ingadhoc/addons-repo-template.git
description: Repositoriy for odoo addons of argentinian localization for functionalities
that are in odoo enterprise. For any argentinan functionality that is not in odoo
CE (community edition) or odoo EE (odoo enterprise), please refer to https://github.com/ingadhoc/odoo-argentina
is_private: false
name: odoo-argentina-ce
odoo_version: 18.0
pre_commit_ignore: []
slug: ''

34 changes: 34 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
# Changes here will be lost on a future update.
# See: https://github.com/ingadhoc/addons-repo-template

name: pre-commit

on:
push:
branches: "*.0"
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
id: setup-python
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
-
name: Pre-commit cache
uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }}
-
name: Pre-commit
uses: pre-commit/[email protected]
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
# Changes here will be lost on a future update.
# See: https://github.com/ingadhoc/addons-repo-template

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -37,6 +41,12 @@ coverage.xml
# Translations
*.mo

# Ensure we never commit pgdumps
*.dump
*.sql
*.pg
*.pg.gpg

# Mr Developer
.mr.developer.cfg
.project
Expand All @@ -50,4 +60,3 @@ coverage.xml

# Sphinx documentation
docs/_build/

69 changes: 69 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
# Changes here will be lost on a future update.
# See: https://github.com/ingadhoc/addons-repo-template

exclude: |
(?x)

# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# 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.*)

# Keep in sync with .github/workflows/pre-commit.yml
default_language_version:
python: python3.10

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- id: trailing-whitespace
# exclude autogenerated files
exclude: \.pot?$

- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.35
hooks:
- id: oca-checks-odoo-module
args:
- --disable=xml-dangerous-qweb-replace-low-priority,xml-view-dangerous-replace-low-priority,xml-oe-structure-missing-id
- id: oca-checks-po
args:
- --disable=po-pretty-format

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

- repo: https://github.com/OCA/pylint-odoo
rev: v9.1.3
hooks:
- id: pylint_odoo

- repo: https://github.com/rstcheck/rstcheck
rev: v6.2.1
hooks:
- id: rstcheck
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.languageServer": "None"
}
16 changes: 8 additions & 8 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
> **No me gusta mi camisa**
>
> *Version affectada:*
>
>
> - 7.0 y encima
>
>
> *Pasos para reproducir:*
>
>
> 1. ponerse antes de un espejo
> 2. prender la luz
> 3. abrir los ojos
>
>
> *Lo que pasa actualmente:*
>
>
> - Asusto
>
>
> *Lo que debe pasar:*
>
> - Todo bien, listo para la fiesta
>
> - Todo bien, listo para la fiesta
>
> *Analisis profunda:*
>
Expand Down
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
[![Coverage Status](https://coveralls.io/repos/ingadhoc/odoo-argentina/badge.png?branch=15.0)](https://coveralls.io/r/ingadhoc/odoo-argentina?branch=15.0)
[![Code Climate](https://codeclimate.com/github/ingadhoc/odoo-argentina/badges/gpa.svg)](https://codeclimate.com/github/ingadhoc/odoo-argentina)
[![Coverage Status](https://coveralls.io/repos/ingadhoc//badge.png?branch=18.0)](https://coveralls.io/r/ingadhoc/?branch=18.0)
[![Code Climate](https://codeclimate.com/github/ingadhoc//badges/gpa.svg)](https://codeclimate.com/github/ingadhoc/)

# ADHOC odoo-argentina-ce
# odoo-argentina-ce

Repositoriy for odoo addons of argentinian localization for functionalities that are in odoo enterprise.
For any argentinan functionality that is not in odoo CE (community edition) or odoo EE (odoo enterprise), please refer to https://github.com/ingadhoc/odoo-argentina

[//]: # (addons)
[//]: # (end addons)

Translation Status
------------------
[![Transifex Status](https://www.transifex.com/projects/p/ingadhoc-odoo-argentina-15-0/chart/image_png)](https://www.transifex.com/projects/p/ingadhoc-odoo-argentina-15-0)
Repositoriy for odoo addons of argentinian localization for functionalities that are in odoo enterprise. For any argentinan functionality that is not in odoo CE (community edition) or odoo EE (odoo enterprise), please refer to https://github.com/ingadhoc/odoo-argentina

----

<img alt="ADHOC" src="http://fotos.subefotos.com/83fed853c1e15a8023b86b2b22d6145bo.png" />
**Adhoc SA** - www.adhoc.com.ar
.
2 changes: 1 addition & 1 deletion l10n_ar_afipws/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"demo/parameter_demo.xml",
],
"images": [],
'installable': True,
"installable": True,
"auto_install": False,
"application": False,
}
16 changes: 4 additions & 12 deletions l10n_ar_afipws/models/afipws_certificate.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import _, api, fields, models
from odoo.exceptions import UserError
from odoo import fields, models, api, _

try:
from OpenSSL import crypto
Expand Down Expand Up @@ -44,7 +44,6 @@ class AfipwsCertificate(models.Model):
("confirmed", "Confirmed"),
("cancel", "Cancelled"),
],
"State",
index=True,
readonly=True,
default="draft",
Expand Down Expand Up @@ -98,10 +97,7 @@ def verify_crt(self):
msg = False

if not crt:
msg = _(
"Invalid action! Please, set the certification string to "
"continue."
)
msg = _("Invalid action! Please, set the certification string to " "continue.")
certificate = rec.get_certificate()
if certificate is None:
msg = _(
Expand All @@ -120,9 +116,7 @@ def get_certificate(self):
self.ensure_one()
if self.crt:
try:
certificate = crypto.load_certificate(
crypto.FILETYPE_PEM, self.crt.encode("ascii")
)
certificate = crypto.load_certificate(crypto.FILETYPE_PEM, self.crt.encode("ascii"))
except Exception as e:
if "Expecting: CERTIFICATE" in e[0]:
raise UserError(
Expand All @@ -132,9 +126,7 @@ def get_certificate(self):
)
)
else:
raise UserError(
_("Unknown error.\nX509 return this message:\n %s") % (e[0])
)
raise UserError(_("Unknown error.\nX509 return this message:\n %s") % (e[0]))
else:
certificate = None
return certificate
15 changes: 3 additions & 12 deletions l10n_ar_afipws/models/afipws_certificate_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import fields, models, api, _
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError

try:
Expand Down Expand Up @@ -31,7 +31,6 @@ class AfipwsCertificateAlias(models.Model):
"""

common_name = fields.Char(
"Common Name",
size=64,
default="AFIP WS",
help="Just a name, you can leave it this way",
Expand Down Expand Up @@ -63,12 +62,10 @@ class AfipwsCertificateAlias(models.Model):
readonly=True,
)
city = fields.Char(
"City",
readonly=True,
required=True,
)
department = fields.Char(
"Department",
default="IT",
readonly=True,
required=True,
Expand Down Expand Up @@ -96,7 +93,6 @@ class AfipwsCertificateAlias(models.Model):
)
service_type = fields.Selection(
[("in_house", "In House"), ("outsourced", "Outsourced")],
"Service Type",
default="in_house",
required=True,
readonly=True,
Expand All @@ -120,7 +116,6 @@ class AfipwsCertificateAlias(models.Model):
)
type = fields.Selection(
[("production", "Production"), ("homologation", "Homologation")],
"Type",
required=True,
default="production",
readonly=True,
Expand Down Expand Up @@ -184,9 +179,7 @@ def action_create_certificate_request(self):
req.get_subject().O = self.company_id.name.encode("ascii", "ignore")
req.get_subject().OU = self.department.encode("ascii", "ignore")
req.get_subject().CN = self.common_name.encode("ascii", "ignore")
req.get_subject().serialNumber = "CUIT %s" % self.cuit.encode(
"ascii", "ignore"
)
req.get_subject().serialNumber = "CUIT %s" % self.cuit.encode("ascii", "ignore")
k = crypto.load_privatekey(crypto.FILETYPE_PEM, self.key)
self.key = crypto.dump_privatekey(crypto.FILETYPE_PEM, k)
req.set_pubkey(k)
Expand All @@ -202,6 +195,4 @@ def action_create_certificate_request(self):
@api.constrains("common_name")
def check_common_name_len(self):
if self.filtered(lambda x: x.common_name and len(x.common_name) > 50):
raise ValidationError(
_("The Common Name must be lower than 50 characters long")
)
raise ValidationError(_("The Common Name must be lower than 50 characters long"))
Loading