Skip to content

Commit

Permalink
[MIG] project_consumable
Browse files Browse the repository at this point in the history
  • Loading branch information
petrus-v committed Jan 21, 2025
1 parent b813797 commit e15137a
Show file tree
Hide file tree
Showing 19 changed files with 143 additions and 1,354 deletions.
22 changes: 10 additions & 12 deletions project_consumable/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,29 +55,27 @@ available in projects.
Usage
=====

## Link products to a project
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
- Material & Consumable Menu
- On task tab
- Project tab

### On task tab

### Project tab

## Review consumable amount
Review consumable amount
------------------------

You can analyse consumable amount per project from different places:

### project dashboard

### Analytic account line analyse

### Project analyse
- project dashboard
- Analytic account line analyse
- Project analyse

Bug Tracker
===========
Expand Down
13 changes: 3 additions & 10 deletions project_consumable/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
# Copyright 2021 - Pierre Verkest
# Copyright 2021-2025 - 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})
from . import report
from .hooks import set_project_ok_for_consumable_products
6 changes: 3 additions & 3 deletions project_consumable/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"author": "Pierre Verkest, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/project",
"category": "Project Management",
"version": "14.0.1.0.0",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"depends": [
"sale_timesheet",
"account",
"hr_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": [
Expand Down
2 changes: 2 additions & 0 deletions project_consumable/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def set_project_ok_for_consumable_products(env):
env["product.template"].search([("type", "=", "consu")]).write({"project_ok": True})
1 change: 0 additions & 1 deletion project_consumable/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
from . import product_template
from . import project_project
from . import project_task
from . import project_profitability_report
15 changes: 9 additions & 6 deletions project_consumable/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
class AccountAnalyticLine(models.Model):
_inherit = "account.analytic.line"

def _timesheet_preprocess(self, vals):
def _timesheet_preprocess(self, vals_list):
"""Deduce other field values from the one given.
Overrride this to compute on the fly some field that can not be computed fields.
:param values: dict values for `create`or `write`.
"""
if all(v in vals for v in ["product_id", "project_id"]):
if "product_uom_id" not in vals:
product = self.env["product.product"].sudo().browse(vals["product_id"])
vals["product_uom_id"] = product.uom_id.id
return super()._timesheet_preprocess(vals)
for vals in vals_list:
if all(v in vals for v in ["product_id", "project_id"]):
if "product_uom_id" not in vals:
product = (
self.env["product.product"].sudo().browse(vals["product_id"])
)
vals["product_uom_id"] = product.uom_id.id
return super()._timesheet_preprocess(vals_list)

def _timesheet_postprocess_values(self, values):
"""Get the addionnal values to write on record
Expand Down
406 changes: 0 additions & 406 deletions project_consumable/models/project_profitability_report.py

This file was deleted.

Loading

0 comments on commit e15137a

Please sign in to comment.