diff --git a/contract_variable_qty_timesheet/README.rst b/contract_variable_qty_timesheet/README.rst new file mode 100644 index 00000000..4206a323 --- /dev/null +++ b/contract_variable_qty_timesheet/README.rst @@ -0,0 +1,68 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +=============================== +Contract Variable Qty Timesheet +=============================== + +This module extends the functionality of contract_variable_quantity adding +several variable quantity formulas to allow to invoice lines from Timesheet +(Analytic Lines) + +Usage +===== + +To use this module, you need to: + +#. Go to Invoicing > Sales > Contracts and select or create a new contract. +#. Check *Generate recurring invoices automatically*. +#. Add a new recurring invoicing line. +#. Select "Variable quantity" in column "Qty. type". +#. Select "Project Timesheets", "Tasks Timesheets" or "Analytic Same Product" + depending on your need. + + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/110/11.0 + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* `Tecnativa `_: + * Carlos Dauden + +Do not contact contributors directly about support or help with technical issues. + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/contract_variable_qty_timesheet/__init__.py b/contract_variable_qty_timesheet/__init__.py new file mode 100644 index 00000000..ef5ae358 --- /dev/null +++ b/contract_variable_qty_timesheet/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/contract_variable_qty_timesheet/__manifest__.py b/contract_variable_qty_timesheet/__manifest__.py new file mode 100644 index 00000000..1071b7d7 --- /dev/null +++ b/contract_variable_qty_timesheet/__manifest__.py @@ -0,0 +1,20 @@ +# Copyright 2018 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + 'name': 'Contract Variable Qty Timesheet', + 'summary': 'Add formula to invoice ', + 'version': '11.0.1.0.0', + 'category': 'Contract Management', + 'website': 'https://github.com/oca/contract', + 'author': 'Tecnativa, ' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'installable': True, + 'depends': [ + 'contract_variable_quantity', + 'hr_timesheet', + ], + 'data': [ + 'data/contract_line_qty_formula_data.xml', + ], +} diff --git a/contract_variable_qty_timesheet/data/contract_line_qty_formula_data.xml b/contract_variable_qty_timesheet/data/contract_line_qty_formula_data.xml new file mode 100644 index 00000000..0b83b492 --- /dev/null +++ b/contract_variable_qty_timesheet/data/contract_line_qty_formula_data.xml @@ -0,0 +1,44 @@ + + + + + + Project Timesheets + group = env['account.analytic.line'].read_group([ + ('account_id', '=', contract.id), + ('product_id', '=', False), + ('project_id', '!=', False), + ('date', '>=', line.date_from), + ('date', '<=', line.date_to), +], fields=['unit_amount'], groupby=[]) +result = group and group[0]['unit_amount'] or 0.0 + + + + + Task Timesheets + group = env['account.analytic.line'].read_group([ + ('account_id', '=', contract.id), + ('product_id', '=', False), + ('task_id', '!=', False), + ('date', '>=', line.date_from), + ('date', '<=', line.date_to), +], fields=['unit_amount'], groupby=[]) +result = group and group[0]['unit_amount'] or 0.0 + + + + + Analytic Same Product + group = env['account.analytic.line'].read_group([ + ('account_id', '=', contract.id), + ('product_id', '=', line.product_id.id), + ('date', '>=', line.date_from), + ('date', '<=', line.date_to), +], fields=['unit_amount'], groupby=[]) +result = group and group[0]['unit_amount'] or 0.0 + + + + diff --git a/contract_variable_qty_timesheet/i18n/es.po b/contract_variable_qty_timesheet/i18n/es.po new file mode 100644 index 00000000..a3e621c0 --- /dev/null +++ b/contract_variable_qty_timesheet/i18n/es.po @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * contract_variable_qty_timesheet +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-03-29 11:13+0200\n" +"PO-Revision-Date: 2018-03-29 11:21+0200\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Poedit 1.8.7.1\n" +"Last-Translator: Carlos Dauden \n" +"Language: es\n" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_analytic_same_product +msgid "Analytic Same Product" +msgstr "AnalĂ­tica mismo producto" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_project_timesheet +msgid "Project Timesheets" +msgstr "Partes de horas de proyectos" + +#. module: contract_variable_qty_timesheet +#: model:contract.line.qty.formula,name:contract_variable_qty_timesheet.contract_line_qty_formula_task_timesheet +msgid "Task Timesheets" +msgstr "Partes de horas de tareas" diff --git a/contract_variable_qty_timesheet/static/description/icon.png b/contract_variable_qty_timesheet/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/contract_variable_qty_timesheet/static/description/icon.png differ