|
@@ -47,9 +47,11 @@ class ProjectServiceTask(models.Model):
|
|
|
def onchange_name(self):
|
|
|
self.partner_id = self.project_id.partner_id.id
|
|
|
|
|
|
+
|
|
|
@api.multi
|
|
|
def cancel(self):
|
|
|
self.state = 'Cancelado'
|
|
|
+ self.stage_id = 4
|
|
|
|
|
|
@api.depends('activity_ids.work_cost', 'materials_used.price')
|
|
|
def get_amount_total(self):
|
|
@@ -81,6 +83,7 @@ class ProjectServiceTask(models.Model):
|
|
|
if self.invoice_count > 0:
|
|
|
raise Warning('Esta tarea tiene una factura asociada')
|
|
|
if self.invoice_count == 0:
|
|
|
+ self.stage_id = 1
|
|
|
for work in self:
|
|
|
work.write({'state': 'Preparado'})
|
|
|
return True
|
|
@@ -114,7 +117,7 @@ class ProjectServiceTask(models.Model):
|
|
|
'account_id': customer.property_account_receivable.id,
|
|
|
'partner_id': customer.id,
|
|
|
'origin': self.name,
|
|
|
- 'task_invoice_id': self.id
|
|
|
+ 'task_invoice_id': self.id,
|
|
|
}
|
|
|
inv_id = inv_obj.create(inv_data)
|
|
|
for records in self.activity_ids:
|
|
@@ -126,7 +129,6 @@ class ProjectServiceTask(models.Model):
|
|
|
if records.completed == False:
|
|
|
raise osv.except_osv(_('UserError!'), _('Esta actividad aun no ha sido concluida '
|
|
|
'"%s".') % (records.product_id.name,))
|
|
|
-
|
|
|
inv_line_data = {
|
|
|
'name': records.product_id.name,
|
|
|
'account_id': income_account,
|
|
@@ -175,9 +177,11 @@ class ProjectServiceTask(models.Model):
|
|
|
result = {'type': 'ir.actions.act_window_close'}
|
|
|
invoiced_records = self.env['project.service.task']
|
|
|
total = 0
|
|
|
+ self.stage_id = 3
|
|
|
for rows in invoiced_records:
|
|
|
invoiced_date = rows.date
|
|
|
invoiced_date = invoiced_date[0:10]
|
|
|
if invoiced_date == str(date.today()):
|
|
|
total = total + rows.price_subtotal
|
|
|
+ inv_id.signal_workflow('invoice_open')
|
|
|
return result
|