[MERGE] merged branch lp:~openerp-dev/openobject-addons/trunk-proper-stat-buttons-ged-rma--ypa
bzr revid: rma@tinyerp.com-20140326132356-vxv3zygiw2b0wp18
This commit is contained in:
@@ -135,6 +135,17 @@ class event_event(osv.osv):
|
||||
res[event.id]= True
|
||||
continue
|
||||
return res
|
||||
|
||||
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'count_regitrations': 0, 'count_tracks': 0,}), ids))
|
||||
try:
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
res[data.id] = {'count_regitrations': len(data.registration_ids),
|
||||
'count_tracks': len(data.track_ids),
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Event Name', size=64, required=True, translate=True, readonly=False, states={'done': [('readonly', True)]}),
|
||||
@@ -147,6 +158,7 @@ class event_event(osv.osv):
|
||||
'seats_unconfirmed': fields.function(_get_seats, oldname='register_prospect', string='Unconfirmed Seat Reservations', type='integer', multi='seats_reserved'),
|
||||
'seats_used': fields.function(_get_seats, oldname='register_attended', string='Number of Participations', type='integer', multi='seats_reserved'),
|
||||
'registration_ids': fields.one2many('event.registration', 'event_id', 'Registrations', readonly=False, states={'done': [('readonly', True)]}),
|
||||
'track_ids': fields.one2many('event.track', 'event_id', 'Tracks', readonly=False),
|
||||
'date_begin': fields.datetime('Start Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'date_end': fields.datetime('End Date', required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'state': fields.selection([
|
||||
@@ -169,6 +181,8 @@ class event_event(osv.osv):
|
||||
'company_id': fields.many2one('res.company', 'Company', required=False, change_default=True, readonly=False, states={'done': [('readonly', True)]}),
|
||||
'is_subscribed' : fields.function(_subscribe_fnc, type="boolean", string='Subscribed'),
|
||||
'organizer_id': fields.many2one('res.partner', "Organizer"),
|
||||
'count_regitrations': fields.function(_count_all, type="integer", string="Registrations", multi=True),
|
||||
'count_tracks': fields.function(_count_all, type='integer', string='Tracks', multi=True),
|
||||
}
|
||||
_defaults = {
|
||||
'state': 'draft',
|
||||
|
||||
@@ -66,7 +66,13 @@
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box" groups="base.group_user">
|
||||
<button name="%(event.act_event_list_register_event)d" type="action" string="Registrations" help="Register with this event"/>
|
||||
<button name="%(event.act_event_list_register_event)d"
|
||||
type="action"
|
||||
class="oe_stat_button oe_inline"
|
||||
icon="fa-github"
|
||||
help="Register with this event">
|
||||
<field name="count_regitrations" widget="statinfo" string="Registrations"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
@@ -363,11 +369,12 @@
|
||||
<field name="name"/>
|
||||
<field name="phone"/>
|
||||
<label for="email"/>
|
||||
<div>
|
||||
<div class="oe_button_box">
|
||||
<field name="email" class="oe_inline"/>
|
||||
<button class="oe_inline oe_right" string="Send Email"
|
||||
<button class="oe_inline oe_right oe_stat_button"
|
||||
string="Send Email"
|
||||
name="%(mail.action_email_compose_message_wizard)d"
|
||||
icon="terp-mail-message-new" context= '{"default_email_to":email}' type="action"/>
|
||||
icon="fa-reply-all" context= '{"default_email_to":email}' type="action"/>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
@@ -313,6 +313,20 @@ class fleet_vehicle(osv.Model):
|
||||
except ValueError:
|
||||
model_id = False
|
||||
return model_id
|
||||
|
||||
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'odometer_count': 0, 'fuel_logs_count': 0, 'service_count': 0, 'contract_count': 0, 'cost_count': 0,}), ids))
|
||||
try:
|
||||
for costs in self.browse(cr, uid, ids, context=context):
|
||||
res[costs.id] = {'odometer_count': len(costs.odometer_ids),
|
||||
'fuel_logs_count': len(costs.log_fuel),
|
||||
'service_count': len(costs.log_services),
|
||||
'contract_count': len(costs.log_contracts),
|
||||
'cost_count': len(costs.costs_ids)
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_name = 'fleet.vehicle'
|
||||
_description = 'Information on a vehicle'
|
||||
@@ -327,6 +341,13 @@ class fleet_vehicle(osv.Model):
|
||||
'log_fuel': fields.one2many('fleet.vehicle.log.fuel', 'vehicle_id', 'Fuel Logs'),
|
||||
'log_services': fields.one2many('fleet.vehicle.log.services', 'vehicle_id', 'Services Logs'),
|
||||
'log_contracts': fields.one2many('fleet.vehicle.log.contract', 'vehicle_id', 'Contracts'),
|
||||
'costs_ids': fields.one2many('fleet.vehicle.cost', 'vehicle_id', 'Costs'),
|
||||
'odometer_ids': fields.one2many('fleet.vehicle.odometer', 'vehicle_id', 'Odometer'),
|
||||
'cost_count': fields.function(_count_all, type='integer', string="Costs" , multi=True),
|
||||
'contract_count': fields.function(_count_all, type='integer', string='Contracts', multi=True),
|
||||
'service_count': fields.function(_count_all, type='integer', string='Services', multi=True),
|
||||
'fuel_logs_count': fields.function(_count_all, type='integer', string='Fuel Logs', multi=True),
|
||||
'odometer_count': fields.function(_count_all, type='integer', string='Odometer', multi=True),
|
||||
'acquisition_date': fields.date('Acquisition Date', required=False, help='Date when the vehicle has been bought'),
|
||||
'color': fields.char('Color', size=32, help='Color of the vehicle'),
|
||||
'state_id': fields.many2one('fleet.vehicle.state', 'State', help='Current state of the vehicle', ondelete="set null"),
|
||||
|
||||
@@ -211,11 +211,46 @@
|
||||
<field name="tag_ids" widget="many2many_tags" />
|
||||
</div>
|
||||
<div class="oe_right oe_button_box">
|
||||
<button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_log_contract_act'}" string="Contracts" help="show the contract for this vehicle" />
|
||||
<button name="act_show_log_cost" type="object" string="Costs" help="show all the costs for this vehicle" groups="fleet.group_fleet_manager"/>
|
||||
<button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_log_services_act'}" string="Services" help="show the services logs for this vehicle" />
|
||||
<button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_log_fuel_act'}" string="Fuel Logs" help="show the fuel logs for this vehicle" />
|
||||
<button name="return_action_to_open" type="object" context="{'xml_id':'fleet_vehicle_odometer_act'}" string="Odometer Logs" help="show the odometer logs for this vehicle" />
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-thumbs-o-up"
|
||||
context="{'xml_id':'fleet_vehicle_log_contract_act'}"
|
||||
help="show the contract for this vehicle">
|
||||
<field name="contract_count" widget="statinfo" string="Contracts"/>
|
||||
</button>
|
||||
<button name="act_show_log_cost"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-money"
|
||||
help="show all the costs for this vehicle"
|
||||
groups="fleet.group_fleet_manager">
|
||||
<field name="cost_count" widget="statinfo" string="Costs"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-wrench"
|
||||
context="{'xml_id':'fleet_vehicle_log_services_act'}"
|
||||
help="show the services logs for this vehicle" >
|
||||
<field name="service_count" widget="statinfo" string="Services"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-flask"
|
||||
context="{'xml_id':'fleet_vehicle_log_fuel_act'}"
|
||||
help="show the fuel logs for this vehicle" >
|
||||
<field name="fuel_logs_count" widget="statinfo" string="Fuel Logs"/>
|
||||
</button>
|
||||
<button name="return_action_to_open"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-tachometer"
|
||||
context="{'xml_id':'fleet_vehicle_odometer_act'}"
|
||||
help="show the odometer logs for this vehicle" >
|
||||
<field name="odometer_count" widget="statinfo" string="odometer Logs"/>
|
||||
</button>
|
||||
</div>
|
||||
<group col="2" string="General Properties">
|
||||
<group >
|
||||
|
||||
@@ -114,6 +114,15 @@ class gamification_challenge(osv.Model):
|
||||
return self.pool.get('ir.model.data').get_object_reference(cr, uid, 'gamification', 'simple_report_template')[1]
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
def _count_goals(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = {}
|
||||
try:
|
||||
for goals in self.browse(cr, uid, ids, context=context):
|
||||
res[goals.id] = len(goals.goals_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_order = 'end_date, start_date, name, id'
|
||||
_columns = {
|
||||
@@ -191,6 +200,8 @@ class gamification_challenge(osv.Model):
|
||||
|
||||
'category': fields.selection(lambda s, *a, **k: s._get_categories(*a, **k),
|
||||
string="Appears in", help="Define the visibility of the challenge through menus", required=True),
|
||||
'goals_ids': fields.one2many('gamification.goal', 'challenge_id', 'Related Goals'),
|
||||
'goals_count': fields.function(_count_goals, type='integer', string='Related Goals')
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
||||
@@ -53,7 +53,13 @@
|
||||
|
||||
<!-- action buttons -->
|
||||
<div class="oe_right oe_button_box">
|
||||
<button type="action" name="%(goals_from_challenge_act)d" string="Related Goals" attrs="{'invisible': [('state','=','draft')]}" />
|
||||
<button type="action"
|
||||
name="%(goals_from_challenge_act)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-globe"
|
||||
attrs="{'invisible': [('state','=','draft')]}">
|
||||
<field name="goals_count" widget="statinfo" string="Related Goals"/>
|
||||
</button>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
|
||||
@@ -92,6 +92,17 @@ class hr_job(osv.Model):
|
||||
res.append(employee.job_id.id)
|
||||
return res
|
||||
|
||||
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'documents_count': 0, 'application_count': 0,}), ids))
|
||||
try:
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
res[data.id] = {'documents_count': len(data.document_ids),
|
||||
'application_count': len(data.applicant_ids),
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_name = "hr.job"
|
||||
_description = "Job Position"
|
||||
_inherit = ['mail.thread', 'ir.needaction_mixin']
|
||||
@@ -122,6 +133,10 @@ class hr_job(osv.Model):
|
||||
track_visibility='always',
|
||||
help="By default 'Closed', set it to 'In Recruitment' if recruitment process is going on for this job position."),
|
||||
'write_date': fields.datetime('Update Date', readonly=True),
|
||||
'applicant_ids':fields.one2many('hr.applicant', 'job_id', 'Applications'),
|
||||
'application_count': fields.function(_count_all, type='integer', string='Applications', multi=True),
|
||||
'document_ids': fields.one2many('ir.attachment', 'company_id', 'Documents'),
|
||||
'documents_count': fields.function(_count_all, type='integer', string='Documents', multi=True),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
@@ -186,6 +201,20 @@ class hr_employee(osv.osv):
|
||||
|
||||
def _set_image(self, cr, uid, id, name, value, args, context=None):
|
||||
return self.write(cr, uid, [id], {'image': tools.image_resize_image_big(value)}, context=context)
|
||||
|
||||
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'appraisal_count': 0, 'leaves_count': 0, 'contracts_count': 0, 'timesheet_count': 0, 'payslip_count': 0,}), ids))
|
||||
try:
|
||||
for datas in self.browse(cr, uid, ids, context=context):
|
||||
res[datas.id] = {'appraisal_count': len(datas.appraisal_ids),
|
||||
'leaves_count': len(datas.leave_ids),
|
||||
'contracts_count': len(datas.contract_ids),
|
||||
'timesheet_count': len(datas.timsheet_ids),
|
||||
'payslip_count': len(datas.payslip_ids)
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
#we need a related field in order to be able to sort the employee by name
|
||||
@@ -237,6 +266,16 @@ class hr_employee(osv.osv):
|
||||
'city': fields.related('address_id', 'city', type='char', string='City'),
|
||||
'login': fields.related('user_id', 'login', type='char', string='Login', readonly=1),
|
||||
'last_login': fields.related('user_id', 'date', type='datetime', string='Latest Connection', readonly=1),
|
||||
'appraisal_ids': fields.one2many('hr.evaluation.interview', 'user_to_review_id', 'Appraisal Interviews'),
|
||||
'leave_ids': fields.one2many('hr.holidays', 'employee_id', 'Leaves'),
|
||||
'contracts_ids': fields.one2many('hr.contract', 'employee_id', 'Contracts'),
|
||||
'timsheet_ids': fields.one2many('hr_timesheet_sheet.sheet', 'employee_id', 'Timesheets'),
|
||||
'payslip_ids': fields.one2many('hr.payslip', 'employee_id', 'Payslips'),
|
||||
'appraisal_count': fields.function(_count_all, type='integer', string='Appraisal Interviews', multi=True),
|
||||
'leaves_count': fields.function(_count_all, type='integer', string='Leaves', multi=True),
|
||||
'contracts_count': fields.function(_count_all, type='integer', string='Contracts', multi=True),
|
||||
'timesheet_count': fields.function(_count_all, type='integer', string='Timsheets', multi=True),
|
||||
'payslip_count': fields.function(_count_all, type='integer', string='Payslips', multi=True),
|
||||
}
|
||||
|
||||
def _get_default_image(self, cr, uid, context=None):
|
||||
|
||||
@@ -21,7 +21,13 @@
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<button name="%(act_hr_employee_2_hr_contract)d" string="Contracts" type="action" groups="base.group_hr_manager"/>
|
||||
<button name="%(act_hr_employee_2_hr_contract)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-thumbs-o-up"
|
||||
type="action"
|
||||
groups="base.group_hr_manager">
|
||||
<field name="contracts_count" widget="statinfo" string="Contracts"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='coach_id']" position="after">
|
||||
<field name="manager"/>
|
||||
|
||||
@@ -145,7 +145,12 @@
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<button name="%(act_hr_employee_2_hr__evaluation_interview)d" string="Appraisal Interviews" type="action"/>
|
||||
<button name="%(act_hr_employee_2_hr__evaluation_interview)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-briefcase"
|
||||
type="action">
|
||||
<field name="appraisal_count" widget="statinfo" string="Appraisal Interviews"/>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -483,7 +483,13 @@
|
||||
</group>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<button name="%(act_hr_employee_holiday_request)d" string="Leaves" type="action" groups="base.group_hr_user"/>
|
||||
<button name="%(act_hr_employee_holiday_request)d"
|
||||
type="action"
|
||||
class="oe_stat_button"
|
||||
icon="fa-calendar"
|
||||
groups="base.group_hr_user">
|
||||
<field name="leaves_count" widget="statinfo" string="Leaves"/>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -258,6 +258,15 @@ class hr_payslip(osv.osv):
|
||||
for r in res:
|
||||
result[r[0]].append(r[1])
|
||||
return result
|
||||
|
||||
def _count_detail_payslip(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = {}
|
||||
try:
|
||||
for details in self.browse(cr, uid, ids, context=context):
|
||||
res[details.id] = len(details.line_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'struct_id': fields.many2one('hr.payroll.structure', 'Structure', readonly=True, states={'draft': [('readonly', False)]}, help='Defines the rules that have to be applied to this payslip, accordingly to the contract chosen. If you let empty the field contract, this field isn\'t mandatory anymore and thus the rules applied will be all the rules set on the structure of all contracts of the employee valid for the chosen period'),
|
||||
@@ -287,6 +296,7 @@ class hr_payslip(osv.osv):
|
||||
'details_by_salary_rule_category': fields.function(_get_lines_salary_rule_category, method=True, type='one2many', relation='hr.payslip.line', string='Details by Salary Rule Category'),
|
||||
'credit_note': fields.boolean('Credit Note', help="Indicates this payslip has a refund of another", readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'payslip_run_id': fields.many2one('hr.payslip.run', 'Payslip Batches', readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'payslip_count': fields.function(_count_detail_payslip, type='integer', string="Payslip Computation Details"),
|
||||
}
|
||||
_defaults = {
|
||||
'date_from': lambda *a: time.strftime('%Y-%m-01'),
|
||||
|
||||
@@ -222,7 +222,12 @@
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box">
|
||||
<button name="%(act_payslip_lines)d" string="Payslip Computation Details" type="action"/>
|
||||
<button name="%(act_payslip_lines)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-comment"
|
||||
type="action">
|
||||
<field name="payslip_count" widget="statinfo" string="Payslip Computation Details"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="employee_id" class="oe_edit_only"/>
|
||||
@@ -387,7 +392,13 @@
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<button name="%(act_hr_employee_payslip_list)d" string="Payslips" type="action" groups="base.group_hr_user"/>
|
||||
<button name="%(act_hr_employee_payslip_list)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-money"
|
||||
type="action"
|
||||
groups="base.group_hr_user">
|
||||
<field name="payslip_count" widget="statinfo" string="Payslips"/>
|
||||
</button>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
|
||||
@@ -74,16 +74,27 @@
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_right oe_button_box">
|
||||
<button name="action_makeMeeting" type="object"
|
||||
string="Schedule Meeting" help="Schedule interview with this applicant"/>
|
||||
<button name="%(survey.action_view_survey_question_message)d" type="action"
|
||||
<button name="action_makeMeeting" class="oe_stat_button" icon="fa-calendar" type="object"
|
||||
string="Schedule Meeting" help="Schedule interview with this applicant"/>
|
||||
<button name="%(survey.action_view_survey_question_message)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-pencil-square-o"
|
||||
type="action"
|
||||
string="Start Interview" help="Answer related job question"
|
||||
context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant'}"
|
||||
attrs="{'invisible':[('survey','=',False)]}"/>
|
||||
<button name="action_print_survey" type="object"
|
||||
<button name="action_print_survey"
|
||||
class="oe_stat_button"
|
||||
icon="fa-pencil-square-o"
|
||||
type="object"
|
||||
string="Print Interview" help="Print interview report"
|
||||
attrs="{'invisible':[('survey','=',False)]}"/>
|
||||
<button name="action_get_attachment_tree_view" string="Documents" type="object"/>
|
||||
<button name="action_get_attachment_tree_view"
|
||||
class="oe_stat_button"
|
||||
icon="fa-pencil-square-o"
|
||||
type="object">
|
||||
<field name="attachment_number" widget="statinfo" string="Documents"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
@@ -367,10 +378,23 @@
|
||||
<xpath expr="//field[@name='department_id']" position="after">
|
||||
<field name="user_id" class="oe_inline"/>
|
||||
</xpath>
|
||||
<div name="buttons" position="inside">
|
||||
<button string="Applications" name="%(action_hr_job_applications)d" context="{'default_user_id': user_id}" type="action"/>
|
||||
<button string="Documents" name="action_get_attachment_tree_view" type="object"/>
|
||||
</div>
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<div class="oe_button_box" >
|
||||
<button class="oe_stat_button"
|
||||
icon="fa-file-o"
|
||||
name="%(action_hr_job_applications)d"
|
||||
context="{'default_user_id': user_id}"
|
||||
type="action">
|
||||
<field name="application_count" widget="statinfo" string="Applications"/>
|
||||
</button>
|
||||
<button class="oe_stat_button"
|
||||
icon="fa-book"
|
||||
name="action_get_attachment_tree_view"
|
||||
type="object">
|
||||
<field name="documents_count" widget="statinfo" string="Documents"/>
|
||||
</button>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -103,6 +103,18 @@ class hr_timesheet_sheet(osv.osv):
|
||||
for sheet in self.browse(cr, uid, ids, context=context):
|
||||
if sheet.employee_id.id not in employee_ids: employee_ids.append(sheet.employee_id.id)
|
||||
return hr_employee.attendance_action_change(cr, uid, employee_ids, context=context)
|
||||
|
||||
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'timesheet_count': 0, 'attendance_count': 0,}), ids))
|
||||
try:
|
||||
for datas in self.browse(cr, uid, ids, context=context):
|
||||
res[datas.id] = {'appraisal_count': len(datas.appraisal_ids),
|
||||
'timesheet_count': len(datas.timesheet_ids),
|
||||
'attendance_count': len(datas.attendances_ids),
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Note', size=64, select=1,
|
||||
@@ -134,6 +146,8 @@ class hr_timesheet_sheet(osv.osv):
|
||||
'account_ids': fields.one2many('hr_timesheet_sheet.sheet.account', 'sheet_id', 'Analytic accounts', readonly=True),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'department_id':fields.many2one('hr.department','Department'),
|
||||
'timesheet_count': fields.function(_count_all, type='integer', string='Timesheet Activities', multi=True),
|
||||
'attendance_count': fields.function(_count_all, type='integer', string="Attendances", multi=True),
|
||||
}
|
||||
|
||||
def _default_date_from(self, cr, uid, context=None):
|
||||
|
||||
@@ -73,7 +73,10 @@
|
||||
<div class="oe_right oe_button_box" name="buttons">
|
||||
<button type="action"
|
||||
name="%(act_hr_timesheet_sheet_sheet_2_hr_analytic_timesheet)d"
|
||||
string="Timesheet Activities" />
|
||||
class="oe_stat_button"
|
||||
icon="fa-times">
|
||||
<field name="timesheet_count" widget="statinfo" string="Timesheet Activities"/>
|
||||
</button>
|
||||
<button type="action" groups="base.group_hr_attendance"
|
||||
name="%(act_hr_timesheet_sheet_sheet_2_hr_attendance)d"
|
||||
string="Attendances" />
|
||||
@@ -365,7 +368,13 @@
|
||||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_employee_extd_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<button name="%(act_hr_employee_2_hr_timesheet)d" string="Timesheets" type="action" groups="base.group_hr_manager"/>
|
||||
<button name="%(act_hr_employee_2_hr_timesheet)d"
|
||||
type="action"
|
||||
class="oe_stat_button"
|
||||
icon="fa-clock-o"
|
||||
groups="base.group_hr_manager">
|
||||
<field name="timesheet_count" widget="statinfo" string="Timesheets"/>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -85,6 +85,15 @@ translate_selections = {
|
||||
class marketing_campaign(osv.osv):
|
||||
_name = "marketing.campaign"
|
||||
_description = "Marketing Campaign"
|
||||
|
||||
def _count_segments(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = {}
|
||||
try:
|
||||
for segments in self.browse(cr, uid, ids, context=context):
|
||||
res[segments.id] = len(segments.segment_ids)
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True),
|
||||
@@ -121,6 +130,8 @@ Normal - the campaign runs normally and automatically sends all emails and repor
|
||||
'activity_ids': fields.one2many('marketing.campaign.activity',
|
||||
'campaign_id', 'Activities'),
|
||||
'fixed_cost': fields.float('Fixed Cost', help="Fixed cost for running this campaign. You may also specify variable cost and revenue on each campaign activity. Cost and Revenue statistics are included in Campaign Reporting.", digits_compute=dp.get_precision('Product Price')),
|
||||
'segment_ids': fields.one2many('marketing.campaign.segment', 'campaign_id', 'Segments', readonly=False),
|
||||
'segments_count': fields.function(_count_segments, type='integer', string='Segments')
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
||||
@@ -64,12 +64,19 @@
|
||||
<div class="oe_right oe_button_box" name="button_box">
|
||||
<button type="action"
|
||||
name="%(act_marketing_campaing_stat)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-keyboard-o"
|
||||
string="Campaign Statistics"/>
|
||||
<button type="action"
|
||||
name="%(act_marketing_campaing_segment_opened)d"
|
||||
string="Segments"/>
|
||||
class="oe_stat_button"
|
||||
icon="fa-table">
|
||||
<field name="segments_count" widget="statinfo" string="Segments"/>
|
||||
</button>
|
||||
<button type="action"
|
||||
name="%(act_marketing_campaing_followup)d"
|
||||
class="oe_stat_button"
|
||||
icon="fa-thumbs-up"
|
||||
string="Follow-Up"/>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
|
||||
@@ -150,6 +150,17 @@ class purchase_order(osv.osv):
|
||||
limit=1)
|
||||
return res and res[0] or False
|
||||
|
||||
def _count_all(self, cr, uid, ids, field_name, arg, context=None):
|
||||
res = dict(map(lambda x: (x,{'shipment_count': 0, 'invoice_count': 0,}), ids))
|
||||
try:
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
res[data.id] = {'shipment_count': len(data.picking_ids),
|
||||
'invoice_count': len(data.invoice_ids),
|
||||
}
|
||||
except:
|
||||
pass
|
||||
return res
|
||||
|
||||
STATE_SELECTION = [
|
||||
('draft', 'Draft PO'),
|
||||
('sent', 'RFQ Sent'),
|
||||
@@ -226,6 +237,8 @@ class purchase_order(osv.osv):
|
||||
'create_uid': fields.many2one('res.users', 'Responsible'),
|
||||
'company_id': fields.many2one('res.company','Company',required=True,select=1, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal'),
|
||||
'shipment_count': fields.function(_count_all, type='integer', string='Incoming Shipments', multi=True),
|
||||
'invoice_count': fields.function(_count_all, type='integer', string='Invoices', multi=True)
|
||||
}
|
||||
_defaults = {
|
||||
'date_order': fields.date.context_today,
|
||||
|
||||
@@ -47,9 +47,17 @@
|
||||
<div class="oe_right oe_button_box" name="buttons">
|
||||
<button type="object"
|
||||
name="view_picking"
|
||||
string="Incoming Shipments" states="approved"/>
|
||||
class="oe_stat_button"
|
||||
icon="fa-truck"
|
||||
states="approved">
|
||||
<field name="shipment_count" widget="statinfo" string="Incoming Shipments"/>
|
||||
</button>
|
||||
<button type="object" name="invoice_open"
|
||||
string="Invoices" attrs="{'invisible': [('state', 'in', ['draft','sent'])]}"/>
|
||||
class="oe_stat_button"
|
||||
icon="fa-file-o"
|
||||
attrs="{'invisible': [('state', 'in', ['draft','sent'])]}">
|
||||
<field name="invoice_count" widget="statinfo" string="Invoices"/>
|
||||
</button>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -77,7 +77,9 @@
|
||||
</field>
|
||||
<div class="oe_right oe_button_box" style="margin-top: 10px">
|
||||
<button name="%(action_purchase_requisition_partner)d" type="action"
|
||||
string="Request a Quotation" icon="gtk-execute"
|
||||
string="Request a Quotation"
|
||||
class="oe_stat_button"
|
||||
icon="fa-quote-left"
|
||||
attrs="{'invisible': [('line_ids','=',False),('state', 'not in', ('in_progress'))]}"/>
|
||||
</div>
|
||||
<separator string="Quotations"/>
|
||||
|
||||
+24
-11
@@ -240,9 +240,16 @@
|
||||
<field name="active"/>
|
||||
</group>
|
||||
<group groups="stock.group_tracking_lot" string="Traceability">
|
||||
<button name="action_traceability" string="Upstream Traceability" type="object"
|
||||
colspan="2"/>
|
||||
<button name="action_traceability" string="Downstream Traceability" type="object"
|
||||
<button name="action_traceability"
|
||||
string="Upstream Traceability"
|
||||
class="oe_stat_button"
|
||||
icon="fa-arrow-up"
|
||||
type="object" colspan="2"/>
|
||||
<button name="action_traceability"
|
||||
string="Downstream Traceability"
|
||||
class="oe_stat_button"
|
||||
icon="fa-arrow-down"
|
||||
type="object"
|
||||
context="{'type': 'move_history_ids'}" colspan="2"/>
|
||||
</group>
|
||||
</group>
|
||||
@@ -344,8 +351,10 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Serial Number" version="7.0">
|
||||
<div class="oe_button_box oe_right">
|
||||
<button name="action_traceability" string="Upstream Traceability" type="object" context="{'type': 'move_history_ids2', 'field': 'prodlot_id'}"/>
|
||||
<button name="action_traceability" string="Downstream Traceability" type="object" context="{'type': 'move_history_ids', 'field': 'prodlot_id'}"/>
|
||||
<button name="action_traceability" string="Upstream Traceability" class="oe_stat_button"
|
||||
icon="fa-arrow-up" type="object" context="{'type': 'move_history_ids2', 'field': 'prodlot_id'}"/>
|
||||
<button name="action_traceability" string="Downstream Traceability" class="oe_stat_button"
|
||||
icon="fa-arrow-down" type="object" context="{'type': 'move_history_ids', 'field': 'prodlot_id'}"/
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only"/>
|
||||
@@ -1236,14 +1245,16 @@
|
||||
<group name="main_grp" string="Details">
|
||||
<field name="product_id" on_change="onchange_product_id(product_id,location_id,location_dest_id, False)"/>
|
||||
<label for="product_qty"/>
|
||||
<div>
|
||||
<div class="oe_button_box">
|
||||
<field name="product_qty"
|
||||
on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"
|
||||
class="oe_inline"/>
|
||||
<field name="product_uom" groups="product.group_uom" class="oe_inline"/>
|
||||
<button name="%(stock.move_scrap)d"
|
||||
string="Scrap" type="action"
|
||||
icon="terp-gtk-jump-to-ltr" context="{'scrap': True}"
|
||||
class="oe_stat_button"
|
||||
icon="fa-trash-o" context="{'scrap': True}"
|
||||
context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" colspan="1"/>
|
||||
</div>
|
||||
<label for="product_uos_qty" groups="product.group_uos"/>
|
||||
@@ -1277,18 +1288,20 @@
|
||||
<field name="tracking_id" class="oe_inline"/>
|
||||
<button name="%(split_into)d" string="New Pack" type="action"
|
||||
groups="product.group_stock_packaging"
|
||||
icon="terp-accessories-archiver+"
|
||||
class="oe_stat_button "
|
||||
icon="fa-gift"
|
||||
states="draft,assigned,confirmed"/>
|
||||
</div>
|
||||
<label for="prodlot_id" groups="stock.group_production_lot"/>
|
||||
<div groups="stock.group_production_lot">
|
||||
<div groups="stock.group_production_lot" class="oe_button_box">
|
||||
<field name="prodlot_id"
|
||||
context="{'location_id':location_id, 'product_id':product_id}"
|
||||
domain="[('product_id','=?',product_id)]" class="oe_inline"
|
||||
on_change="onchange_lot_id(prodlot_id,product_qty, location_id, product_id, product_uom)"/>
|
||||
<button name="%(track_line)d"
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
string="Split" type="action" icon="gtk-justify-fill"/>
|
||||
states="draft,waiting,confirmed,assigned"
|
||||
class="oe_stat_button"
|
||||
string="Split" type="action" icon="fa-filter"/>
|
||||
</div>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -160,7 +160,12 @@
|
||||
<field name="model">event.event</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@class='oe_right oe_button_box']" position="inside">
|
||||
<button name="%(website_event_track.act_event_list_tracks)d" type="action" string="Tracks"/>
|
||||
<button name="%(website_event_track.act_event_list_tracks)d"
|
||||
type="action"
|
||||
class="oe_stat_button oe_inline"
|
||||
icon="fa-inbox">
|
||||
<field name="count_tracks" widget="statinfo"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='oe_title']" position="inside">
|
||||
<label for="tag_ids" class="oe_edit_only"/>
|
||||
|
||||
Reference in New Issue
Block a user