Skip to content

Commit 5bba8d5

Browse files
authored
Merge pull request #38 from ingadhoc/18.0
Fork Sync Branch 18.0
2 parents a1014eb + 9239c32 commit 5bba8d5

File tree

168 files changed

+5912
-6293
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+5912
-6293
lines changed

.copier-answers.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Do NOT update manually; changes here will be overwritten by Copier
2+
_commit: d46567f
3+
_src_path: https://github.com/ingadhoc/addons-repo-template.git
4+
description: 'ADHOC Odoo odoo-argentina Modules
5+
6+
7+
'
8+
is_private: false
9+
name: ADHOC odoo-argentina
10+
odoo_version: 18.0
11+
pre_commit_ignore: []
12+
slug: ''
13+

.github/workflows/cleaner.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
2+
# Changes here will be lost on a future update.
3+
# See: https://github.com/ingadhoc/addons-repo-template
4+
5+
name: Delete PR branch from fork and base repo
6+
7+
on:
8+
pull_request:
9+
types: [closed]
10+
pull_request_target:
11+
types: [closed]
12+
13+
# Trigger manual
14+
workflow_dispatch:
15+
inputs:
16+
pull_request_number:
17+
description: 'Pull Request number to delete the branch'
18+
required: true
19+
type: number
20+
21+
jobs:
22+
delete-branch:
23+
runs-on: ubuntu-latest
24+
if: >
25+
github.repository_owner == 'ingadhoc' &&
26+
(
27+
(github.event_name == 'pull_request' && github.event.pull_request.merged == false && github.event.sender.login == 'roboadhoc') ||
28+
(github.event_name == 'pull_request_target' && github.event.pull_request.merged == false && github.event.sender.login == 'roboadhoc') ||
29+
(github.event_name == 'workflow_dispatch') ||
30+
(github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success')
31+
)
32+
steps:
33+
- name: Delete branch from base and fork repos
34+
uses: actions/github-script@v6
35+
id: pr_data_fetcher
36+
with:
37+
script: |
38+
// Get PR information
39+
core.info('Fetching PR data and validating conditions...');
40+
41+
// Debug info
42+
const eventName = context.eventName;
43+
core.info(`El nombre del evento es: ${eventName}`);
44+
core.info(JSON.stringify(context, null, 2))
45+
// End Debug info
46+
47+
let repoOwner = context.repo.owner;
48+
let repoName = context.repo.repo;
49+
let pullRequest;
50+
51+
if (context.eventName === 'workflow_dispatch' || context.eventName === 'deployment_status') {
52+
let prNumber = 0;
53+
if (context.eventName === 'workflow_dispatch') {
54+
prNumber = context.payload.inputs.pull_request_number;
55+
core.info(`Manual trigger for PR #${prNumber}`);
56+
}
57+
58+
if (context.eventName === 'deployment_status') {
59+
prNumber = context.payload.deployment_status.description.split("#")[1].split(" ")[0];
60+
core.info(`deployment_status trigger for PR #${prNumber}`);
61+
}
62+
63+
// Fetch the PR data using the number
64+
pullRequest = (await github.rest.pulls.get({
65+
owner: repoOwner,
66+
repo: repoName,
67+
pull_number: prNumber,
68+
})).data;
69+
70+
core.info(JSON.stringify(pullRequest, null, 2))
71+
72+
if (pullRequest.merged === true) {
73+
core.info(`PR #${prNumber} was merged. No action needed.`);
74+
core.setOutput('validation_passed', 'false');
75+
return;
76+
}
77+
78+
// Fetch the PR timeline to find the 'closed' event
79+
const timeline = await github.rest.issues.listEventsForTimeline({
80+
owner: repoOwner,
81+
repo: repoName,
82+
issue_number: prNumber,
83+
});
84+
85+
// Find the 'closed' event in the timeline
86+
const closeEvent = timeline.data.find(event => event.event === 'closed');
87+
88+
// Get the user who closed the PR from the event
89+
const closedByLogin = closeEvent && closeEvent.actor ? closeEvent.actor.login : null;
90+
91+
if (closedByLogin !== 'roboadhoc') {
92+
core.info(`PR #${prNumber} was not closed by 'roboadhoc' (${closedByLogin}). No action needed.`);
93+
core.setOutput('validation_passed', 'false');
94+
return;
95+
}
96+
97+
} else if (['pull_request', 'pull_request_target'].includes(context.eventName)) {
98+
pullRequest = context.payload.pull_request;
99+
} else {
100+
core.setOutput('validation_passed', 'false');
101+
core.error(`Unsupported event type: ${context.eventName}`);
102+
return;
103+
}
104+
105+
// Set outputs for subsequent steps
106+
core.setOutput('validation_passed', 'true');
107+
core.setOutput('base_repo_owner', repoOwner);
108+
core.setOutput('base_repo_name', repoName);
109+
core.setOutput('base_branch_name', pullRequest.head.ref);
110+
core.setOutput('head_repo_full_name', pullRequest.head.repo.full_name);
111+
core.setOutput('head_repo_owner', pullRequest.head.repo.owner.login);
112+
core.setOutput('head_repo_name', pullRequest.head.repo.name);
113+
core.setOutput('is_fork', pullRequest.head.repo.full_name !== context.repo.owner + '/' + context.repo.repo);
114+
115+
- name: Delete branch from the base repository
116+
uses: actions/github-script@v6
117+
if: ${{ steps.pr_data_fetcher.outputs.validation_passed == 'true' }}
118+
with:
119+
github-token: ${{ github.token }}
120+
script: |
121+
const baseBranchName = `${{ steps.pr_data_fetcher.outputs.base_branch_name }}`;
122+
const baseRepoOwner = `${{ steps.pr_data_fetcher.outputs.base_repo_owner }}`;
123+
const baseRepoName = `${{ steps.pr_data_fetcher.outputs.base_repo_name }}`;
124+
try {
125+
core.info(`Attempting to delete branch '${baseBranchName}' from base repo '${baseRepoOwner}/${baseRepoName}'`);
126+
await github.rest.git.deleteRef({
127+
owner: baseRepoOwner,
128+
repo: baseRepoName,
129+
ref: `heads/${baseBranchName}`,
130+
});
131+
core.info(`Branch '${baseBranchName}' deleted from base repo successfully.`);
132+
} catch (error) {
133+
if (error.status === 422) {
134+
core.info(`Branch '${baseBranchName}' in base repo already deleted. No action needed.`);
135+
} else {
136+
console.error(`Error deleting branch '${baseBranchName}' from base repo: ${error.message}`);
137+
}
138+
}
139+
140+
- name: Delete branch from the fork repository (adhoc-dev)
141+
if: ${{ steps.pr_data_fetcher.outputs.validation_passed == 'true' }}
142+
uses: actions/github-script@v6
143+
with:
144+
github-token: ${{ secrets.EXTERNAL_REPO_TOKEN_CLEANER_ADHOC_DEV || github.token }}
145+
script: |
146+
const baseBranchName = `${{ steps.pr_data_fetcher.outputs.base_branch_name }}`;
147+
const headRepoOwner = 'adhoc-dev';
148+
const headRepoName = `${{ steps.pr_data_fetcher.outputs.head_repo_name }}`;
149+
150+
try {
151+
core.info(`PR comes from a fork. Attempting to delete branch from fork repo '${headRepoOwner}/${headRepoName}'`);
152+
await github.rest.git.deleteRef({
153+
owner: headRepoOwner,
154+
repo: headRepoName,
155+
ref: `heads/${baseBranchName}`,
156+
});
157+
core.info(`Branch '${baseBranchName}' deleted from fork repo successfully.`);
158+
} catch (error) {
159+
if (error.status === 422) {
160+
core.info(`Branch '${baseBranchName}' in fork repo already deleted. No action needed.`);
161+
} else {
162+
console.error(`Error deleting branch '${baseBranchName}' from fork repo: ${error.message}`);
163+
}
164+
}

.github/workflows/pre-commit.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
2+
# Changes here will be lost on a future update.
3+
# See: https://github.com/ingadhoc/addons-repo-template
4+
5+
name: pre-commit
6+
7+
on:
8+
push:
9+
branches: "[0-9][0-9].0"
10+
pull_request_target:
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
-
17+
name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }}
21+
-
22+
id: setup-python
23+
name: Setup Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: "3.10"
27+
cache: "pip"
28+
-
29+
name: Pre-commit cache
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.cache/pre-commit
33+
key: pre-commit|${{ steps.setup-python.outputs.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }}
34+
-
35+
id: precommit
36+
name: Pre-commit
37+
uses: pre-commit/action@v3.0.1
38+
-
39+
name: Create commit status
40+
if: github.event_name == 'pull_request_target'
41+
run: |
42+
curl -L \
43+
-X POST \
44+
-H "Accept: application/vnd.github+json" \
45+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
46+
-H "X-GitHub-Api-Version: 2022-11-28" \
47+
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
48+
-d '{"state":"${{ steps.precommit.outcome }}","context":"mergebot/pre-commit"}' \
49+
--fail

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
2+
# Changes here will be lost on a future update.
3+
# See: https://github.com/ingadhoc/addons-repo-template
4+
15
# Byte-compiled / optimized / DLL files
26
__pycache__/
37
*.py[cod]
@@ -37,6 +41,12 @@ coverage.xml
3741
# Translations
3842
*.mo
3943

