Skip to content

Commit

Permalink
Translated using Weblate (Spanish (Argentina))
Browse files Browse the repository at this point in the history
Currently translated at 100.0% (469 of 469 strings)

Translation: field-service-13.0/field-service-13.0-fieldservice
Translate-URL: https://translation.odoo-community.org/projects/field-service-13-0/field-service-13-0-fieldservice/es_AR/

[13.0] [IMP] fieldservice: Minor Changes

Forward port from 12.0

Merge PR OCA#491 into 12.0

Signed-off-by max3903
  • Loading branch information
ibuioli authored and max3903 committed Oct 10, 2022
1 parent f5239bf commit f80c9ab
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 32 deletions.
14 changes: 7 additions & 7 deletions fieldservice/i18n/es_AR.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-08-07 01:59+0000\n"
"PO-Revision-Date: 2020-10-25 00:08+0000\n"
"Last-Translator: Ignacio Buioli <ibuioli@gmail.com>\n"
"Language-Team: none\n"
"Language: es_AR\n"
Expand Down Expand Up @@ -714,7 +714,7 @@ msgstr "Creado por"
#: model:ir.model.fields,field_description:fieldservice.field_fsm_template__create_date
#: model:ir.model.fields,field_description:fieldservice.field_fsm_wizard__create_date
msgid "Created on"
msgstr "Creado en"
msgstr "Creado el"

#. module: fieldservice
#: model:ir.model.fields,field_description:fieldservice.field_fsm_location__credit_limit
Expand Down Expand Up @@ -997,7 +997,7 @@ msgstr "Pedido de Servicio de Campo"
#. module: fieldservice
#: model:ir.model,name:fieldservice.model_fsm_template
msgid "Field Service Order Template"
msgstr "Plantilla de Pedido de Servicio de Campo"
msgstr "Plantilla del Pedido de Servicio de Campo"

#. module: fieldservice
#: model:ir.model,name:fieldservice.model_fsm_order_type
Expand Down Expand Up @@ -1379,7 +1379,7 @@ msgstr "Idioma"
#: model:ir.model.fields,field_description:fieldservice.field_fsm_template____last_update
#: model:ir.model.fields,field_description:fieldservice.field_fsm_wizard____last_update
msgid "Last Modified on"
msgstr "Última Modificación en"
msgstr "??ltima Modificaci??n el"

#. module: fieldservice
#: model:ir.model.fields,field_description:fieldservice.field_fsm_category__write_uid
Expand Down Expand Up @@ -1973,7 +1973,7 @@ msgstr "Oportunidades"
#: model:ir.model.fields,field_description:fieldservice.field_fsm_location__opportunity_count_ids
#: model:ir.model.fields,field_description:fieldservice.field_fsm_person__opportunity_count_ids
msgid "Opportunities Count"
msgstr ""
msgstr "Cuenta de Oportunidades"

#. module: fieldservice
#: model:ir.model.fields,field_description:fieldservice.field_fsm_person__opportunity_count
Expand Down Expand Up @@ -2630,7 +2630,7 @@ msgstr "Equipos"
#: model:ir.model.fields,help:fieldservice.field_fsm_location__opportunity_count_ids
#: model:ir.model.fields,help:fieldservice.field_fsm_person__opportunity_count_ids
msgid "Technical field used for stat button"
msgstr ""
msgstr "Campo técnico utilizado para el botón de estadísticas"

#. module: fieldservice
#: model:ir.model.fields,field_description:fieldservice.field_fsm_order__template_id
Expand Down Expand Up @@ -2737,7 +2737,7 @@ msgstr "Para Asignar"
#: model_terms:ir.ui.view,arch_db:fieldservice.fsm_order_search_view
#: model_terms:ir.ui.view,arch_db:fieldservice.view_team_kanban
msgid "To Do"
msgstr "Para Hacer"
msgstr "Por Hacer"

#. module: fieldservice
#: model_terms:ir.ui.view,arch_db:fieldservice.view_team_kanban
Expand Down
19 changes: 11 additions & 8 deletions fieldservice/models/fsm_location.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class FSMLocation(models.Model):
string="Complete Name", compute="_compute_complete_name", store=True
)
hide = fields.Boolean(default=False)

stage_id = fields.Many2one(
"fsm.stage",
string="Stage",
Expand All @@ -79,7 +80,7 @@ class FSMLocation(models.Model):
default=lambda self: self._default_stage_id(),
)

@api.depends("partner_id.name", "fsm_parent_id.complete_name")
@api.depends("partner_id.name", "fsm_parent_id.complete_name", "ref")
def _compute_complete_name(self):
for loc in self:
if loc.fsm_parent_id:
Expand Down Expand Up @@ -285,15 +286,15 @@ def action_view_contacts(self):
action = self.env.ref("contacts.action_contacts").read()[0]
contacts = self.get_action_views(1, 0, location)
action["context"] = self.env.context.copy()
action["context"].update({"group_by": ""})
action["context"].update({"default_service_location_id": self.id})
if len(contacts) == 1:
action["views"] = [(self.env.ref("base.view_partner_form").id, "form")]
action["res_id"] = contacts.id
action["context"].update({"active_id": contacts.id})
else:
if len(contacts) == 0 or len(contacts) > 1:
action["domain"] = [("id", "in", contacts.ids)]
action["context"].update({"active_ids": contacts.ids})
action["context"].update({"active_id": ""})
elif contacts:
action["views"] = [
(self.env.ref("base." + "view_partner_form").id, "form")
]
action["res_id"] = contacts.id
return action

