Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dreispt committed Dec 26, 2013
1 parent dbb658d commit fc47fec
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion project_sla/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
========================
Only Project Issue documents are made SLA controllable.
However, a framework is made available to easilly build extensions to make
However, a framework is made available to easily build extensions to make
other documents models SLA controlled.
SLA controlled documents have attached information on the list of SLA rules
Expand Down
2 changes: 0 additions & 2 deletions project_sla/analytic_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
##############################################################################

from openerp.osv import fields, orm
import logging
_logger = logging.getLogger(__name__)


class AnalyticAccount(orm.Model):
Expand Down
4 changes: 2 additions & 2 deletions project_sla/m2m.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def link(id):

def clear():
""" Unlink all referenced records (doesn't delete them) """
return [(5)]
return [(5, 0)]


def replace(ids):
Expand All @@ -70,6 +70,6 @@ def replace(ids):
assert write(99, {'name': 'Monty'}) == [(1, 99, {'name': 'Monty'})]
assert remove(99) == [(2, 99)]
assert unlink(99) == [(3, 99)]
assert clear() == [(5)]
assert clear() == [(5, 0)]
assert replace([97, 98, 99]) == [(6, 0, [97, 98, 99])]
print("Done!")
27 changes: 1 addition & 26 deletions project_sla/project_issue_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<!-- Project Issue List -->
<record model="ir.ui.view" id="project_issue_tree_view_sla">
<field name="name">project_issue_tree_view_slak</field>
<field name="name">project_issue_tree_view_sla</field>
<field name="model">project.issue</field>
<field name="inherit_id" ref="project_issue.project_issue_tree_view"/>
<field name="arch" type="xml">
Expand All @@ -56,30 +56,5 @@
</field>
</record>


<!--
<record id="project_issue_kanban_view_sla" model="ir.ui.view">
<field name="name">project_issue_kanban_view_sla</field>
<field name="model">project.issue</field>
<field name="inherit_id" ref="project_issue.project_issue_kanban_view" />
<field name="arch" type="xml">
<field name="kanban_state" position="after">
<field name="sla_state" />
</field>
<div class="oe_kanban_footer_left" position="inside">
<div class="oe_kanban_highlight" name="sla_icon_placeholder">
<span t-if="record.sla_state.raw_value === '3'"
class="oe_e oe_kanban_text_red">c</span>
<span t-if="record.sla_state.raw_value === '4'"
class="oe_e oe_kanban_text_red">[</span>
<span t-if="record.sla_state.raw_value === '1'"
class="oe_e oe_kanban_text_green">W</span>
</div>
</div>
</field>
</record>
-->
</data>
</openerp>
4 changes: 3 additions & 1 deletion project_sla/project_sla.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SLADefinition(orm.Model):
SLA Definition
"""
_name = 'project.sla'
_description = 'SLA Definition'
_columns = {
'name': fields.char('Title', size=64, required=True, translate=True),
'active': fields.boolean('Active'),
Expand All @@ -38,7 +39,7 @@ class SLADefinition(orm.Model):
'sla_line_ids': fields.one2many(
'project.sla.line', 'sla_id', 'Definitions'),
'analytic_ids': fields.many2many(
'account.analytic.account', string='Contracts'),
'account.analytic.account', string='Contracts'),
}
_defaults = {
'active': True,
Expand Down Expand Up @@ -67,6 +68,7 @@ class SLARules(orm.Model):
SLA Definition Rule Lines
"""
_name = 'project.sla.line'
_definition = 'SLA Definition Rule Lines'
_order = 'sla_id,sequence'
_columns = {
'sla_id': fields.many2one('project.sla', 'SLA Definition'),
Expand Down
6 changes: 3 additions & 3 deletions project_sla/project_sla_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def update_sla_states(self, cr, uid, context=None):
- exceeded warning dates are set to "warning"
To be used by a scheduled job.
"""
now = dt.strftime(dt.now(), DT_FMT)
now = dt.now().strftime(DT_FMT)
# SLAs to mark as "will fail"
control_ids = self.search(
cr, uid,
Expand Down Expand Up @@ -146,7 +146,7 @@ def _compute_sla_date(self, cr, uid, working_hours, res_uid,
assert isinstance(hours, int) and hours >= 0

cal_obj = self.pool.get('resource.calendar')
target, step = hours * 3600, 16 * 3600
target, step = hours * 3600, 16 * 3600
lo, hi = start_date, start_date
while target > 0 and step > 60:
hi = lo + timedelta(seconds=step)
Expand Down Expand Up @@ -237,7 +237,7 @@ def datetime2str(dt_value, fmt): # tolerant datetime to string
break

if sla_ids and not res:
_logger.warning("No valid SLA rule foun for %d, SLA Ids %s"
_logger.warning("No valid SLA rule found for %d, SLA Ids %s"
% (doc.id, repr([x.id for x in sla_ids])))
return res

Expand Down
2 changes: 1 addition & 1 deletion project_sla/project_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<data>

<record id="edit_project_sla" model="ir.ui.view">
<field name="name">edit_projec_sla</field>
<field name="name">edit_project_sla</field>
<field name="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml">
Expand Down

0 comments on commit fc47fec

Please sign in to comment.