Skip to content

Commit

Permalink
quickfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ng-ife committed Jul 25, 2024
1 parent d1c2c34 commit 30cbfa2
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 29 deletions.
2 changes: 1 addition & 1 deletion ass/ife_test_reports/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"website": "https://www.ife.de",
"category": "Accounting/Localizations",
"version": "16.0.1.0.3",
"depends": ["base", "ife_company_fields"],
"depends": ["base"],
"data": ["views/res_company_view.xml", "data/res_company_type_fields.xml"],
"license": "LGPL-3",
"application": True,
Expand Down
64 changes: 47 additions & 17 deletions ass/ife_test_reports/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,42 @@ class ResCompany(models.Model):
partner_company_type = fields.Many2one(related="partner_id.partner_company_type_id")
company_fields = fields.Many2many(comodel_name="res.company.type.fields")
registry_court = fields.Char()
managing_directors = fields.Many2many(comodel_name="res.partner", relation="managing_directors_rel")
managing_directors = fields.Many2many(
comodel_name="res.partner", relation="managing_directors_rel"
)
board_chair = fields.Many2many(
comodel_name="res.partner", relation="board_chair_rel", string="Chairmen of the Board"
comodel_name="res.partner",
relation="board_chair_rel",
string="Chairmen of the Board",
)
board_of_directors = fields.Many2many(
comodel_name="res.partner", relation="board_of_direcotrs_rel", string="Board of Directors"
comodel_name="res.partner",
relation="board_of_direcotrs_rel",
string="Board of Directors",
)
supervisory_board_chair = fields.Many2many(
comodel_name="res.partner", relation="supervisory_board_rel", string="Chairmen of the Supervisory Board"
comodel_name="res.partner",
relation="supervisory_board_rel",
string="Chairmen of the Supervisory Board",
)
personal_liable_partner = fields.Many2one(comodel_name="res.partner")

has_registry_court = fields.Boolean(compute="_compute_company_fields", default="False")
has_managing_directors = fields.Boolean(compute="_compute_company_fields", default="False")
has_registry_court = fields.Boolean(
compute="_compute_company_fields", default="False"
)
has_managing_directors = fields.Boolean(
compute="_compute_company_fields", default="False"
)
has_board_chair = fields.Boolean(compute="_compute_company_fields", default="False")
has_board_of_directors = fields.Boolean(compute="_compute_company_fields", default="False")
has_supervisory_board_chair = fields.Boolean(compute="_compute_company_fields", default="False")
has_personal_liable_partner = fields.Boolean(compute="_compute_company_fields", default="False")
has_board_of_directors = fields.Boolean(
compute="_compute_company_fields", default="False"
)
has_supervisory_board_chair = fields.Boolean(
compute="_compute_company_fields", default="False"
)
has_personal_liable_partner = fields.Boolean(
compute="_compute_company_fields", default="False"
)

abr_registry_court = fields.Char(compute="_compute_company_fields")
abr_managing_directors = fields.Char(compute="_compute_company_fields")
Expand All @@ -39,8 +57,8 @@ def _compute_company_fields(self):
for record in self:
record["has_company_fields"] = False
for field in record.env["res.company.type.fields"].search([]):
field_key = "has_{}".format(field.field_name)
field_key_abr = "abr_{}".format(field.field_name)
field_key = f"has_{field.field_name}"
field_key_abr = f"abr_{field.field_name}"
if record.partner_company_type in field.company_types:
record["has_company_fields"] = True
record[field_key] = True
Expand All @@ -59,19 +77,31 @@ class BaseDocumentLayout(models.TransientModel):
managing_directors = fields.Many2many(related="company_id.managing_directors")
board_chair = fields.Many2many(related="company_id.board_chair")
board_of_directors = fields.Many2many(related="company_id.board_of_directors")
supervisory_board_chair = fields.Many2many(related="company_id.supervisory_board_chair")
personal_liable_partner = fields.Many2one(related="company_id.personal_liable_partner")
supervisory_board_chair = fields.Many2many(
related="company_id.supervisory_board_chair"
)
personal_liable_partner = fields.Many2one(
related="company_id.personal_liable_partner"
)

has_registry_court = fields.Boolean(related="company_id.has_registry_court")
has_managing_directors = fields.Boolean(related="company_id.has_managing_directors")
has_board_chair = fields.Boolean(related="company_id.has_board_chair")
has_board_of_directors = fields.Boolean(related="company_id.has_board_of_directors")
has_supervisory_board_chair = fields.Boolean(related="company_id.has_supervisory_board_chair")
has_personal_liable_partner = fields.Boolean(related="company_id.has_personal_liable_partner")
has_supervisory_board_chair = fields.Boolean(
related="company_id.has_supervisory_board_chair"
)
has_personal_liable_partner = fields.Boolean(
related="company_id.has_personal_liable_partner"
)

abr_registry_court = fields.Char(related="company_id.abr_registry_court")
abr_managing_directors = fields.Char(related="company_id.abr_managing_directors")
abr_board_chair = fields.Char(related="company_id.abr_board_chair")
abr_board_of_directors = fields.Char(related="company_id.abr_board_of_directors")
abr_supervisory_board_chair = fields.Char(related="company_id.abr_supervisory_board_chair")
abr_personal_liable_partner = fields.Char(related="company_id.abr_personal_liable_partner")
abr_supervisory_board_chair = fields.Char(
related="company_id.abr_supervisory_board_chair"
)
abr_personal_liable_partner = fields.Char(
related="company_id.abr_personal_liable_partner"
)
25 changes: 14 additions & 11 deletions ass/ife_test_reports/views/res_company_view.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_res_company_inherit" model="ir.ui.view">
<field name="name">view.res.company.inherit</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='website']" position="after">
<field name="partner_id" invisible="1"/>
<field name="partner_company_type"/>
<field name="has_registry_court" invisible="1"/>
<field name="has_managing_directors" invisible="1"/>
<field name="has_board_chair" invisible="1"/>
<field name="has_board_of_directors" invisible="1"/>
<field name="has_supervisory_board_chair" invisible="1"/>
<field name="has_personal_liable_partner" invisible="1"/>
<field name="partner_id" invisible="1" />
<field name="partner_company_type" />
<field name="has_registry_court" invisible="1" />
<field name="has_managing_directors" invisible="1" />
<field name="has_board_chair" invisible="1" />
<field name="has_board_of_directors" invisible="1" />
<field name="has_supervisory_board_chair" invisible="1" />
<field name="has_personal_liable_partner" invisible="1" />
<field
name="managing_directors"
widget="many2many_tags"
Expand All @@ -40,7 +40,10 @@
/>
</xpath>
<xpath expr="//field[@name='company_registry']" position="after">
<field name="registry_court" attrs="{'invisible':[('has_registry_court', '=', False)]}"/>
<field
name="registry_court"
attrs="{'invisible':[('has_registry_court', '=', False)]}"
/>
</xpath>
</field>
</record>
Expand Down

0 comments on commit 30cbfa2

Please sign in to comment.