Skip to content

Commit

Permalink
[MIG] hr_employee_ppe: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoRomera committed Sep 12, 2024
1 parent 8665177 commit 0ad1228
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 36 deletions.
2 changes: 1 addition & 1 deletion hr_employee_ppe/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Personal Protective Equipment (PPE) Management",
"version": "14.0.1.0.1",
"version": "17.0.1.0.0",
"author": "Escodoo, Odoo Community Association (OCA)",
"maintainers": ["marcelsavegnago", "eduaparicio"],
"images": ["static/description/banner.png"],
Expand Down
3 changes: 2 additions & 1 deletion hr_employee_ppe/models/hr_personal_equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ def _validate_allocation_vals(self):
return res

def validate_allocation(self):
super().validate_allocation()
res = super().validate_allocation()
self._check_dates()
return res

@api.model
def cron_ppe_expiry_verification(self, date_ref=None):
Expand Down
1 change: 0 additions & 1 deletion hr_employee_ppe/models/product_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class ProductTemplate(models.Model):

is_ppe = fields.Boolean(default=False)
indications = fields.Text(
string="Indications",
help="Situations in which the employee should use this equipment. Only for ppe",
)
expirable_ppe = fields.Boolean(
Expand Down
6 changes: 3 additions & 3 deletions hr_employee_ppe/reports/hr_employee_ppe_report_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
t-if="line.is_ppe"
>
<td>
<t t-esc="line.product_id.name" />
<t t-out="line.product_id.name" />
</td>
<td>
<t t-esc="line.quantity" />
<t t-out="line.quantity" />
</td>
<td>
<t t-esc="line.indications" />
<t t-out="line.indications" />
</td>
</tr>
</t>
Expand Down
34 changes: 13 additions & 21 deletions hr_employee_ppe/views/hr_personal_equipment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,45 +29,37 @@
name="is_ppe"
string="Is PPE"
readonly="1"
attrs="{'invisible':[('is_ppe', '=', False)]}"
invisible="not is_ppe"
/>
</xpath>
<xpath expr="//field[@name='start_date']" position="before">
<field
name="expire_ppe"
string="Expirable"
attrs="{'invisible':[('is_ppe', '=', False)],'readonly': [('state', 'not in', ('draft','accepted'))]}"
invisible="not is_ppe"
readonly="state not in ['draft','accepted']"
/>
</xpath>
<field name="expiry_date" position="attributes">
<attribute name="attrs">
{'invisible':['&amp;', ('state', '!=', 'expired'), ('expire_ppe', '=', False)],'readonly': [('state', 'not in', ('draft','accepted'))]}
</attribute>
<attribute
name="invisible"
>state != 'expired' and (not expire_ppe)</attribute>
<attribute name="readonly">state not in ['draft','accepted']</attribute>
</field>
<xpath expr="//group[@name='date']" position="after">
<group
name="directions_info"
string="PPE Indications"
attrs="{'invisible':[('is_ppe', '=', False)]}"
invisible="not is_ppe"
>
<field
name="indications"
attrs="{'invisible':[('is_ppe', '=', False)]}"
readonly="1"
/>
<field name="indications" invisible="not is_ppe" readonly="1" />
</group>
<group
string="Certification Information"
attrs="{'invisible':[('is_ppe', '=', False)]}"
>
<field
name="issued_by"
attrs="{'invisible':[('is_ppe', '=', False)]}"
readonly="1"
/>
<group string="Certification Information" invisible="not is_ppe">
<field name="issued_by" invisible="not is_ppe" readonly="1" />
<field
name="certification"
attrs="{'invisible':[('is_ppe', '=', False)],'readonly': [('state', 'not in', ('draft','accepted'))]}"
invisible="not is_ppe"
readonly="state not in ['draft','accepted']"
/>
</group>
</xpath>
Expand Down
2 changes: 1 addition & 1 deletion hr_employee_ppe/views/hr_personal_equipment_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
name="action_view_ppe_report"
string="Print Receipt of PPE"
groups="hr.group_hr_user"
attrs="{'invisible':['|',('contains_ppe','=',False), ('state', 'not in', ('draft', 'accepted'))]}"
invisible="(not contains_ppe) or state not in ['draft', 'accepted']"
/>
</xpath>
<xpath
Expand Down
15 changes: 7 additions & 8 deletions hr_employee_ppe/views/product_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,25 @@
<field
name="is_ppe"
string="Is PPE"
attrs="{'invisible': [('is_personal_equipment', '=', False)]}"
invisible="not is_personal_equipment"
/>
<field
name="indications"
string="PPE Indications"
attrs="{'invisible': [('is_ppe', '=', False)]}"
/>
<field
name="expirable_ppe"
attrs="{'invisible': [('is_ppe', '=', False)]}"
invisible="not is_ppe"
/>
<field name="expirable_ppe" invisible="not is_ppe" />
<field
name="ppe_duration"
string="PPE Duration"
attrs="{'invisible': [('expirable_ppe', '=', False)], 'required': [('expirable_ppe', '!=', False)]}"
invisible="not expirable_ppe"
required="expirable_ppe"
/>
<field
name="ppe_interval_type"
string="PPE Interval Type"
attrs="{'invisible': [('expirable_ppe', '=', False)], 'required': [('expirable_ppe', '!=', False)]}"
invisible="not expirable_ppe"
required="expirable_ppe"
/>
</group>
</page>
Expand Down

0 comments on commit 0ad1228

Please sign in to comment.