forked from Vauxoo/addons-vauxoo
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Vauxoo/15.0
15.0
- Loading branch information
Showing
233 changed files
with
7,621 additions
and
354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: tests | ||
|
||
on: | ||
pull_request_target: | ||
branches: | ||
- "15.0" | ||
push: | ||
branches: | ||
- "15.0" | ||
|
||
env: | ||
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | ||
CI_PROJECT_NAMESPACE: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | ||
CI_PROJECT_NAME: ${{ github.event.pull_request.head.repo.name || github.event.repository.name }} | ||
|
||
jobs: | ||
pre-commit-vauxoo: | ||
runs-on: ubuntu-latest | ||
name: pre-commit-vauxoo | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.CI_COMMIT_SHA }} | ||
- name: Cache pre-commit and pip packages | ||
id: cache-pre-commit-pip | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cache/pre-commit | ||
~/.cache/pip | ||
key: cache-pre-commit-pip | ||
- name: Install pre-commit-vauxoo | ||
run: pip install --upgrade pre-commit-vauxoo | ||
- name: Run pre-commit-vauxoo | ||
run: pre-commit-vauxoo | ||
no-dependency-files: | ||
runs-on: ubuntu-latest | ||
name: No dependency files | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.CI_COMMIT_SHA }} | ||
- name: Ensure dependency files don't exist | ||
run: | | ||
for reqfile in requirements.txt oca_dependencies.txt ; do | ||
if [ -f ${reqfile} ] ; then | ||
echo "Please avoid adding requirement files to this repo, because requirements will be installed in all project depending on this one." | ||
echo "If you need them for test to work, you can use test-${reqfile} instead of ${reqfile}" | ||
exit 1 | ||
fi | ||
done | ||
build_docker: | ||
runs-on: ubuntu-latest | ||
name: Build Docker and test Odoo | ||
env: | ||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ env.CI_COMMIT_SHA }} | ||
persist-credentials: false | ||
- name: Cache pip packages | ||
id: cache-pip-build | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pip | ||
key: cache-pip-build | ||
- name: Set ssh keys | ||
run: | | ||
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | ||
ssh-add - <<< "${{ secrets.PRIVATE_DEPLOY_KEY }}" | ||
mkdir -p ~/.ssh/ | ||
ssh-keyscan -H git.vauxoo.com >> ~/.ssh/known_hosts | ||
- name: Install dependencies | ||
run: | | ||
pip install -U deployv vxci | ||
sudo apt update | ||
sudo apt install dos2unix | ||
- name: Build image | ||
env: | ||
PRIVATE_DEPLOY_KEY: ${{ secrets.PRIVATE_DEPLOY_KEY }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
DOCKER_USER: ${{ secrets.DOCKER_USER }} | ||
ORCHEST_REGISTRY: ${{ secrets.ORCHEST_REGISTRY }} | ||
ORCHEST_TOKEN: ${{ secrets.ORCHEST_TOKEN }} | ||
run: | | ||
source variables.sh | ||
vxci check_keys | ||
vxci build_image --push_image | ||
- name: Test odoo image | ||
run: | | ||
source variables.sh | ||
slugified_branch=$(python -c "from vxci.common import slugify; print(slugify('${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}'))") | ||
source ${slugified_branch}/image_name.env | ||
vxci test_repo --allow_deprecated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.. image:: https://img.shields.io/badge/licence-LGPL--3-blue.svg | ||
:alt: License: LGPL-3 | ||
|
||
Analytic Business Units | ||
======================= | ||
|
||
This module allows an easier way to group all analytical accounting by business unit concept. | ||
|
||
Contributors | ||
------------ | ||
|
||
* Nhomar Hernández <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
||
.. image:: https://www.vauxoo.com/logo.png | ||
:alt: Vauxoo | ||
:target: https://vauxoo.com | ||
|
||
This module is maintained by Vauxoo. | ||
|
||
A Latin American company that provides training, coaching, | ||
development and implementation of enterprise management | ||
systems and bases its entire operation strategy in the use | ||
of Open Source Software and its main product is odoo. | ||
|
||
To contribute to this module, please visit https://www.vauxoo.com. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "Analytic Business Units", | ||
"version": "15.0.1.0.1", | ||
"category": "Accounting/Accounting", | ||
"summary": """If you set a business unit in you analytic account now you can have an easier way to group by that | ||
concept on all your analytic accounting""", | ||
"author": "Vauxoo", | ||
"website": "https://vauxoo.com", | ||
"license": "LGPL-3", | ||
"depends": [ | ||
"account", | ||
"analytic", | ||
], | ||
"data": [ | ||
"views/account_analytic_view.xml", | ||
"views/account_analytic_business_view.xml", | ||
"views/account_analytic_line_view.xml", | ||
"views/account_analytic_report_view.xml", | ||
"views/account_move_line_view.xml", | ||
"security/ir.model.access.csv", | ||
], | ||
"demo": [], | ||
"auto_install": False, | ||
"application": False, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from . import account_analytic_account | ||
from . import account_analytic_business | ||
from . import account_analytic_line | ||
from . import account_move_line |
24 changes: 24 additions & 0 deletions
24
account_analytic_business_unit/models/account_analytic_account.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class AccountAnalytic(models.Model): | ||
_inherit = "account.analytic.account" | ||
_order = "business_unit_id desc, sequence asc, code, name asc" | ||
|
||
business_unit_id = fields.Many2one("account.analytic.business.unit") | ||
sequence = fields.Integer() | ||
|
||
def name_get(self): | ||
res = [] | ||
for analytic in self: | ||
name = analytic.name | ||
bu_prefix = "" | ||
if analytic.business_unit_id: | ||
bu_prefix = analytic.business_unit_id.code + ":" | ||
name = bu_prefix + analytic.name | ||
if analytic.code: | ||
name = bu_prefix + ":" + analytic.code + " - " + analytic.name | ||
if analytic.partner_id.commercial_partner_id.name: | ||
name = name + " - " + analytic.partner_id.commercial_partner_id.name | ||
res.append((analytic.id, name)) | ||
return res |
27 changes: 27 additions & 0 deletions
27
account_analytic_business_unit/models/account_analytic_business.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class AccountAnalyticDistribution(models.Model): | ||
_name = "account.analytic.business.unit" | ||
_description = "Analytic Account Business Unit" | ||
|
||
name = fields.Char(required=True) | ||
code = fields.Char(required=True) | ||
partner_id = fields.Many2one("res.partner") | ||
|
||
_sql_constraints = [ | ||
( | ||
"unique_code", | ||
"UNIQUE(code, name)", | ||
"The combination of code and and name for a business unit must be unique.", | ||
) | ||
] | ||
|
||
def name_get(self): | ||
res = [] | ||
for business_unit in self: | ||
name = business_unit.name | ||
if business_unit.code: | ||
name = "[" + business_unit.code + "] " + name | ||
res.append((business_unit.id, name)) | ||
return res |
21 changes: 21 additions & 0 deletions
21
account_analytic_business_unit/models/account_analytic_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from odoo import api, fields, models | ||
|
||
|
||
class AccountAnalyticLine(models.Model): | ||
_inherit = "account.analytic.line" | ||
|
||
business_unit_id = fields.Many2one( | ||
"account.analytic.business.unit", | ||
compute="_compute_business_unit_id", | ||
inverse="_inverse_business_unit_id", | ||
readonly=False, | ||
store=True, | ||
) | ||
|
||
@api.depends("account_id", "account_id.business_unit_id") | ||
def _compute_business_unit_id(self): | ||
for element in self: | ||
element.business_unit_id = element.account_id.business_unit_id | ||
|
||
def _inverse_business_unit_id(self): | ||
pass |
20 changes: 20 additions & 0 deletions
20
account_analytic_business_unit/models/account_move_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from odoo import fields, models | ||
|
||
|
||
class AccountMoveLine(models.Model): | ||
_inherit = "account.move.line" | ||
|
||
analytic_line_count = fields.Integer(compute="_compute_total_analytic_lines") | ||
business_unit_id = fields.Many2one( | ||
related="analytic_account_id.business_unit_id", | ||
store=True, | ||
) | ||
|
||
def action_open_analytic_lines(self): | ||
action = self.env["ir.actions.actions"]._for_xml_id("analytic.account_analytic_line_action_entries") | ||
action.update({"domain": [("id", "in", self.analytic_line_ids.ids)]}) | ||
return action | ||
|
||
def _compute_total_analytic_lines(self): | ||
for element in self: | ||
element.analytic_line_count = len(element.analytic_line_ids.ids) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
account_analytic_business_unit.access_account_analytic_business_unit,access_account_analytic_business_unit,account_analytic_business_unit.model_account_analytic_business_unit,base.group_user,1,1,1,0 |
Oops, something went wrong.