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

7.0 hbto #1

Open
wants to merge 9 commits into
base: master
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
==================================

Expand Down
22 changes: 22 additions & 0 deletions account_analytic_plans_config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Odoo a.k.a. OpenERP, Open Source Management Solution
# Copyright (c) 2013 Nhomar Hernandez <[email protected]>
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import wizard
81 changes: 81 additions & 0 deletions account_analytic_plans_config/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Programmed by: Nhomar Hernandez <[email protected]>
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################

{
"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
""",
}
91 changes: 91 additions & 0 deletions account_analytic_plans_config/demo/aap_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!--
In order to comply with all the configuration necesary, we will create a
project, this project will create an analytic account.
-->
<record id="project_project_1" model="project.project">
<field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="state">open</field>
<field name="type">normal</field>
<field name="name">Project X</field>
<field name="color">4</field>
<!--
<field name="partner_id" ref="base.res_partner_10"/>
<field name="parent_id" ref="all_projects_account"/>
-->
<field name="members" eval="[(6, 0, [
ref('base.user_root')])]"/>
<field name="description">This project will need a lot of design
computing stuff</field>
<field name="alias_model">project.task</field>
</record>

<!--
I will create 4 analytic accounts to manage the cost of 4 employees
-->
<record id="analytic_account_emp_root" model="account.analytic.account">
<field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="name">Employees</field>
<field name="type">view</field>
</record>
<record id="analytic_account_emp_1" model="account.analytic.account">
<field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="parent_id" eval="ref('analytic_account_emp_root')"/>
<field name="name">Alex</field>
</record>
<record id="analytic_account_emp_2" model="account.analytic.account">
<field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="parent_id" eval="ref('analytic_account_emp_root')"/>
<field name="name">Betty</field>
</record>
<record id="analytic_account_emp_3" model="account.analytic.account">
<field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="parent_id" eval="ref('analytic_account_emp_root')"/>
<field name="name">Carlos</field>
</record>
<record id="analytic_account_emp_4" model="account.analytic.account">
<field name="date_start" eval="time.strftime('%Y-%m-01 10:00:00')"/>
<field name="parent_id" eval="ref('analytic_account_emp_root')"/>
<field name="name">Diego</field>
</record>

<!--Now is when we can create the account.analytic.plan.instance where we will
split the cost of the user case
-->
<record id="plan_0" model="account.analytic.plan">
<field name="name">Employees + Projects</field>
</record>
<record id="analytic_account_plan_0" model="account.analytic.plan.instance">
<field name="plan_id" eval="ref('plan_0')"/>
<field name="name">25% per employee + 100% per Project X</field>
<field name="code">X25-100</field>
</record>
<record id="analytic_account_plan_line_1" model="account.analytic.plan.instance.line">
<field name="plan_id" eval="ref('analytic_account_plan_0')"/>
<field name="rate">25.00</field>
<field name="analytic_account_id" eval="ref('analytic_account_emp_1')"/>
</record>
<record id="analytic_account_plan_line_2" model="account.analytic.plan.instance.line">
<field name="plan_id" eval="ref('analytic_account_plan_0')"/>
<field name="rate">25.00</field>
<field name="analytic_account_id" eval="ref('analytic_account_emp_2')"/>
</record>
<record id="analytic_account_plan_line_3" model="account.analytic.plan.instance.line">
<field name="plan_id" eval="ref('analytic_account_plan_0')"/>
<field name="rate">25.00</field>
<field name="analytic_account_id" eval="ref('analytic_account_emp_3')"/>
</record>
<record id="analytic_account_plan_line_4" model="account.analytic.plan.instance.line">
<field name="plan_id" eval="ref('analytic_account_plan_0')"/>
<field name="rate">25.00</field>
<field name="analytic_account_id" eval="ref('analytic_account_emp_4')"/>
</record>
<record id="analytic_account_plan_line_5" model="account.analytic.plan.instance.line">
<field name="plan_id" eval="ref('analytic_account_plan_0')"/>
<field name="rate">100.00</field>
<field name="analytic_account_id" search="[('name', '=', 'Project X')]"/>
</record>
</data>
</openerp>
51 changes: 51 additions & 0 deletions account_analytic_plans_config/demo/invoice_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="demo_invoice_0" model="account.invoice">
<field name="date_due" eval="time.strftime('%Y')+'-01-30'"/>
<field name="payment_term" ref="account.account_payment_term"/>
<field name="journal_id" ref="account.expenses_journal"/>
<field name="currency_id" ref="base.EUR"/>
<field name="user_id" ref="base.user_demo"/>
<field name="reference_type">none</field>
<field name="company_id" ref="base.main_company"/>
<field name="state">draft</field>
<field name="type">in_invoice</field>
<field name="account_id" ref="account.a_pay"/>
<field eval="0" name="reconciled"/>
<field name="date_invoice" eval="time.strftime('%Y')+'-01-01'"/>
<field eval="14.0" name="amount_untaxed"/>
<field eval="14.0" name="amount_total"/>
<field name="partner_id" ref="base.res_partner_17"/>
</record>
<record id="demo_invoice_0_line_rpanrearpanelshe0" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_0"/>
<field name="account_id" ref="account.a_expense"/>
<field name="analytics_id" ref="account_analytic_plans_config.analytic_account_plan_0"/>
<field name="uos_id" ref="product.product_uom_unit"/>
<field name="price_unit" eval="10.0" />
<field name="price_subtotal" eval="10.0" />
<field name="company_id" ref="base.main_company"/>
<field name="invoice_line_tax_id" eval="[(6,0,[])]"/>
<field name="product_id" ref="product.product_product_39"/>
<field name="quantity" eval="1.0" />
<field name="partner_id" ref="base.res_partner_16"/>
<field name="name">Toner Cartridge</field>
</record>
<record id="demo_invoice_0_line_rckrackcm0" model="account.invoice.line">
<field name="invoice_id" ref="demo_invoice_0"/>
<field name="account_id" ref="account.a_expense"/>
<field name="analytics_id" ref="account_analytic_plans_config.analytic_account_plan_0"/>
<field name="uos_id" ref="product.product_uom_unit"/>
<field name="price_unit" eval="4.0"/>
<field name="price_subtotal" eval="4.0"/>
<field name="company_id" ref="base.main_company"/>
<field name="invoice_line_tax_id" eval="[(6,0,[])]"/>
<field name="product_id" ref="product.product_product_43"/>
<field name="quantity" eval="1.0" />
<field name="partner_id" ref="base.res_partner_17"/>
<field name="name">Zed+ Antivirus</field>
</record>

</data>
</openerp>
10 changes: 10 additions & 0 deletions account_analytic_plans_config/demo/invoice_demo.yml
Original file line number Diff line number Diff line change
@@ -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
41 changes: 41 additions & 0 deletions account_analytic_plans_config/test/test_purchase_invoice_plan.yml
Original file line number Diff line number Diff line change
@@ -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'
Empty file.