Skip to content

Commit

Permalink
[MIG]account_operating_unit to v11
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-villamar authored and AaronHForgeFlow committed Jul 17, 2018
1 parent fd0433e commit b9c083c
Show file tree
Hide file tree
Showing 27 changed files with 38 additions and 93 deletions.
4 changes: 3 additions & 1 deletion account_operating_unit/README.rst
Expand Up @@ -85,7 +85,7 @@ Usage

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/213/10.0
:target: https://runbot.odoo-community.org/runbot/213/11.0

Known issues / Roadmap
======================
Expand Down Expand Up @@ -119,6 +119,8 @@ Contributors
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Aarón Henríquez <ahenriquez@eficent.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* WilldooIT Pty Ltd <info@willdooit.com>
* Michael Villamar <michael.villamar@willdooit.com>

Maintainer
----------
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/__init__.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import models
from . import wizard
from . import report
5 changes: 2 additions & 3 deletions account_operating_unit/__manifest__.py
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": 'Accounting with Operating Units',
"summary": "Introduces Operating Unit fields in invoices and "
"Accounting Entries with clearing account",
"version": "10.0.1.1.0",
"version": "11.0.1.0.0",
"author": "Eficent, "
"Serpent Consulting Services Pvt. Ltd.,"
"WilldooIT Pty Ltd,"
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/operating-unit",
"category": "Accounting & Finance",
Expand All @@ -24,7 +24,6 @@
"views/account_invoice_report_view.xml",
"views/report_financial.xml",
"views/report_trialbalance.xml",
"views/report_agedpartnerbalance.xml",
"wizard/account_report_common_view.xml",
"wizard/account_financial_report_view.xml",
"wizard/account_report_trial_balance_view.xml",
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/models/__init__.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import company
from . import account_journal
from . import account_move
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/models/account_journal.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models, _
from odoo.exceptions import UserError

Expand Down
6 changes: 2 additions & 4 deletions account_operating_unit/models/account_move.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo.tools.translate import _
from odoo import api, fields, models
from odoo.exceptions import UserError
Expand Down Expand Up @@ -114,7 +112,7 @@ def post(self):
# Create balancing entries for un-balanced OU's.
ou_balances = self._check_ou_balance(move)
amls = []
for ou_id in ou_balances.keys():
for ou_id in list(ou_balances.keys()):
# If the OU is already balanced, then do not continue
if move.company_id.currency_id.is_zero(ou_balances[ou_id]):
continue
Expand Down
11 changes: 2 additions & 9 deletions account_operating_unit/models/account_payment.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models, _


Expand Down Expand Up @@ -47,7 +45,7 @@ def _get_dst_liquidity_aml_dict_vals(self):
if self.currency_id != self.company_id.currency_id:
dst_liquidity_aml_dict.update({
'currency_id': self.currency_id.id,
'amount_currency': self.amount,
'amount_currency': -self.amount,
})

