Skip to content

Commit

Permalink
Standard migration: Views and readonlies
Browse files Browse the repository at this point in the history
  • Loading branch information
Tisho99 committed Apr 29, 2024
1 parent 50c415d commit e55160d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
5 changes: 0 additions & 5 deletions l10n_es_aeat_mod115/models/mod115.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ class L10nEsAeatMod115Report(models.Model):
)
casilla_04 = fields.Float(
string="[04] Fees to compensate",
readonly=True,
states={"calculated": [("readonly", False)]},
help="Fee to compensate for prior results with same subject, "
"fiscal year and period (in which his statement was to return "
"and compensation back option was chosen).",
)
casilla_05 = fields.Float(
string="[05] Result",
readonly=True,
compute="_compute_casilla_05",
help="Result: ([03] - [04])",
)
Expand All @@ -48,8 +45,6 @@ class L10nEsAeatMod115Report(models.Model):
],
string="Result type",
default="N",
readonly=True,
states={"draft": [("readonly", False)]},
required=True,
)
tipo_declaracion_positiva = fields.Selection(
Expand Down
31 changes: 17 additions & 14 deletions l10n_es_aeat_mod115/views/mod115_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,59 +26,62 @@
<field
name="tipo_declaracion_positiva"
string="Result type"
attrs="{'invisible': [('casilla_05', '&lt;=', 0.0)]}"
invisible="casilla_05 &lt;= 0.0"
/>
<field
name="tipo_declaracion_negativa"
string="Result type"
attrs="{'invisible': [('casilla_05', '&gt;', 0.0)]}"
invisible="casilla_05 &gt; 0.0"
readonly="True"
/>
<field
name="tipo_declaracion"
invisible="True"
readonly="state != 'draft'"
/>
<field name="tipo_declaracion" invisible="True" />
</field>
<group name="group_declaration" position="after">
<group
string="Result"
name="group_result"
attrs="{'invisible': [('state', '=', 'draft')]}"
invisible="state == 'draft'"
colspan="4"
>
<group string="Amounts retained">
<field name="casilla_01" />
<field name="casilla_01" readonly="True" />
<field
name="casilla_03"
widget="monetary"
options="{'currency_field': 'currency_id'}"
readonly="True"
/>
</group>
<group string="Totals">
<field
name="casilla_04"
widget="monetary"
options="{'currency_field': 'currency_id'}"
attrs="{'readonly': ['|', ('state', '!=', 'calculated'), ('statement_type', '!=', 'C')]}"
readonly="state != 'calculated' or statement_type != 'C'"
/>
<field
name="casilla_05"
widget="monetary"
options="{'currency_field': 'currency_id'}"
readonly="True"
/>
</group>
<separator
string="Tax lines"
attrs="{'invisible': [('state', '=', 'draft')]}"
/>
<separator string="Tax lines" invisible="state == 'draft'" />
<field
name="tax_line_ids"
nolabel="1"
readonly="1"
attrs="{'invisible': [('state', '=', 'draft')]}"
invisible="state == 'draft'"
/>
</group>
</group>
<field name="partner_bank_id" position="attributes">
<attribute
name="attrs"
>{'required': [('tipo_declaracion', 'in', ('U', 'N',))]}</attribute>
<attribute name="required">tipo_declaracion in ('U', 'N')
</attribute>
</field>
<form position="inside">
<div class="oe_chatter">
Expand Down

0 comments on commit e55160d

Please sign in to comment.