Skip to content

Commit

Permalink
Merge pull request #610 from OCA/15.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/operating-unit (15.0)
  • Loading branch information
bt-admin authored Sep 22, 2024
2 parents 1849bc8 + 1bcc6d1 commit 9fcec09
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ addon | version | maintainers | summary
[account_asset_operating_unit](account_asset_operating_unit/) | 15.0.1.0.0 | [![ps-tubtim](https://github.com/ps-tubtim.png?size=30px)](https://github.com/ps-tubtim) | This module adds operating unit information to assets.
[account_asset_transfer_operating_unit](account_asset_transfer_operating_unit/) | 15.0.1.0.0 | [![Saran440](https://github.com/Saran440.png?size=30px)](https://github.com/Saran440) | Add operating unit to asset transfer
[account_financial_report_operating_unit](account_financial_report_operating_unit/) | 15.0.1.0.0 | | Introduces Operating Unit (OU) in financial reports
[account_operating_unit](account_operating_unit/) | 15.0.1.2.3 | | Introduces Operating Unit (OU) in invoices and Accounting Entries with clearing account
[account_operating_unit](account_operating_unit/) | 15.0.1.3.0 | | Introduces Operating Unit (OU) in invoices and Accounting Entries with clearing account
[account_operating_unit_access_all](account_operating_unit_access_all/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Access all OUs' Accounting
[analytic_operating_unit](analytic_operating_unit/) | 15.0.1.0.1 | | Analytic Operating Unit
[analytic_operating_unit_access_all](analytic_operating_unit_access_all/) | 15.0.1.0.0 | [![kittiu](https://github.com/kittiu.png?size=30px)](https://github.com/kittiu) | Access all OUs' Analytics
Expand Down
2 changes: 1 addition & 1 deletion account_operating_unit/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Accounting with Operating Units
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a0c8b4115b61b042e5545a1616c01b8ccf45e49d866edb0c294c71a167ab8e6e
!! source digest: sha256:30f35ebf41ce4e762d88dbb98c4d6fe2bec81cec6c23d6ea0f16952b04a2e203
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Accounting with Operating Units",
"summary": "Introduces Operating Unit (OU) in invoices and "
"Accounting Entries with clearing account",
"version": "15.0.1.2.3",
"version": "15.0.1.3.0",
"author": "ForgeFlow, "
"Serpent Consulting Services Pvt. Ltd.,"
"WilldooIT Pty Ltd,"
Expand Down
5 changes: 5 additions & 0 deletions account_operating_unit/i18n/account_operating_unit.pot
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ msgstr ""
msgid "Invoices Statistics"
msgstr ""

#. module: account_operating_unit
#: model:ir.model.fields,field_description:account_operating_unit.field_account_move_line__is_ou_balance
msgid "Is Ou Balance"
msgstr ""

#. module: account_operating_unit
#: model:ir.model,name:account_operating_unit.model_account_journal
msgid "Journal"
Expand Down
5 changes: 5 additions & 0 deletions account_operating_unit/i18n/es_MX.po
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ msgstr "Cuenta de compensación de unidades interoperativas"
msgid "Invoices Statistics"
msgstr "Estadísticas de facturas"

#. module: account_operating_unit
#: model:ir.model.fields,field_description:account_operating_unit.field_account_move_line__is_ou_balance
msgid "Is Ou Balance"
msgstr ""

#. module: account_operating_unit
#: model:ir.model,name:account_operating_unit.model_account_journal
msgid "Journal"
Expand Down
31 changes: 31 additions & 0 deletions account_operating_unit/migrations/15.0.1.3.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2024 ForgeFlow S.L. <https://www.forgeflow.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
if not openupgrade.column_exists(env.cr, "account_move_line", "is_ou_balance"):
openupgrade.logged_query(
env.cr,
"""
ALTER TABLE account_move_line
ADD COLUMN IF NOT EXISTS is_ou_balance BOOLEAN DEFAULT false
""",
)
openupgrade.logged_query(
env.cr,
"""ALTER TABLE account_move_line ALTER COLUMN is_ou_balance DROP DEFAULT""",
)
openupgrade.logged_query(
env.cr,
"""
UPDATE account_move_line aml0 SET is_ou_balance = true
FROM account_move_line aml
INNER JOIN res_company rc ON rc.id = aml.company_id
WHERE aml.name = 'OU-Balancing'
AND aml.account_id = rc.inter_ou_clearing_account_id
AND rc.ou_is_self_balanced = true
AND aml0.id = aml.id
""",
)
9 changes: 9 additions & 0 deletions account_operating_unit/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class AccountMoveLine(models.Model):
operating_unit_id = fields.Many2one(
comodel_name="operating.unit",
)
is_ou_balance = fields.Boolean(readonly=True)

@api.model_create_multi
def create(self, vals_list):
Expand Down Expand Up @@ -199,6 +200,8 @@ def _prepare_inter_ou_balancing_move_line(self, move, ou_id, ou_balances):
"operating_unit_id": ou_id,
"partner_id": move.partner_id and move.partner_id.id or False,
"account_id": move.company_id.inter_ou_clearing_account_id.id,
"is_ou_balance": True,
"exclude_from_invoice_tab": True,
}

if ou_balances[ou_id] < 0.0:
Expand Down Expand Up @@ -298,3 +301,9 @@ def _check_company_operating_unit(self):
)
)
return True

def button_draft(self):
res = super().button_draft()
for rec in self:
rec.line_ids.filtered(lambda l: l.is_ou_balance).unlink()
return res
13 changes: 8 additions & 5 deletions account_operating_unit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -366,7 +367,7 @@ <h1 class="title">Accounting with Operating Units</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a0c8b4115b61b042e5545a1616c01b8ccf45e49d866edb0c294c71a167ab8e6e
!! source digest: sha256:30f35ebf41ce4e762d88dbb98c4d6fe2bec81cec6c23d6ea0f16952b04a2e203
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/operating-unit/tree/15.0/account_operating_unit"><img alt="OCA/operating-unit" src="https://img.shields.io/badge/github-OCA%2Foperating--unit-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/operating-unit-15-0/operating-unit-15-0-account_operating_unit"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/operating-unit&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows a company to manage the accounting based on Operating
Expand Down Expand Up @@ -487,7 +488,9 @@ <h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down

0 comments on commit 9fcec09

Please sign in to comment.