dst_liquidity_aml_dict.update({
Expand All @@ -62,11 +60,6 @@ def _get_transfer_debit_aml_dict_vals(self):
'account_id': self.company_id.transfer_account_id.id,
'journal_id': self.destination_journal_id.id
}
if self.currency_id != self.company_id.currency_id:
transfer_debit_aml_dict.update({
'currency_id': self.currency_id.id,
'amount_currency': -self.amount,
})
transfer_debit_aml_dict.update({
'operating_unit_id':
self.journal_id.operating_unit_id.id or False
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/models/company.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models
from odoo.tools.translate import _
from odoo.exceptions import UserError
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/models/invoice.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools.translate import _
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/report/__init__.py
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import account_invoice_report
4 changes: 1 addition & 3 deletions account_operating_unit/report/account_invoice_report.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/tests/__init__.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import test_account_operating_unit
from . import test_invoice_operating_unit
from . import test_cross_ou_journal_entry
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/tests/test_account_operating_unit.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo.addons.account.tests.account_test_classes import AccountingTestCase


Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/tests/test_cross_ou_journal_entry.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import test_account_operating_unit as test_ou


Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/tests/test_invoice_operating_unit.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import test_account_operating_unit as test_ou


Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/tests/test_operating_unit_security.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import test_account_operating_unit as test_ou


Expand Down
11 changes: 4 additions & 7 deletions account_operating_unit/tests/test_payment_operating_unit.py
@@ -1,10 +1,7 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo.addons.account_operating_unit.tests import (

from odoo.addons.account_operating_unit.tests import\
test_account_operating_unit as test_ou
) # noqa
import time


Expand All @@ -29,9 +26,9 @@ def test_payment_from_invoice(self):
'payment_method_id': self.payment_method_manual_in.id
})

register_payments.create_payment()
register_payments.create_payments()
payment = self.payment_model.search([], order="id desc", limit=1)

self.assertAlmostEquals(payment.amount, 115000)
self.assertAlmostEqual(payment.amount, 115000)
self.assertEqual(payment.state, 'posted')
self.assertEqual(self.invoice.state, 'paid')
3 changes: 2 additions & 1 deletion account_operating_unit/views/account_journal_view.xml
Expand Up @@ -9,7 +9,8 @@
<field name="company_id" position="after">
<field name="operating_unit_id"
options="{'no_create': True}"
groups="operating_unit.group_multi_operating_unit"/>
groups="operating_unit.group_multi_operating_unit"
attrs="{'invisible':[('type','not in', ['bank', 'cash'])]}"/>
</field>
</field>
</record>
Expand Down
13 changes: 0 additions & 13 deletions account_operating_unit/views/account_move_view.xml
Expand Up @@ -14,19 +14,6 @@
</field>
</record>

<record id="view_move_line_form2" model="ir.ui.view">
<field name="name">account.move.line.form2</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form2"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='account_id']" position="after">
<field name="operating_unit_id"
options="{'no_create': True}"
groups="operating_unit.group_multi_operating_unit"/>
</xpath>
</field>
</record>

<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
<field name="model">account.move.line</field>
Expand Down
6 changes: 3 additions & 3 deletions account_operating_unit/views/invoice_view.xml
Expand Up @@ -46,15 +46,15 @@
</xpath>
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='account_analytic_id']"
position="attributes">
<attribute name="domain">[('company_id', '=', parent.company_id), '|', ('operating_unit_ids', 'in', [operating_unit]), ('operating_unit_ids', '=', False)]</attribute>
<attribute name="domain">[('company_id', '=', parent.company_id), '|', ('operating_unit_ids', '=', context.get('operating_unit', False)), ('operating_unit_ids', '=', False)]</attribute>
</xpath>
<xpath expr="//field[@name='tax_line_ids']"
position="attributes">
<attribute name="context">{'operating_unit': operating_unit_id}</attribute>
</xpath>
<xpath expr="//field[@name='tax_line_ids']/tree/field[@name='account_analytic_id']"
position="attributes">
<attribute name="domain">[('company_id', '=', parent.company_id), '|', ('operating_unit_ids', 'in', [operating_unit]), ('operating_unit_ids', '=', False)]</attribute>
<attribute name="domain">[('company_id', '=', parent.company_id), '|', ('operating_unit_ids', '=', context.get('operating_unit', False)), ('operating_unit_ids', '=', False)]</attribute>
</xpath>
</field>
</record>
Expand All @@ -75,7 +75,7 @@
</xpath>
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='account_analytic_id']"
position="attributes">
<attribute name="domain">[('company_id', '=', parent.company_id), '|', ('operating_unit_ids', 'in', [operating_unit]), ('operating_unit_ids', '=', False)]</attribute>
<attribute name="domain">[('company_id', '=', parent.company_id), '|', ('operating_unit_ids', '=', context.get('operating_unit', False)), ('operating_unit_ids', '=', False)]</attribute>
</xpath>
</field>
</record>
Expand Down
4 changes: 2 additions & 2 deletions account_operating_unit/views/report_agedpartnerbalance.xml
Expand Up @@ -3,8 +3,8 @@

<template id="report_agedpartnerbalance_operating_units"
inherit_id="account.report_agedpartnerbalance">
<xpath expr="//div[@class='row mt32']" position="inside">
<div class="col-xs-4" t-if="data['operating_units']">
<xpath expr="//div[hasclass('row', 'mt32')]" position="inside">
<div class="col-xs-3" t-if="data['operating_units']">
<strong>Operating Units:</strong>
<p t-esc="data['operating_units']"/>
</div>
Expand Down
2 changes: 1 addition & 1 deletion account_operating_unit/views/report_financial.xml
Expand Up @@ -3,7 +3,7 @@

<template id="report_financial_operating_units"
inherit_id="account.report_financial">
<xpath expr="//div[@class='row mt32 mb32']" position="inside">
<xpath expr="//div[hasclass('row', 'mt32', 'mb32')]" position="inside">
<div class="col-xs-4" t-if="data['operating_units']">
<strong>Operating Units:</strong>
<p t-esc="data['operating_units']"/>
Expand Down
2 changes: 1 addition & 1 deletion account_operating_unit/views/report_trialbalance.xml
Expand Up @@ -3,7 +3,7 @@

<template id="report_trialbalance_operating_units"
inherit_id="account.report_trialbalance">
<xpath expr="//div[@class='row mt32']" position="inside">
<xpath expr="//div[hasclass('row', 'mt32')]" position="inside">
<div class="col-xs-4" t-if="data['operating_units']">
<strong>Operating Units:</strong>
<p t-esc="data['operating_units']"/>
Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/wizard/__init__.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import account_report_common
from . import account_financial_report
from . import account_report_trial_balance
4 changes: 1 addition & 3 deletions account_operating_unit/wizard/account_financial_report.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


Expand Down
4 changes: 1 addition & 3 deletions account_operating_unit/wizard/account_report_common.py
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


Expand Down
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016-17 Eficent Business and IT Consulting Services S.L.
# © 2016 Serpent Consulting Services Pvt. Ltd.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import fields, models


Expand Down

0 comments on commit b9c083c

Please sign in to comment.