Skip to content

Commit

Permalink
[ADD] analytic_operating_unit: make distribution widget OU aware
Browse files Browse the repository at this point in the history
inspired by v17 migration
  • Loading branch information
hbrunn committed Jul 18, 2024
1 parent 623707d commit f0c0e9c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion analytic_operating_unit/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Analytic Operating Unit
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ddc73bd20cef56f742cce3ce9fc89e8d1c3ef0d1af2fa12c00ea979b5bca5754
!! source digest: sha256:c851023c5fd1efd782860c24af48d7a60c191b3b3a77e4bb4c535f4588c51a44
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
5 changes: 5 additions & 0 deletions analytic_operating_unit/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,10 @@
"security/analytic_account_security.xml",
"views/analytic_account_view.xml",
],
"assets": {
"web.assets_backend": [
"analytic_operating_unit/static/src/components/analytic_distribution.esm.js",
],
},
"installable": True,
}
2 changes: 1 addition & 1 deletion analytic_operating_unit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Analytic Operating Unit</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ddc73bd20cef56f742cce3ce9fc89e8d1c3ef0d1af2fa12c00ea979b5bca5754
!! source digest: sha256:c851023c5fd1efd782860c24af48d7a60c191b3b3a77e4bb4c535f4588c51a44
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/16.0/analytic_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-16-0/operating-unit-16-0-analytic_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=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows users to introduce into the analytic accounts the allowed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/** @odoo-module **/

import {AnalyticDistribution} from "@analytic/components/analytic_distribution/analytic_distribution";
import {patch} from "@web/core/utils/patch";

patch(AnalyticDistribution.prototype, "analytic_operating_unit", {
analyticAccountDomain(groupId = null) {
var domain = this._super(groupId);
if (this.props.record.data.operating_unit_id) {
domain.push(
"|",
[
"operating_unit_ids",
"=",
this.props.record.data.operating_unit_id[0],
],
["operating_unit_ids", "=", false]
);
}
return domain;
},
});

0 comments on commit f0c0e9c

Please sign in to comment.