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

[WIP][14.0][ADD] mis_builder_company_comparison #478

Closed
Closed
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
3 changes: 3 additions & 0 deletions mis_builder_company_comparison/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import model
15 changes: 15 additions & 0 deletions mis_builder_company_comparison/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# © 2023 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "MIS Builder with compared companies",
"version": "14.0.1.0.0",
"category": "Reporting",
"author": "ForgeFlow, "
"Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/mis_builder",
"depends": ["mis_builder"],
"data": ["security/mis_builder_security.xml", "view/mis_builder.xml"],
"installable": True,
}
3 changes: 3 additions & 0 deletions mis_builder_company_comparison/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import mis_builder
42 changes: 42 additions & 0 deletions mis_builder_company_comparison/model/mis_builder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2023 ForgeFlow S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import fields, models

class MisReportInstance(models.Model):

_inherit = "mis.report.instance"

company_ids = fields.Many2many(
"res.company",
string="Companies",
)


class MisReportInstancePeriod(models.Model):

_inherit = "mis.report.instance.period"

company_ids = fields.Many2many(
"res.company",
string="Companies",
)

def _get_additional_move_line_filter(self):
aml_domain = super(
MisReportInstancePeriod, self
)._get_additional_move_line_filter()
sudoself = self.sudo()
if sudoself.report_instance_id.company_ids:
aml_domain.append(
(
"company_id",
"in",
sudoself.report_instance_id.company_ids.ids,
)
)
if sudoself.company_ids:
aml_domain.append(
("company_id", "in", sudoself.company_ids.ids)
)
return aml_domain
1 change: 1 addition & 0 deletions mis_builder_company_comparison/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Joan Sisquella <[email protected]>
1 change: 1 addition & 0 deletions mis_builder_company_comparison/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Introduces the company column to MIS Builder report instances.
1 change: 1 addition & 0 deletions mis_builder_company_comparison/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set the company in a MIS Builder instance.
16 changes: 16 additions & 0 deletions mis_builder_company_comparison/security/mis_builder_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!--Copyright 2023 ForgeFlow S.L. - -->
<record id="ir_rule_mis_builder_allowed_companies" model="ir.rule">
<field name="model_id" ref="mis_builder.model_mis_report_instance" />
<field
name="domain_force"
>['|',('company_ids','=',False),('company_ids','in',[g.id for g in user.company_ids])]</field>
<field name="name">MIS Reports from allowed companies</field>
<field name="global" eval="True" />
<field eval="1" name="perm_unlink" />
<field eval="1" name="perm_write" />
<field eval="1" name="perm_read" />
<field eval="1" name="perm_create" />
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions mis_builder_company_comparison/view/mis_builder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="mis_report_instance_view_tree">
<field name="name">mis.report.instance.view.tree</field>
<field name="model">mis.report.instance</field>
<field name="inherit_id" ref="mis_builder.mis_report_instance_view_tree" />
<field name="arch" type="xml">
<field name="target_move" position="after">
<field
name="company_ids"
widget="many2many_tags"
groups="base.group_multi_company"
/>
</field>
</field>
</record>
<record model="ir.ui.view" id="mis_report_instance_view_form">
<field name="name">mis.report.instance.view.form</field>
<field name="model">mis.report.instance</field>
<field name="inherit_id" ref="mis_builder.mis_report_instance_view_form" />
<field name="priority" eval="16" />
<field name="arch" type="xml">
<field name="target_move" position="after">
<field
name="company_ids"
widget="many2many_tags"
groups="base.group_multi_company"
/>
</field>
</field>
</record>
<record model="ir.ui.view" id="mis_report_instance_period_view_form">
<field name="name">mis.report.instance.period.view.form</field>
<field name="model">mis.report.instance.period</field>
<field
name="inherit_id"
ref="mis_builder.mis_report_instance_period_view_form"
/>
<field name="priority" eval="16" />
<field name="arch" type="xml">
<xpath expr="//group[@name='source_data']" position="inside">
<field
name="company_ids"
widget="many2many_tags"
groups="base.group_multi_company"
attrs="{'invisible': [('source', 'not in', ('actuals', 'actuals_alt'))]}"
/>
</xpath>
</field>
</record>
</odoo>