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

[14.0][ADD] project_consumable #1410

Open
wants to merge 2 commits into
base: 14.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
4 changes: 3 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.21.1
_commit: v1.28
_src_path: gh:oca/oca-addons-repo-template
ci: GitHub
convert_readme_fragments_to_markdown: false
enable_checklog_odoo: false
generate_requirements_txt: true
github_check_license: true
github_ci_extra_env: {}
Expand All @@ -17,6 +18,7 @@ org_name: Odoo Community Association (OCA)
org_slug: OCA
rebel_module_groups:
- project_sequence
- project_consumable
repo_description: 'TODO: add repo description.'
repo_name: project
repo_slug: project
Expand Down
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ select = C,E,F,W,B,B9
ignore = E203,E501,W503
per-file-ignores=
__init__.py:F401
# make easier diff with upstream sale_timesheet module
project_consumable/models/project_profitability_report.py:B950
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get python version
Expand Down
15 changes: 11 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
name: Detect unreleased dependencies
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
for reqfile in requirements.txt test-requirements.txt ; do
if [ -f ${reqfile} ] ; then
Expand Down Expand Up @@ -43,10 +43,17 @@ jobs:
name: test with OCB
makepot: "true"
- container: ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest
exclude: "project_sequence"
include: "project_consumable"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest
exclude: "project_sequence"
include: "project_consumable"
name: test with OCB
makepot: "true"
- container: ghcr.io/oca/oca-ci/py3.6-odoo14.0:latest
exclude: "project_sequence,project_consumable"
name: test with Odoo
- container: ghcr.io/oca/oca-ci/py3.6-ocb14.0:latest
exclude: "project_sequence,project_consumable"
name: test with OCB
makepot: "true"
services:
Expand All @@ -62,7 +69,7 @@ jobs:
INCLUDE: "${{ matrix.include }}"
EXCLUDE: "${{ matrix.exclude }}"
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install addons and dependencies
Expand Down
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ var/
*.egg
*.eggs

# Windows installers
*.msi

# Debian packages
*.deb

# Redhat packages
*.rpm

# MacOS packages
*.dmg
*.pkg

# Installer logs
pip-log.txt
pip-delete-this-directory.txt
Expand Down
36 changes: 24 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exclude: |
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
Expand Down Expand Up @@ -39,7 +39,7 @@ repos:
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
rev: 9a170331575a265c092ee6b24b845ec508e8ef75
rev: d5fab7ee87fceee858a3d01048c78a548974d935
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
Expand All @@ -58,8 +58,10 @@ repos:
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
args:
- --disable=po-pretty-format
- repo: https://github.com/myint/autoflake
rev: v1.4
rev: v1.5.3
hooks:
- id: autoflake
args:
Expand All @@ -73,25 +75,35 @@ repos:
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.1.2
- repo: local
hooks:
- id: prettier
name: prettier (with plugin-xml)
entry: prettier
args:
- --write
- --list-different
- --ignore-unknown
types: [text]
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
language: node
additional_dependencies:
- "[email protected]"
- "@prettier/[email protected]"
args:
- --plugin=@prettier/plugin-xml
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v7.8.1
- repo: local
hooks:
- id: eslint
verbose: true
name: eslint
entry: eslint
args:
- --color
- --fix
verbose: true
types: [javascript]
language: node
additional_dependencies:
- "[email protected]"
- "eslint-plugin-jsdoc@"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
Expand Down Expand Up @@ -138,7 +150,7 @@ repos:
- --header
- "# generated from manifests external_dependencies"
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
rev: 5.0.0
hooks:
- id: flake8
name: flake8
Expand Down
121 changes: 121 additions & 0 deletions project_consumable/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
==================
Project consumable
==================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d945aa69887faf24cdade547c25c80aaa2d02c752193444173ee867f598bed91
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/14.0/project_consumable
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_consumable
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/project&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module provides a 'closed' flag on project task stages.

**Table of contents**

.. contents::
:local:

Configuration
=============

To be able to track consumable products (or avoid to link un-followed
products) to project, you have to configure each products to
be available in projects.

#. Go to Product form view (ie: *Invoicing > customers > Products*)
and make sure the `project_ok` field is checked (by default consumable
products are available).

.. note::

This module do not depends on sales or accounting modules so you may
need to install extra modules to get menu entry to products or
analytic account line views.

Usage
=====

## Link products to a project

This can be done from different places as describe bellow.

In facts this add ``account.analytic.line`` with proper product,
quantities and Unit of Mesure provided by users, analytic amount
will be computed based on product cost.

### Material & Consumable Menu


### On task tab

### Project tab

## Review consumable amount

You can analyse consumable amount per project from different places:

### project dashboard

### Analytic account line analyse

### Project analyse

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_consumable%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Pierre Verkest

Contributors
~~~~~~~~~~~~

* Pierre Verkest <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/project <https://github.com/OCA/project/tree/14.0/project_consumable>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
12 changes: 12 additions & 0 deletions project_consumable/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2021 - Pierre Verkest
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models


from odoo import api, fields, SUPERUSER_ID


def set_project_ok_for_consumable_products(cr, _):
env = api.Environment(cr, SUPERUSER_ID, {})

env["product.product"].search([("type", "=", "consu")]).write({"project_ok": True})
25 changes: 25 additions & 0 deletions project_consumable/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2021 - Pierre Verkest
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Project consumable",
"summary": "Track the use of consumables by project with analytic accounting.",
"author": "Pierre Verkest, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
"category": "Project Management",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"depends": [
"sale_timesheet",
],
"data": [
"views/analytic_account_line.xml",
"views/analytic_account_line_report.xml",
"views/product.xml",
"views/project_overview_template.xml",
"views/project_views.xml",
],
"demo": [
"demo/product-product.xml",
],
"post_init_hook": "set_project_ok_for_consumable_products",
}
28 changes: 28 additions & 0 deletions project_consumable/demo/product-product.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="uom_category_coffee_capsule" model="uom.category">
<field name="name">Coffee capsule</field>
</record>
<record id="uom_cat_coffee_capsule_unit" model="uom.uom">
<field name="category_id" ref="uom_category_coffee_capsule" />
<field name="name">1 capsule</field>
<field name="factor" eval="1.0" />
<field name="uom_type">reference</field>
</record>
<record id="uom_cat_coffee_capsule_box_10" model="uom.uom">
<field name="category_id" ref="uom_category_coffee_capsule" />
<field name="name">10 capsules box</field>
<field name="factor_inv" eval="10" />
<field name="uom_type">bigger</field>
</record>
<record id="product_coffee_capsule" model="product.product">
<field name="sale_ok">False</field>
<field name="purchase_ok">True</field>
<field name="name">Coffee capsule</field>
<field name="standard_price">0.33</field>
<field name="type">consu</field>
<field name="categ_id" ref="product.product_category_consumable" />
<field name="uom_id" ref="uom_cat_coffee_capsule_unit" />
<field name="uom_po_id" ref="uom_cat_coffee_capsule_box_10" />
</record>
</odoo>
Loading
Loading