44+
# Ensure we never commit pgdumps
45+
*.dump
46+
*.sql
47+
*.pg
48+
*.pg.gpg
49+
4050
# Mr Developer
4151
.mr.developer.cfg
4252
.project
@@ -50,4 +60,3 @@ coverage.xml
5060

5161
# Sphinx documentation
5262
docs/_build/
53-

.pre-commit-config.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# ⚠️ DO NOT EDIT THIS FILE, IT IS GENERATED BY COPIER ⚠️
2+
# Changes here will be lost on a future update.
3+
# See: https://github.com/ingadhoc/addons-repo-template
4+
5+
exclude: |
6+
(?x)
7+
# We don't want to mess with tool-generated files
8+
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs|
9+
# Library files can have extraneous formatting (even minimized)
10+
/static/(src/)?lib/|
11+
# Ignore build and dist directories in addons
12+
/build/|/dist/|
13+
# Ignore test files in addons
14+
/tests/samples/.*|
15+
# You don't usually want a bot to modify your legal texts
16+
(LICENSE.*|COPYING.*)
17+
18+
# Keep in sync with .github/workflows/pre-commit.yml
19+
default_language_version:
20+
python: python3
21+
22+
repos:
23+
24+
- repo: https://github.com/pre-commit/pre-commit-hooks
25+
rev: v5.0.0
26+
hooks:
27+
- id: check-added-large-files
28+
- id: check-case-conflict
29+
- id: check-docstring-first
30+
- id: check-executables-have-shebangs
31+
- id: check-merge-conflict
32+
- id: check-symlinks
33+
- id: check-xml
34+
- id: check-yaml
35+
- id: debug-statements
36+
- id: end-of-file-fixer
37+
- id: mixed-line-ending
38+
args: ["--fix=lf"]
39+
- id: trailing-whitespace
40+
# exclude autogenerated files
41+
exclude: \.pot?$
42+
43+
- repo: https://github.com/OCA/odoo-pre-commit-hooks
44+
rev: v0.0.35
45+
hooks:
46+
- id: oca-checks-odoo-module
47+
args:
48+
- --disable=xml-dangerous-qweb-replace-low-priority,xml-view-dangerous-replace-low-priority,xml-oe-structure-missing-id
49+
- id: oca-checks-po
50+
args:
51+
- --disable=po-pretty-format
52+
53+
- repo: https://github.com/astral-sh/ruff-pre-commit
54+
rev: v0.6.8
55+
hooks:
56+
- id: ruff
57+
args: [--fix, --exit-non-zero-on-fix]
58+
- id: ruff-format
59+
60+
- repo: https://github.com/OCA/pylint-odoo
61+
rev: v9.1.3
62+
hooks:
63+
- id: pylint_odoo
64+
65+
- repo: https://github.com/rstcheck/rstcheck
66+
rev: v6.2.1
67+
hooks:
68+
- id: rstcheck

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ Please follow the official guide from [Odoo Argentina](https://github.com/ingadh
55
## Project Specific Guidelines
66

77
This project does not have specific coding guidelines.
8-

ISSUE_TEMPLATE.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
> **No me gusta mi camisa**
22
>
33
> *Version affectada:*
4-
>
4+
>
55
> - 7.0 y encima
6-
>
6+
>
77
> *Pasos para reproducir:*
8-
>
8+
>
99
> 1. ponerse antes de un espejo
1010
> 2. prender la luz
1111
> 3. abrir los ojos
12-
>
12+
>
1313
> *Lo que pasa actualmente:*
14-
>
14+
>
1515
> - Asusto
16-
>
16+
>
1717
> *Lo que debe pasar:*
18-
>
19-
> - Todo bien, listo para la fiesta
18+
>
19+
> - Todo bien, listo para la fiesta
2020
>
2121
> *Analisis profunda:*
2222
>

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
[![Code Climate](https://codeclimate.com/github/ingadhoc/odoo-argentina/badges/gpa.svg)](https://codeclimate.com/github/ingadhoc/odoo-argentina)
1+
[![Coverage Status](https://coveralls.io/repos/ingadhoc//badge.png?branch=18.0)](https://coveralls.io/r/ingadhoc/?branch=18.0)
2+
[![Code Climate](https://codeclimate.com/github/ingadhoc//badges/gpa.svg)](https://codeclimate.com/github/ingadhoc/)
23

34
# ADHOC odoo-argentina
45

56
ADHOC Odoo odoo-argentina Modules
67

7-
[//]: # (addons)
8-
[//]: # (end addons)
98

10-
Translation Status
11-
------------------
12-
[![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)
139

1410
----
1511

1612
<img alt="ADHOC" src="http://fotos.subefotos.com/83fed853c1e15a8023b86b2b22d6145bo.png" />
1713
**Adhoc SA** - www.adhoc.com.ar
14+
.

0 commit comments

Comments
 (0)