Skip to content

Commit

Permalink
Merge pull request #1 from Vauxoo/15.0
Browse files Browse the repository at this point in the history
15.0
  • Loading branch information
dg18 authored Mar 4, 2024
2 parents 890e299 + b8fcca0 commit f25439a
Show file tree
Hide file tree
Showing 233 changed files with 7,621 additions and 354 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/test.yml
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
49 changes: 31 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
__pycache__/
*.py[cod]

*.DS_Store*

# C extensions
*.so

# Distribution / packaging
.Python
env/
bin/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
Expand All @@ -22,12 +23,6 @@ var/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand All @@ -47,27 +42,45 @@ coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log
# Pycharm
.idea

# VS Code
.vscode

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Rope
.ropeproject

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Vi swap file
# Backup files
*~
*.swp

# Pycharm project files
.idea

# docker JSON packages
package-lock.json
package.json

# docker node_modules
node_modules/

# pre-commit-vauxoo
.bandit*
.config/
.editorconfig
.eslintrc*
.flake8*
.isort.cfg
.pre-commit*.yaml
.prettierrc.yml
.pylintrc*
bandit*.yaml
doc8.ini
pyproject.toml
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,29 @@ addons:
apt:
packages:
- expect-dev # provides unbuffer utility
- openssl

python:
- "3.7"

env:
global:
- VERSION="15.0" ODOO_REPO="vauxoo/odoo" TESTS="0" LINT_CHECK="0"
- TESTS="0" LINT_CHECK="0"

matrix:
- LINT_CHECK="1"
- TESTS="1"

install:
- source ${TRAVIS_BUILD_DIR}/variables.sh
- git clone --single-branch --depth=1 https://github.com/vauxoo/maintainer-quality-tools.git -b master ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- cp test-oca_dependencies.txt oca_dependencies.txt
- travis_install_nightly

script:
- source ${TRAVIS_BUILD_DIR}/variables.sh
- travis_run_tests

after_success:
- source ${TRAVIS_BUILD_DIR}/variables.sh
- travis_after_tests_success
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,3 @@ Issues
- Where?: [here](https://github.com/Vauxoo/addons-vauxoo/issues/new)
- How? Follow [odoo?s](https://github.com/odoo/odoo/blob/15.0/CONTRIBUTING.md) standard to put your issues.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![Build Status](http://runbot.odoo.com/logo.png)](http://runbot.vauxoo.com/runbot/)
[![Build Status](https://travis-ci.org/Vauxoo/addons-vauxoo.svg?branch=15.0)](https://travis-ci.org/Vauxoo/addons-vauxoo)
[![Vauxoo Logo](https://www.vauxoo.com/logo.png)](https://www.vauxoo.com)

[![Runbot Status](https://runbot.vauxoo.com/runbot/badge/230/15.0.svg)](https://runbot.vauxoo.com/runbot/repo/git-github-com-vauxoo-addons-vauxoo-git-230)
[![GitHub Actions Build Status](https://github.com/Vauxoo/addons-vauxoo/actions/workflows/test.yml/badge.svg)](https://github.com/Vauxoo/addons-vauxoo/actions)

Vauxoo modules for Odoo
=======================
Expand Down
28 changes: 28 additions & 0 deletions account_analytic_business_unit/README.rst
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.
1 change: 1 addition & 0 deletions account_analytic_business_unit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
25 changes: 25 additions & 0 deletions account_analytic_business_unit/__manifest__.py
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,
}
4 changes: 4 additions & 0 deletions account_analytic_business_unit/models/__init__.py
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 account_analytic_business_unit/models/account_analytic_account.py
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 account_analytic_business_unit/models/account_analytic_business.py
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 account_analytic_business_unit/models/account_analytic_line.py
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 account_analytic_business_unit/models/account_move_line.py
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)
2 changes: 2 additions & 0 deletions account_analytic_business_unit/security/ir.model.access.csv
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
Loading

0 comments on commit f25439a

Please sign in to comment.