mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] added product attribute to discard invoice lines with this product in hours block
This commit is contained in:
@@ -20,3 +20,4 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
import hours_block
|
import hours_block
|
||||||
import report
|
import report
|
||||||
|
import product
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"name": "Project Hours Blocks Management",
|
"name": "Project Hours Blocks Management",
|
||||||
|
"version": "1.4",
|
||||||
|
"category": "Generic Modules/Projects & Services",
|
||||||
"description": """
|
"description": """
|
||||||
Project Hours Blocks Management
|
Project Hours Blocks Management
|
||||||
===============================
|
===============================
|
||||||
@@ -32,10 +34,8 @@ then you input the spent hours on the hours block and
|
|||||||
you can track and follow how much has been used.
|
you can track and follow how much has been used.
|
||||||
|
|
||||||
""",
|
""",
|
||||||
"version": "1.3",
|
|
||||||
"author": "Camptocamp",
|
"author": "Camptocamp",
|
||||||
"license": 'AGPL-3',
|
"license": 'AGPL-3',
|
||||||
"category": "Generic Modules/Projects & Services",
|
|
||||||
"website": "http://www.camptocamp.com",
|
"website": "http://www.camptocamp.com",
|
||||||
"depends": [
|
"depends": [
|
||||||
"account",
|
"account",
|
||||||
@@ -47,6 +47,8 @@ you can track and follow how much has been used.
|
|||||||
"hours_block_view.xml",
|
"hours_block_view.xml",
|
||||||
"hours_block_data.xml",
|
"hours_block_data.xml",
|
||||||
"hours_block_menu.xml",
|
"hours_block_menu.xml",
|
||||||
|
"product_view.xml",
|
||||||
|
"report.xml",
|
||||||
"security/hours_block_security.xml",
|
"security/hours_block_security.xml",
|
||||||
"security/ir.model.access.csv",
|
"security/ir.model.access.csv",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class AccountHoursBlock(orm.Model):
|
|||||||
# Compute hours bought
|
# Compute hours bought
|
||||||
for line in block.invoice_id.invoice_line:
|
for line in block.invoice_id.invoice_line:
|
||||||
hours_bought = 0.0
|
hours_bought = 0.0
|
||||||
if line.product_id:
|
if line.product_id and line.product_id.is_in_hours_block:
|
||||||
# We will now calculate the product_quantity
|
# We will now calculate the product_quantity
|
||||||
factor = line.uos_id.factor
|
factor = line.uos_id.factor
|
||||||
if factor == 0.0:
|
if factor == 0.0:
|
||||||
|
|||||||
@@ -458,3 +458,13 @@ msgstr ""
|
|||||||
msgid "Total"
|
msgid "Total"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: analytic_hours_block
|
||||||
|
#: field:product.product,is_in_hours_block:0
|
||||||
|
msgid "Accounted for hours block?"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: analytic_hours_block
|
||||||
|
#: help:product.product,is_in_hours_block:0
|
||||||
|
msgid "Specify if you want to have invoice lines containing this product to be considered for hours blocks."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
38
analytic_hours_block/product.py
Normal file
38
analytic_hours_block/product.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Author: Matthieu Dietrich
|
||||||
|
# Copyright 2014 Camptocamp SA
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 of the
|
||||||
|
# License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from openerp.osv import orm, fields
|
||||||
|
|
||||||
|
|
||||||
|
class Product(orm.Model):
|
||||||
|
_name = "product.product"
|
||||||
|
_inherit = 'product.product'
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'is_in_hours_block': fields.boolean(
|
||||||
|
'Accounted for hours block?',
|
||||||
|
help="Specify if you want to have invoice lines "
|
||||||
|
"containing this product to be considered for hours blocks.")
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'is_in_hours_block': False
|
||||||
|
}
|
||||||
18
analytic_hours_block/product_view.xml
Normal file
18
analytic_hours_block/product_view.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="view_product_hours_block_form" model="ir.ui.view">
|
||||||
|
<field name="name">product.product.block.form</field>
|
||||||
|
<field name="model">product.product</field>
|
||||||
|
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<div name="options" position="inside">
|
||||||
|
<field name="is_in_hours_block"/>
|
||||||
|
<label for="is_in_hours_block"/>
|
||||||
|
</div>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
Reference in New Issue
Block a user