From dadcbbc470fb88d57a61aa6a25062dff85e5db3b Mon Sep 17 00:00:00 2001
From: Renzo Meister
Date: Tue, 8 Jun 2021 13:33:25 +0200
Subject: [PATCH] apply from old repository
apply from old repository
---
mis_builder/models/kpimatrix.py | 4 +-
mis_builder/models/mis_report.py | 23 ++-
mis_builder/models/mis_report_instance.py | 1 +
.../report/mis_report_instance_qweb.xml | 72 ++++----
mis_builder/static/src/css/report.css | 39 ++---
mis_builder/views/mis_report.xml | 1 +
mis_builder/views/mis_report_instance.xml | 1 +
mis_builder/wizard/mis_builder_dashboard.py | 2 +-
.../models/mis_budget_by_account_item.py | 6 +
mis_builder_expimp/__init__.py | 1 +
mis_builder_expimp/__manifest__.py | 16 ++
.../static/description/icon.png | Bin 0 -> 4770 bytes
.../static/description/index.html | 69 ++++++++
.../static/description/screenshot.png | Bin 0 -> 73830 bytes
mis_builder_expimp/wizards/__init__.py | 2 +
.../wizards/mis_builder_export_views.xml | 45 +++++
.../wizards/mis_builder_export_wizard.py | 162 ++++++++++++++++++
.../wizards/mis_builder_import_views.xml | 34 ++++
.../wizards/mis_builder_import_wizard.py | 153 +++++++++++++++++
19 files changed, 571 insertions(+), 60 deletions(-)
create mode 100644 mis_builder_expimp/__init__.py
create mode 100644 mis_builder_expimp/__manifest__.py
create mode 100644 mis_builder_expimp/static/description/icon.png
create mode 100644 mis_builder_expimp/static/description/index.html
create mode 100644 mis_builder_expimp/static/description/screenshot.png
create mode 100644 mis_builder_expimp/wizards/__init__.py
create mode 100644 mis_builder_expimp/wizards/mis_builder_export_views.xml
create mode 100644 mis_builder_expimp/wizards/mis_builder_export_wizard.py
create mode 100644 mis_builder_expimp/wizards/mis_builder_import_views.xml
create mode 100644 mis_builder_expimp/wizards/mis_builder_import_wizard.py
diff --git a/mis_builder/models/kpimatrix.py b/mis_builder/models/kpimatrix.py
index 764eacb..a626a9d 100644
--- a/mis_builder/models/kpimatrix.py
+++ b/mis_builder/models/kpimatrix.py
@@ -6,6 +6,7 @@ from collections import OrderedDict, defaultdict
from flectra import _
from flectra.exceptions import UserError
+from flectra.tools import float_is_zero
from .accounting_none import AccountingNone
from .mis_kpi_data import ACC_SUM
@@ -71,7 +72,8 @@ class KpiMatrixRow(object):
def is_empty(self):
for cell in self.iter_cells():
- if cell and cell.val not in (AccountingNone, None):
+ dp = cell and cell.row.kpi.env.user.company_id.currency_id.decimal_places or 6
+ if cell and not float_is_zero(cell.val, dp) and cell.val not in (AccountingNone, None):
return False
return True
diff --git a/mis_builder/models/mis_report.py b/mis_builder/models/mis_report.py
index ce178b9..8869cf7 100644
--- a/mis_builder/models/mis_report.py
+++ b/mis_builder/models/mis_report.py
@@ -390,10 +390,15 @@ class MisReportQuery(models.Model):
)
date_field = fields.Many2one(
comodel_name="ir.model.fields",
- required=True,
+ required=False,
domain=[("ttype", "in", ("date", "datetime"))],
ondelete="restrict",
)
+ query_context = fields.Text(
+ string='Context',
+ translate=False,
+ default='{}',
+ )
domain = fields.Char(string="Domain")
report_id = fields.Many2one(
comodel_name="mis.report", string="Report", required=True, ondelete="cascade"
@@ -580,7 +585,21 @@ class MisReport(models.Model):
self.ensure_one()
res = {}
for query in self.query_ids:
- model = self.env[query.model_id.model]
+ eval_context = {
+ "env": self.env,
+ "fields": fields,
+ "time": time,
+ "datetime": datetime,
+ "dateutil": dateutil,
+ # deprecated
+ "uid": self.env.uid,
+ "context": self.env.context,
+ "date_from": date_from,
+ "date_to": date_to,
+
+ }
+ ctx = query.query_context and safe_eval(query.query_context, eval_context) or {}
+ model = self.env[query.model_id.model].with_context(ctx)
eval_context = {
"env": self.env,
"time": time,
diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py
index a2e29c6..39cceb4 100644
--- a/mis_builder/models/mis_report_instance.py
+++ b/mis_builder/models/mis_report_instance.py
@@ -534,6 +534,7 @@ class MisReportInstance(models.Model):
)
landscape_pdf = fields.Boolean(string="Landscape PDF")
no_auto_expand_accounts = fields.Boolean(string="Disable account details expansion")
+ use_external_layout = fields.Boolean(string='Use External Layout')
display_columns_description = fields.Boolean(
help="Display the date range details in the column headers."
)
diff --git a/mis_builder/report/mis_report_instance_qweb.xml b/mis_builder/report/mis_report_instance_qweb.xml
index ca5f923..09966d0 100644
--- a/mis_builder/report/mis_report_instance_qweb.xml
+++ b/mis_builder/report/mis_report_instance_qweb.xml
@@ -20,7 +20,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -44,47 +58,42 @@
-
-
-
-
+
+
+
+ |
-
-
+
+ |
+
+
+
-
+ |
-
-
-
+
+
+
+
-
-
@@ -93,24 +102,21 @@
-
+
-
-
+
-
+
-
+
+
-
-
-
-
diff --git a/mis_builder/static/src/css/report.css b/mis_builder/static/src/css/report.css
index 0d58939..60c111b 100644
--- a/mis_builder/static/src/css/report.css
+++ b/mis_builder/static/src/css/report.css
@@ -1,46 +1,39 @@
.mis_table {
- display: table;
width: 100%;
- table-layout: fixed;
}
.mis_row {
- display: table-row;
page-break-inside: avoid;
}
.mis_cell {
- display: table-cell;
page-break-inside: avoid;
}
-.mis_thead {
- display: table-header-group;
-}
-.mis_tbody {
- display: table-row-group;
-}
-.mis_table,
-.mis_table .mis_row {
- border-left: 0px;
- border-right: 0px;
- text-align: left;
- padding-right: 3px;
- padding-left: 3px;
- padding-top: 2px;
- padding-bottom: 2px;
- border-collapse: collapse;
-}
+
.mis_table .mis_row {
border-color: grey;
border-bottom: 1px solid lightGrey;
}
-.mis_table .mis_cell.mis_collabel {
+
+.mis_table .mis_cell.mis_collabel_group {
font-weight: bold;
background-color: #f0f0f0;
text-align: center;
}
+
+.mis_table .mis_cell.mis_collabel_group, .mis_table .mis_cell.mis_collabel.mis_first {
+ border-left: 2px solid #fff;
+}
+
+.mis_table .mis_cell.mis_collabel {
+ font-weight: bold;
+ background-color: #f0f0f0;
+ text-align: right;
+ padding-right: 5px;
+}
.mis_table .mis_cell.mis_rowlabel {
text-align: left;
- /*white-space: nowrap;*/
+ white-space: nowrap;
}
.mis_table .mis_cell.mis_amount {
text-align: right;
+ padding-right: 5px;
}
diff --git a/mis_builder/views/mis_report.xml b/mis_builder/views/mis_report.xml
index 14b8f1f..0cd66d4 100644
--- a/mis_builder/views/mis_report.xml
+++ b/mis_builder/views/mis_report.xml
@@ -68,6 +68,7 @@
name="date_field"
domain="[('model_id', '=', model_id), ('ttype', 'in', ('date', 'datetime'))]"
/>
+
diff --git a/mis_builder/views/mis_report_instance.xml b/mis_builder/views/mis_report_instance.xml
index 70adfee..73cc57a 100644
--- a/mis_builder/views/mis_report_instance.xml
+++ b/mis_builder/views/mis_report_instance.xml
@@ -189,6 +189,7 @@
+
diff --git a/mis_builder/wizard/mis_builder_dashboard.py b/mis_builder/wizard/mis_builder_dashboard.py
index b9ffe73..b58b8b0 100644
--- a/mis_builder/wizard/mis_builder_dashboard.py
+++ b/mis_builder/wizard/mis_builder_dashboard.py
@@ -17,7 +17,7 @@ class AddMisReportInstanceDashboard(models.TransientModel):
"ir.actions.act_window",
string="Dashboard",
required=True,
- domain="[('res_model', '=', " "'board.board')]",
+ domain="[('res_model', '=', 'board.board')]",
)
@api.model
diff --git a/mis_builder_budget/models/mis_budget_by_account_item.py b/mis_builder_budget/models/mis_budget_by_account_item.py
index b14a219..9e30891 100644
--- a/mis_builder_budget/models/mis_budget_by_account_item.py
+++ b/mis_builder_budget/models/mis_budget_by_account_item.py
@@ -37,6 +37,12 @@ class MisBudgetByAccountItem(models.Model):
required=True,
# TODO domain (company_id)
)
+ user_type_id = fields.Many2one(
+ comodel_name='account.account.type',
+ related='account_id.user_type_id',
+ store=True,
+ readonly=True,
+ )
_sql_constraints = [
(
diff --git a/mis_builder_expimp/__init__.py b/mis_builder_expimp/__init__.py
new file mode 100644
index 0000000..326c3db
--- /dev/null
+++ b/mis_builder_expimp/__init__.py
@@ -0,0 +1 @@
+from . import wizards
\ No newline at end of file
diff --git a/mis_builder_expimp/__manifest__.py b/mis_builder_expimp/__manifest__.py
new file mode 100644
index 0000000..7456fc5
--- /dev/null
+++ b/mis_builder_expimp/__manifest__.py
@@ -0,0 +1,16 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+{
+ "name": "MIS Builder Import / Export",
+ "summary": """Import / Export Reports with all dependencies""",
+ "version": "1.0.1.0.0",
+ "license": "AGPL-3",
+ "author": "Jamotion GmbH",
+ "website": "https://gitlab.com/flectra-community/mis-builder",
+ "depends": ["mis_builder"],
+ "data": [
+ "wizards/mis_builder_export_views.xml",
+ "wizards/mis_builder_import_views.xml",
+ ],
+ "installable": True,
+}
diff --git a/mis_builder_expimp/static/description/icon.png b/mis_builder_expimp/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..1afa781fabb8088818f3940ef56711e6281bd31e
GIT binary patch
literal 4770
zcmV;T5?$?yP)TNr9!Lz*16DU@0lEloVJ>
zN(w9`1(uQmOG!zArKG@8QeY`5DX^3jSV{^kB_#!xlKW)1wq-&Cr-aOPgOvp-E30RP
z06l>4N5L09_zX)0*6_wrAJS|`mU3vL&Ok&*BQyhWDrO*%(ne-Gk;xWhcMC!jh}am=
z10Wp*)^I>2QZ2|(1EI_B$JcZznr>8N=Ssjywqmt!rugo1tR1Tmb{?&IVmTsv7%-7s
zGA)HmHePcigk_SP6D0J77x7n(^;BmUTh~*3?H)>R|2KN|$q=Xl$MPaq?XEHJjw7jx
z8tiM^&CbTJc@8Q7|JbvLUi~1!`Ae|Vdy(c|(0poEIFym9Dq@gHn>@3#n&_!lc-nu2
zW_^|L=N`q$Cy{2GC*jiE098Ds;Yi6NYuf42MlxYSqvy?S;FPNgU-!Q_xg?}_dk!vb
zxS@&$G(fOoQ<9cWi`uZnD&%`N!%`w0+jW1AHWd<>w1DuU$FYl9Fxx;gJOh?7oKQvl
z8ipZwY*Uiv_5!sr9Y;!JA2({#ivM84il0(7YLq)>eU5{9U?20ozJ!TqUiq>2J6hhx
zE*2R%`7`~%H6O0~Et#d4qazT}QJygL#&AIu@(X-^ji+Bv@?Kkk+NeRn?Em-D2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u}DqSB>DUXYOOmbN9QZE=wYDEJ?h63_@t09S*&_2z@Z|7_S@Sx^Kg1x_;OP
zs)$wLeoIN2cO@0E-0rgkj$>mLvWJI8H?+wJgwZtJHEmL04bZ$hwuRZ%PNcdXp&1PS
z{)6ROceAsdNX
z#)sr=9tGAAs*p($9Wj!#Zn({LZJWLD+r0PE!*sQ6Bb=yH=Do7g4Gy|Lgk5syLT`D;
zKkwGOdv_69l>LkwcXTPY%SH&b2wiy*%dyc7AHHDJeb8(ALF29>R^^$;K$vvr9(vlh
zyRL0!R~tQhKJ4=t6J_3AEPp6QF5Sap|8fP5GcP^7j57R@)M4kF&r{5sgyPjI-B5|<
zJ)Ec^)v=RTm)+%_BQykrVnHI+4c_0;Q85i(s?{7uqaOL*;3YrKG@8QeY`5DX^3j
zSV{^kB_#!xk^)P~Q>v&0sa+~k%#}}_IFVG$fmO^au!c%P)6k6*?^`$JWu3hDx)p
zy@lzQ+=T8svB0t|i$FN0z&ctT+KjfZgNwq6I?tB!9#bUOedS%Dm3i-j@<5Pmav!-=
zr=sOZA4b3~WXfZ|N)dB}D(&8cy?Y&6XoLc*zsE0}2(V%KovsV*
zZdLx}e?}7yQd1GDU$SDg^>nsu<)OcyL+8#dikv>wy|0zziW`uvs}WUAu6q#0k}r-)
z0q&V{2!SR9-R-S}6A2n;UP_|A5uqENK8EdxqJSnaa~8?YHf9=|86$RK#hc2-vF_@d
zcK6NOrNohv>QUn;!F8_udC9@gnGZ9Kx10&BRSO6D8_hQ@WX6C|RB=b%zx4FgoEyn{~{
zTtBCZx`aV8ZFvqV1=ewfDxG(b60V(w}vf~3=BsDuJb>1ZSb
z>83Dd+QL3Tpi*EB5mc64&Q)DBHNx!4
z2TO{b69*~<)?h
+
+
+
+
+
MIS Builder - Import / Export
+ Function to import / export MIS Report Templates
+
+
+
+
+
+
+
Full export and import of report template
+
+
+
+
+
+ When exporting a report, all related data are exported too:
+
+
+ - KPIs
+ - SubKPIs
+ - Expressions
+ - Queries
+ - Sub Reports
+ - Styles
+
+
+
+
+
+
+
+
Quick Start
+
+
Installation
+
+
+ There are no dependencies other than flectra base modules, so you can simply install the module.
+
+
+
+
+
Configuration
+
+
+ No configuration options available.
+
+
+
+
+
Usage
+
+
+ You will find two new menu items at Finance -> Configuration -> MIS Reporting:
+
+
+ - Export MIS Report -> shows a PopUp to select the report to export
+ - Import MIS Report -> shows a PopUp to select the file of exported report to import
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mis_builder_expimp/static/description/screenshot.png b/mis_builder_expimp/static/description/screenshot.png
new file mode 100644
index 0000000000000000000000000000000000000000..9cbb176a16c35c0e6a21bf092b8ffc9ddccb8aaa
GIT binary patch
literal 73830
zcmV+a{{R4qP)Qet)cNR+!j8K_NiT
z^p0JILV%vAmp94)dZy>1@v#p*jzlu=F_Z#yEUU#VlPkJ)y}vEC;&xs6mfNCIsc=|z
zlvhv$0001Rdq>>PT$m_|UAe7STDo91^L2IYOu(wu?f+cB-PnmZ!!W3k00000007sG
zMG*i10000003t2`00000001H`000000000YE&u=k0000$t0X7_000000JwR~Kd$TW
zc`ELH0tE}LLMtu+000000Nf_fihJwnsCzHr9z_5E004k9XPh(NX3&ZY00000006fM
zwBiB)0002oZWz9i%F675l>9Og6bnsP4K1?*Ko#03BV008KDSZg_d;8#ndz_5Zq8j7E%^pkh16%<2;OG6Zb
z%}zuNU(FQc*qC5${1llxBk~-}HOi8=8q2H{GE6#ffK;v%igWBn5qlO8aW5l^BH8Wj
zOkl6BGH0G@X9B5@Z+l0omlxM3`U)%1uC_Y*chtqV00000&?6#lS(ef0Ax@p6bhk07
zTN+QDv`rl??M`dRDCAt#G4s*$zn|v%Y9-b}@z*4?*`1qmw>qqszyvEtMleQG*PaSD
zI~B*Jxrn&XVTaQ#G=EVPZ-ZEVOK-*Pu?ud$Z2