[IMP] hr related modules changes

bzr revid: mra@mra-laptop-20100728123948-5v34vtjrxckvig14
This commit is contained in:
PSI(Openerp)
2010-07-28 18:09:48 +05:30
committed by Mustufa Rangwala
parent 489749c67e
commit b24856fd7a
4 changed files with 10 additions and 20 deletions
+1 -1
View File
@@ -98,7 +98,7 @@ class hr_holidays_status(osv.osv):
'name': fields.char('Name', size=64, required=True, translate=True),
'categ_id': fields.many2one('crm.case.categ', 'Meeting Category', domain="[('object_id.model', '=', 'crm.meeting')]", help='If you link this type of leave with a category in the CRM, it will synchronize each leave asked with a case in this category, to display it in the company shared calendar for example.'),
'color_name': fields.selection([('red', 'Red'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color in Report', required=True, help='This color will be used in the leaves summary located in Reporting\Leaves by Departement'),
'limit': fields.boolean('Allow to Override Limit', help='If you thick this checkbox, the system will allow, for this section, the employees to take more leaves than the available ones.'),
'limit': fields.boolean('Allow to Override Limit', help='If you tick this checkbox, the system will allow, for this section, the employees to take more leaves than the available ones.'),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the leave type without removing it."),
'max_leaves': fields.function(_user_left_days, method=True, string='Maximum Leaves Allowed', help='This value is given by the sum of all holidays requests with a positive value.', multi='user_left_days'),
'leaves_taken': fields.function(_user_left_days, method=True, string='Leaves Already Taken', help='This value is given by the sum of all holidays requests with a negative value.', multi='user_left_days'),
@@ -51,7 +51,6 @@ class analytical_timesheet_employees(osv.osv_memory):
'type': 'ir.actions.report.xml',
'report_name': 'hr.analytical.timesheet_users',
'datas': datas,
'nodestroy':True
}
analytical_timesheet_employees()
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -34,8 +34,7 @@ class account_analytic_profit(report_sxw.rml_parse):
def _user_ids(self, lines):
user_obj=pooler.get_pool(self.cr.dbname).get('res.users')
ids=list(set([b.user_id.id for b in lines]))
res=user_obj.browse(self.cr, self.uid, ids)
return res
return user_obj.browse(self.cr, self.uid, ids)
def _journal_ids(self, form, user_id):
line_obj=pooler.get_pool(self.cr.dbname).get('account.analytic.line')
@@ -47,8 +46,7 @@ class account_analytic_profit(report_sxw.rml_parse):
('user_id', '=', user_id),
])
ids=list(set([b.journal_id.id for b in line_obj.browse(self.cr, self.uid, line_ids)]))
res=journal_obj.browse(self.cr, self.uid, ids)
return res
return journal_obj.browse(self.cr, self.uid, ids)
def _line(self, form, journal_ids, user_ids):
pool=pooler.get_pool(self.cr.dbname)
@@ -103,12 +101,11 @@ class account_analytic_profit(report_sxw.rml_parse):
res[id]['amount'] += xxx
else:
res[id]['amount'] += xxx
res[id]['cost']+=line.amount
res[id]['unit_amount']+=line.unit_amount
for id in res:
res[id]['profit']=res[id]['amount']+res[id]['cost']
res[id]['eff']='%d' % (-res[id]['amount'] / res[id]['cost'] * 100,)
res[id]['eff']=res[id]['cost'] and '%d' % (-res[id]['amount'] / res[id]['cost'] * 100,) or 0.0
return res.values()
def _lines(self, form):
@@ -119,10 +116,8 @@ class account_analytic_profit(report_sxw.rml_parse):
('journal_id', 'in', form['journal_ids'][0][2]),
('user_id', 'in', form['employee_ids'][0][2]),
])
res=line_obj.browse(self.cr, self.uid, ids)
return res
return line_obj.browse(self.cr, self.uid, ids)
report_sxw.report_sxw('report.account.analytic.profit', 'account.analytic.line', 'addons/hr_timesheet_invoice/report/account_analytic_profit.rml', parser=account_analytic_profit)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -46,8 +46,6 @@ class account_analytic_profit(osv.osv_memory):
def print_report(self, cr, uid, ids, context=None):
line_obj = self.pool.get('account.analytic.line')
product_obj = self.pool.get('product.product')
price_obj = self.pool.get('product.pricelist')
if context is None:
context = {}
data = {}
@@ -67,14 +65,12 @@ class account_analytic_profit(osv.osv_memory):
'ids': [],
'model': 'account.analytic.line',
'form': data['form']
}
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.analytic.profit',
'datas': datas,
'nodestroy': True
}
}
account_analytic_profit()