Browse Source

Minor fixes

pull/2/head
Daniel Reis 11 years ago
parent
commit
fc47fecab2
  1. 2
      project_sla/__openerp__.py
  2. 2
      project_sla/analytic_account.py
  3. 4
      project_sla/m2m.py
  4. 27
      project_sla/project_issue_view.xml
  5. 2
      project_sla/project_sla.py
  6. 4
      project_sla/project_sla_control.py
  7. 2
      project_sla/project_view.xml

2
project_sla/__openerp__.py

@ -38,7 +38,7 @@ SLA Controlled Documents
======================== ========================
Only Project Issue documents are made SLA controllable. 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. other documents models SLA controlled.
SLA controlled documents have attached information on the list of SLA rules SLA controlled documents have attached information on the list of SLA rules

2
project_sla/analytic_account.py

@ -19,8 +19,6 @@
############################################################################## ##############################################################################
from openerp.osv import fields, orm from openerp.osv import fields, orm
import logging
_logger = logging.getLogger(__name__)
class AnalyticAccount(orm.Model): class AnalyticAccount(orm.Model):

4
project_sla/m2m.py

@ -55,7 +55,7 @@ def link(id):
def clear(): def clear():
""" Unlink all referenced records (doesn't delete them) """ """ Unlink all referenced records (doesn't delete them) """
return [(5)]
return [(5, 0)]
def replace(ids): def replace(ids):
@ -70,6 +70,6 @@ if __name__ == "__main__":
assert write(99, {'name': 'Monty'}) == [(1, 99, {'name': 'Monty'})] assert write(99, {'name': 'Monty'}) == [(1, 99, {'name': 'Monty'})]
assert remove(99) == [(2, 99)] assert remove(99) == [(2, 99)]
assert unlink(99) == [(3, 99)] assert unlink(99) == [(3, 99)]
assert clear() == [(5)]
assert clear() == [(5, 0)]
assert replace([97, 98, 99]) == [(6, 0, [97, 98, 99])] assert replace([97, 98, 99]) == [(6, 0, [97, 98, 99])]
print("Done!") print("Done!")

27
project_sla/project_issue_view.xml

@ -29,7 +29,7 @@
<!-- Project Issue List --> <!-- Project Issue List -->
<record model="ir.ui.view" id="project_issue_tree_view_sla"> <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="model">project.issue</field>
<field name="inherit_id" ref="project_issue.project_issue_tree_view"/> <field name="inherit_id" ref="project_issue.project_issue_tree_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
@ -56,30 +56,5 @@
</field> </field>
</record> </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> </data>
</openerp> </openerp>

2
project_sla/project_sla.py

@ -26,6 +26,7 @@ class SLADefinition(orm.Model):
SLA Definition SLA Definition
""" """
_name = 'project.sla' _name = 'project.sla'
_description = 'SLA Definition'
_columns = { _columns = {
'name': fields.char('Title', size=64, required=True, translate=True), 'name': fields.char('Title', size=64, required=True, translate=True),
'active': fields.boolean('Active'), 'active': fields.boolean('Active'),
@ -67,6 +68,7 @@ class SLARules(orm.Model):
SLA Definition Rule Lines SLA Definition Rule Lines
""" """
_name = 'project.sla.line' _name = 'project.sla.line'
_definition = 'SLA Definition Rule Lines'
_order = 'sla_id,sequence' _order = 'sla_id,sequence'
_columns = { _columns = {
'sla_id': fields.many2one('project.sla', 'SLA Definition'), 'sla_id': fields.many2one('project.sla', 'SLA Definition'),

4
project_sla/project_sla_control.py

@ -109,7 +109,7 @@ class SLAControl(orm.Model):
- exceeded warning dates are set to "warning" - exceeded warning dates are set to "warning"
To be used by a scheduled job. 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" # SLAs to mark as "will fail"
control_ids = self.search( control_ids = self.search(
cr, uid, cr, uid,
@ -237,7 +237,7 @@ class SLAControl(orm.Model):
break break
if sla_ids and not res: 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]))) % (doc.id, repr([x.id for x in sla_ids])))
return res return res

2
project_sla/project_view.xml

@ -3,7 +3,7 @@
<data> <data>
<record id="edit_project_sla" model="ir.ui.view"> <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="model">project.project</field>
<field name="inherit_id" ref="project.edit_project"/> <field name="inherit_id" ref="project.edit_project"/>
<field name="arch" type="xml"> <field name="arch" type="xml">

Loading…
Cancel
Save