diff --git a/.travis.yml b/.travis.yml index 4806f75448..e067a4956d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ install: - git clone https://github.com/OCA/maintainer-quality-tools.git $HOME/maintainer-quality-tools - export PATH=$HOME/maintainer-quality-tools/travis:$PATH - $HOME/maintainer-quality-tools/travis/travis_install_nightly 7.0 - - pip install coveralls flake8 + - pip install coveralls flake8 pyPdf services: - postgresql diff --git a/README.md b/README.md index 31fec753d5..a2cff87bce 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://travis-ci.org/OCA/account-analytic.svg?branch=7.0)](https://travis-ci.org/OCA/account-analytic) +[![Coverage Status](https://coveralls.io/repos/OCA/account-analytic/badge.png)](https://coveralls.io/r/OCA/account-analytic) + OpenERP / Odoo Analytic Accounting ================================== diff --git a/account_analytic_plans_config/__init__.py b/account_analytic_plans_config/__init__.py new file mode 100644 index 0000000000..b2b4556cff --- /dev/null +++ b/account_analytic_plans_config/__init__.py @@ -0,0 +1,22 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Odoo a.k.a. OpenERP, Open Source Management Solution +# Copyright (c) 2013 Nhomar Hernandez +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 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 . +# +############################################################################## + +from . import wizard diff --git a/account_analytic_plans_config/__openerp__.py b/account_analytic_plans_config/__openerp__.py new file mode 100755 index 0000000000..a49b042883 --- /dev/null +++ b/account_analytic_plans_config/__openerp__.py @@ -0,0 +1,81 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Programmed by: Nhomar Hernandez +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 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 . +# +############################################################################## + +{ + "name": "Configure account analytic plans", + "version": "0.1", + "author": "Vauxoo", + "website": "www.vauxoo.com", + "category": "Generic Modules/Projects & Services", + "license": "AGPL-3", + "depends": [ + "project", + "account_accountant", + "account_analytic_plans", + "purchase_analytic_plans", + "sale_analytic_plans", + ], + "data": [ + ], + "demo": [ + "demo/aap_demo.xml", + "demo/invoice_demo.xml", + ], + "test": [ + "test/test_purchase_invoice_plan.yml", + ], + "active": False, + "installable": True, + "description": """ +Pre-Config Account Analytic Plans +================================= + +This modules is a helper module (only data) to understand how configure +account analytic plans. + +This module is and attem to explain throught non-update examples how such +module must be configured. + +Other Objective of this module is to be used to make unit testing of this +important module to ensure a secured evolution. + +Use Case: +--------- + +I have a company which need to control all the expenses related with his Human +resources (employees) but some of those expenses needs to be paid by some +specific customer to mantain correctly pointed the revenue of the company, the +it needs to be reported on this way. + +The first expense to be controlled is buy two iMac to manage the Marketing in +the company, the "Income" that will pay this Expense, one time +the project finish this iMacs will be owned by the Employee with a 40% of +discount and they will represent part of them payments, meaning that they will +be invoiced to employees with this discount. + +To comply with this theretical situation, we will buy the computer and we will +set the analytic accounting to look like this: + +- 50% goes to Employee A +- 50% goes to Employee B +- 100% goes to Project X + """, +} diff --git a/account_analytic_plans_config/demo/aap_demo.xml b/account_analytic_plans_config/demo/aap_demo.xml new file mode 100644 index 0000000000..8bc6fb3d35 --- /dev/null +++ b/account_analytic_plans_config/demo/aap_demo.xml @@ -0,0 +1,91 @@ + + + + + + + open + normal + Project X + 4 + + + This project will need a lot of design + computing stuff + project.task + + + + + + Employees + view + + + + + Alex + + + + + Betty + + + + + Carlos + + + + + Diego + + + + + Employees + Projects + + + + 25% per employee + 100% per Project X + X25-100 + + + + 25.00 + + + + + 25.00 + + + + + 25.00 + + + + + 25.00 + + + + + 100.00 + + + + diff --git a/account_analytic_plans_config/demo/invoice_demo.xml b/account_analytic_plans_config/demo/invoice_demo.xml new file mode 100644 index 0000000000..2f7c1170b6 --- /dev/null +++ b/account_analytic_plans_config/demo/invoice_demo.xml @@ -0,0 +1,51 @@ + + + + + + + + + + none + + draft + in_invoice + + + + + + + + + + + + + + + + + + + + Toner Cartridge + + + + + + + + + + + + + + Zed+ Antivirus + + + + diff --git a/account_analytic_plans_config/demo/invoice_demo.yml b/account_analytic_plans_config/demo/invoice_demo.yml new file mode 100644 index 0000000000..66f1e08073 --- /dev/null +++ b/account_analytic_plans_config/demo/invoice_demo.yml @@ -0,0 +1,10 @@ +- + !record {model: account.invoice, id: account_invoice_analytics}: + currency_id: base.EUR + invoice_line: + - product_id: product.product_product_3 + quantity: 1.0 + analytics_id: account_analytic_plans_config.analytic_account_plan_0 + partner_id: base.res_partner_12 + reference_type: none + type: out_invoice diff --git a/account_analytic_plans_config/test/test_purchase_invoice_plan.yml b/account_analytic_plans_config/test/test_purchase_invoice_plan.yml new file mode 100644 index 0000000000..d24b9d5ba5 --- /dev/null +++ b/account_analytic_plans_config/test/test_purchase_invoice_plan.yml @@ -0,0 +1,41 @@ +- + In order to validate that an invoice is not broken with Analytic Plans I create an Invoice +- + !record {model: account.invoice, view: purchase_analytic_plans.invoice_supplier_form_inherit , id: account_invoice_analytics}: + account_id: account.a_recv + company_id: base.main_company + currency_id: base.EUR + invoice_line: + - account_id: account.a_sale + name: '[PCSC234] PC Assemble SC234' + price_unit: 450.0 + quantity: 1.0 + product_id: product.product_product_3 + uos_id: product.product_uom_unit + analytics_id: account_analytic_plans_config.analytic_account_plan_0 + journal_id: account.bank_journal + partner_id: base.res_partner_12 + reference_type: none + type: out_invoice +- + I check that Initially customer invoice state is "Draft" +- + !assert {model: account.invoice, id: account_invoice_analytics}: + - state == 'draft' +- + I called the "Confirm Draft Invoices" wizard +- + !record {model: account.invoice.confirm, id: account_invoice_confirm_0}: + {} +- + I clicked on Confirm Invoices Button +- + !python {model: account.invoice.confirm}: | + self.invoice_confirm(cr, uid, [ref("account_invoice_confirm_0")], {"lang": 'en_US', + "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_analytics")], + "active_id": ref("account_invoice_analytics"), }) +- + I check that customer invoice state is "Open" +- + !assert {model: account.invoice, id: account_invoice_analytics}: + - state == 'open' diff --git a/account_analytic_plans_config/wizard/__init__.py b/account_analytic_plans_config/wizard/__init__.py new file mode 100644 index 0000000000..e69de29bb2