[FIX]GOLEM Resource Account : better to use default name for invoice and use reservation name as origin

This commit is contained in:
Fabien BOURGEOIS 2018-03-26 11:22:36 +02:00
parent ba7ab02084
commit 476c1b25b8

View File

@ -50,25 +50,23 @@ class GolemResourceReservation(models.Model):
if not account_id:
raise ValidationError(
_('There is no income account defined for this product: "%s". \
You may have to install a chart of account from Accounting \
app, settings menu.') % (product.name,))
_('There is no income account defined for this product: "{}"'
'. You have to configure it on the product form.'.format(product.name)))
reservation.invoice_id = inv_obj.create({
'name': reservation.name,
#'origin': self.application_number,
'origin': reservation.name,
'type': 'out_invoice',
'reference': False,
'account_id': partner_id.property_account_receivable_id.id,
'partner_id': partner_id.id,
'invoice_line_ids': [(0, 0, {
'name': reservation.resource_id.name,
#'origin': ,
'origin': reservation.name,
'account_id': account_id,
'price_unit': amount,
'quantity': 1.0,
'discount': 0.0,
'uom_id': product.uom_id.id,
'product_id': product.id,
})],
})]
})