[#6574] Associate LaborBudgets with TimeEntryActivities
This commit is contained in:
@@ -103,7 +103,8 @@ module RedmineContracts
|
||||
if old_deliverable['total_hours'].present? || old_deliverable['cost_per_hour'].present?
|
||||
deliverable.labor_budgets << LaborBudget.new(:deliverable => deliverable,
|
||||
:budget => @total_cost,
|
||||
:hours => old_deliverable['total_hours'])
|
||||
:hours => old_deliverable['total_hours'],
|
||||
:time_entry_activity => first_billable_activity(project))
|
||||
end
|
||||
else
|
||||
@total_cost = 0
|
||||
@@ -228,5 +229,9 @@ module RedmineContracts
|
||||
def self.append_old_deliverable_to_notes(old_deliverable, new_deliverable)
|
||||
new_deliverable.notes += "Converted data:\n<pre>" + old_deliverable.pretty_inspect + "</pre>"
|
||||
end
|
||||
|
||||
def self.first_billable_activity(project)
|
||||
project.billable_activities.first || TimeEntryActivity.first
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,11 @@ module RedmineContracts
|
||||
end
|
||||
|
||||
module InstanceMethods
|
||||
def billable_activities
|
||||
activities.partition do |activity|
|
||||
activity.billable?
|
||||
end.first
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user