def _compute_contact_ids(self):
Expand All @@ -311,6 +312,7 @@ def action_view_equipment(self):
action = self.env.ref("fieldservice.action_fsm_equipment").read()[0]
equipment = self.get_action_views(0, 1, location)
action["context"] = self.env.context.copy()
action["context"].update({"group_by": ""})
action["context"].update({"default_location_id": self.id})
if len(equipment) == 0 or len(equipment) > 1:
action["domain"] = [("id", "in", equipment.ids)]
Expand Down Expand Up @@ -339,6 +341,7 @@ def action_view_sublocation(self):
action = self.env.ref("fieldservice.action_fsm_location").read()[0]
sublocation = self.get_action_views(0, 0, location)
action["context"] = self.env.context.copy()
action["context"].update({"group_by": ""})
action["context"].update({"default_fsm_parent_id": self.id})
if len(sublocation) > 1 or len(sublocation) == 0:
action["domain"] = [("id", "in", sublocation.ids)]
Expand Down
38 changes: 25 additions & 13 deletions fieldservice/models/fsm_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from datetime import datetime, timedelta

from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.exceptions import UserError, ValidationError

from . import fsm_stage

Expand Down Expand Up @@ -269,7 +269,15 @@ def create(self, vals):
) + timedelta(hours=8)
return super(FSMOrder, self).create(vals)

is_button = fields.Boolean(default=False)

def write(self, vals):
if vals.get("stage_id", False) and vals.get("is_button", False):
vals["is_button"] = False
else:
stage_id = self.env["fsm.stage"].browse(vals.get("stage_id"))
if stage_id == self.env.ref("fieldservice.fsm_stage_completed"):
raise UserError(_("Cannot move to completed from Kanban"))
self._calc_scheduled_dates(vals)
res = super(FSMOrder, self).write(vals)
return res
Expand Down Expand Up @@ -334,7 +342,10 @@ def _calc_scheduled_dates(self, vals):

def action_complete(self):
return self.write(
{"stage_id": self.env.ref("fieldservice.fsm_stage_completed").id}
{
"stage_id": self.env.ref("fieldservice.fsm_stage_completed").id,
"is_button": True,
}
)

def action_cancel(self):
Expand All @@ -359,40 +370,41 @@ def onchange_scheduled_duration(self):
self.scheduled_date_end = str(date_to_with_delta)

def copy_notes(self):
old_desc = self.description
self.description = ""
self.location_directions = ""
if self.type and self.type.name not in ["repair", "maintenance"]:
for equipment_id in self.equipment_ids:
if equipment_id:
if equipment_id.notes is not False:
if self.description is not False:
if equipment_id.notes:
if self.description:
self.description = (
self.description + equipment_id.notes + "\n "
)
else:
self.description = equipment_id.notes + "\n "
else:
if self.equipment_id:
if self.equipment_id.notes is not False:
if self.description is not False:
if self.equipment_id.notes:
if self.description:
self.description = (
self.description + self.equipment_id.notes + "\n "
)
else:
self.description = self.equipment_id.notes + "\n "
if self.location_id:
s = self.location_id.direction
if s is not False and s != "<p><br></p>":
if s and s != "<p><br></p>":
s = s.replace("<p>", "")
s = s.replace("<br>", "")
s = s.replace("</p>", "\n")
if self.location_directions is not False:
self.location_directions = (
self.location_directions + "\n" + s + "\n"
)
else:
self.location_directions = s + "\n "
self.location_directions = s + "\n "
if self.template_id:
self.todo = self.template_id.instructions
if self.description:
self.description += "\n" + old_desc
else:
self.description = old_desc

@api.onchange("location_id")
def onchange_location_id(self):
Expand Down
7 changes: 3 additions & 4 deletions fieldservice/views/fsm_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
groups="fieldservice.group_fsm_dispatcher"
attrs="{'invisible': [('stage_id', 'in', (%(fieldservice.fsm_stage_completed)d, %(fieldservice.fsm_stage_cancelled)d))]}"
/>
<field name="is_button" invisible="1" />
<button
id="action_cancel"
name="action_cancel"
Expand Down Expand Up @@ -363,14 +364,12 @@
/>
<filter
string="Due Within 7 Days"
domain="[('scheduled_date_start','&lt;=',(context_today()+relativedelta(days=7)).strftime('%Y-%m-%d')),
('create_date','&gt;=',context_today().strftime('%Y-%m-%d'))]"
domain="[('scheduled_date_start','&lt;=',(context_today()+relativedelta(days=7)).strftime('%Y-%m-%d')), ('create_date','&gt;=',context_today().strftime('%Y-%m-%d'))]"
name="order_upcoming_all"
/>
<filter
string="Due Within 30 Days"
domain="[('scheduled_date_start','&lt;=',(context_today()+relativedelta(days=30)).strftime('%Y-%m-%d')),
('create_date','&gt;=',context_today().strftime('%Y-%m-%d'))]"
domain="[('scheduled_date_start','&lt;=',(context_today()+relativedelta(days=30)).strftime('%Y-%m-%d')), ('create_date','&gt;=',context_today().strftime('%Y-%m-%d'))]"
name="order_upcoming_all"
/>
<separator />
Expand Down

0 comments on commit f80c9ab

Please sign in to comment.