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