Browse Source

[REF] auto-fix conventions

pull/8/head
moylop260 10 years ago
parent
commit
15d408c009
  1. 2
      account_analytic_analysis_recurring/__init__.py
  2. 14
      account_analytic_analysis_recurring/account_analytic_analysis_recurring.py
  3. 8
      analytic_hours_block/__init__.py
  4. 13
      analytic_hours_block/hours_block.py
  5. 15
      analytic_hours_block/project.py
  6. 2
      analytic_hours_block/report/__init__.py
  7. 4
      analytic_hours_block/report/hours_block.py
  8. 8
      project_sla/__init__.py
  9. 1
      project_sla/analytic_account.py
  10. 1
      project_sla/project_issue.py
  11. 2
      project_sla/project_sla.py
  12. 4
      project_sla/project_sla_control.py

2
account_analytic_analysis_recurring/__init__.py

@ -19,4 +19,4 @@
#
##############################################################################
import account_analytic_analysis_recurring
from . import account_analytic_analysis_recurring

14
account_analytic_analysis_recurring/account_analytic_analysis_recurring.py

@ -93,7 +93,7 @@ class account_analytic_invoice_line(osv.osv):
'uom_id': uom_id or res.uom_id.id or False,
'price_unit': res.list_price or 0.0})
if res.description:
result['name'] += '\n'+res.description
result['name'] += '\n' + res.description
res_final = {'value': result}
if result['uom_id'] != res.uom_id.id:
@ -237,14 +237,14 @@ class account_analytic_account(osv.osv):
contract.recurring_next_date or current_date, "%Y-%m-%d")
interval = contract.recurring_interval
if contract.recurring_rule_type == 'daily':
old_date = next_date-relativedelta(days=+interval)
new_date = next_date+relativedelta(days=+interval)
old_date = next_date - relativedelta(days=+interval)
new_date = next_date + relativedelta(days=+interval)
elif contract.recurring_rule_type == 'weekly':
old_date = next_date-relativedelta(weeks=+interval)
new_date = next_date+relativedelta(weeks=+interval)
old_date = next_date - relativedelta(weeks=+interval)
new_date = next_date + relativedelta(weeks=+interval)
else:
old_date = next_date+relativedelta(months=+interval)
new_date = next_date+relativedelta(months=+interval)
old_date = next_date + relativedelta(months=+interval)
new_date = next_date + relativedelta(months=+interval)
context['old_date'] = old_date
context['next_date'] = datetime.datetime.strptime(

8
analytic_hours_block/__init__.py

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import hours_block
import report
import product
import project
from . import hours_block
from . import report
from . import product
from . import project

13
analytic_hours_block/hours_block.py

@ -94,7 +94,7 @@ class AccountHoursBlock(orm.Model):
for line in block.invoice_id.invoice_line:
amount_bought = 0.0
if line.product_id:
## We will now calculate the product_quantity
# We will now calculate the product_quantity
factor = line.uos_id.factor
if factor == 0.0:
factor = 1.0
@ -103,7 +103,8 @@ class AccountHoursBlock(orm.Model):
result[block.id]['amount_hours_block'] += amount_bought
# Compute total amount
# Get ids of analytic line generated from timesheet associated to current block
# Get ids of analytic line generated from timesheet associated to
# current block
cr.execute("SELECT al.id FROM account_analytic_line AS al,"
" account_analytic_journal AS aj"
" WHERE aj.id = al.journal_id"
@ -139,7 +140,8 @@ class AccountHoursBlock(orm.Model):
for block_type in block_per_types:
if block_type:
func = getattr(self, "_compute_%s" % block_type)
result.update(func(cr, uid, ids, fields, args, context=context))
result.update(
func(cr, uid, ids, fields, args, context=context))
for block in result:
result[block]['amount_hours_block_delta'] = \
@ -161,7 +163,8 @@ class AccountHoursBlock(orm.Model):
block_ids = set()
inv_obj = self.pool.get('account.invoice')
for invoice in inv_obj.browse(cr, uid, ids, context=context):
block_ids.update([inv.id for inv in invoice.account_hours_block_ids])
block_ids.update(
[inv.id for inv in invoice.account_hours_block_ids])
return list(block_ids)
def action_send_block(self, cr, uid, ids, context=None):
@ -413,7 +416,7 @@ class AccountHoursBlock(orm.Model):
############################################################################
## Add hours blocks on invoice
# Add hours blocks on invoice
############################################################################
class AccountInvoice(orm.Model):
_inherit = 'account.invoice'

15
analytic_hours_block/project.py

@ -9,16 +9,19 @@ class project_project(orm.Model):
def hours_block_tree_view(self, cr, uid, ids, context):
invoice_line_obj = self.pool.get('account.invoice.line')
hours_block_obj = self.pool.get('account.hours.block')
project = self.browse(cr, uid , ids)[0]
invoice_line_ids = invoice_line_obj.search(cr, uid, [('account_analytic_id', '=', project.analytic_account_id.id)])
project = self.browse(cr, uid, ids)[0]
invoice_line_ids = invoice_line_obj.search(
cr, uid, [('account_analytic_id', '=', project.analytic_account_id.id)])
invoice_lines = invoice_line_obj.browse(cr, uid, invoice_line_ids)
invoice_ids = [x.invoice_id.id for x in invoice_lines]
res_ids = hours_block_obj.search(cr, uid, [('invoice_id','in',invoice_ids)])
domain=False
res_ids = hours_block_obj.search(
cr, uid, [('invoice_id', 'in', invoice_ids)])
domain = False
if res_ids:
domain = [('id', 'in', res_ids)]
else:
raise orm.except_orm(_('Warning'), _("No Hours Block for this project"))
raise orm.except_orm(
_('Warning'), _("No Hours Block for this project"))
return {
'name': _('Hours Blocks'),
@ -29,5 +32,5 @@ class project_project(orm.Model):
'view_mode': 'tree,form',
'view_type': 'form',
'limit': 80,
'res_id' : res_ids or False,
'res_id': res_ids or False,
}

2
analytic_hours_block/report/__init__.py

@ -18,4 +18,4 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import hours_block
from . import hours_block

4
analytic_hours_block/report/hours_block.py

@ -25,8 +25,10 @@ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
class account_hours_block(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(account_hours_block, self).__init__(cr, uid, name, context=context)
super(account_hours_block, self).__init__(
cr, uid, name, context=context)
self.localcontext.update({'time': time,
'date_format': DEFAULT_SERVER_DATE_FORMAT,
'analytic_lines': self._get_analytic_lines,

8
project_sla/__init__.py

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
import project_sla
import analytic_account
import project_sla_control
import project_issue
from . import project_sla
from . import analytic_account
from . import project_sla_control
from . import project_issue

1
project_sla/analytic_account.py

@ -22,6 +22,7 @@ from openerp.osv import fields, orm
class AnalyticAccount(orm.Model):
""" Add SLA to Analytic Accounts """
_inherit = 'account.analytic.account'
_columns = {

1
project_sla/project_issue.py

@ -22,6 +22,7 @@ from openerp.osv import orm
class ProjectIssue(orm.Model):
"""
Extend Project Issues to be SLA Controlled
"""

2
project_sla/project_sla.py

@ -22,6 +22,7 @@ from openerp.osv import fields, orm
class SLADefinition(orm.Model):
"""
SLA Definition
"""
@ -64,6 +65,7 @@ class SLADefinition(orm.Model):
class SLARules(orm.Model):
"""
SLA Definition Rule Lines
"""

4
project_sla/project_sla_control.py

@ -24,7 +24,7 @@ from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT as DT_FMT
from openerp import SUPERUSER_ID
from datetime import timedelta
from datetime import datetime as dt
import m2m
from . import m2m
import logging
_logger = logging.getLogger(__name__)
@ -56,6 +56,7 @@ def safe_getattr(obj, dotattr, default=False):
class SLAControl(orm.Model):
"""
SLA Control Registry
Each controlled document (Issue, Claim, ...) will have a record here.
@ -285,6 +286,7 @@ class SLAControl(orm.Model):
class SLAControlled(orm.AbstractModel):
"""
SLA Controlled documents: AbstractModel to apply SLA control on Models
"""

Loading…
Cancel
Save