Odoo Help


[8.0]Generating INVOICE from REPAIR ORDER - FLEET ID

Mohammed Kamar-eddine
on 6/23/16, 11:47 AM 517 views

Creating INVOICE from REPAIR ORDER - the vehicle (fleet_id) doesnt get transferred to the final INVOICE. What lines could i include to the .py file under 'action_nvoice_create' to allow the vehicule in the repair order to be transferred to the INVOICE

<button name="action_invoice_create" position="replace">

<button name="action_invoice_create" states="2binvoiced" string="Create Invoice" class="oe_highlight" attrs="{'invisible':[('invoiced','=',True)]}" groups="garage.group_garage_manager" />


.PY file of MRP_REPAIR


def action_invoice_create(self, cr, uid, ids, group=False, context=None):

print "action_invoice_create---------------",ids, group, context

repair = self.browse(cr, uid, ids[0])

res = super(mrp_repair, self).action_invoice_create(cr, uid, ids,



inv_line_obj = self.pool.get('account.invoice.line')

inv_obj = self.pool.get('account.invoice')

for repair_id, invoice_id in res.iteritems():

if not invoice_id:


# invoice = inv_obj.browse(cr, uid, invoice_id)

for rsol in repair.order_line_ids:

name = rsol.name or ''

if rsol.product_id.property_account_income:

account_id = rsol.product_id.property_account_income.id

elif rsol.product_id.categ_id.property_account_income_categ:

account_id = rsol.product_id.categ_id.property_account_income_categ.id


raise osv.except_osv(_('Error!'), _('No account defined for product "%s".') % rsol.product_id.name)

invoice_line_vals = {

'invoice_id': invoice_id,

'name': rsol.product_id.name,

'origin': rsol.repair_sale_order_line_id.name,

'account_id': account_id,

#'quantity': rsol.product_uom_qty,

'invoice_line_tax_id': [(6, 0, [x.id for x in rsol.tax_id])],

'uos_id': rsol.product_id.uom_id.id,

'price_unit': rsol.price_unit,

'price_subtotal': rsol.product_uom_qty * rsol.price_unit,

'product_id': rsol.product_id and rsol.product_id.id or False


print "invoice_line_vals----------",invoice_line_vals

invoice_line_id = inv_line_obj.create(cr, uid, invoice_line_vals)

print "after line create----------------------------",invoice_line_id


button_reset_taxes(cr, uid, invoice_id, context=context)

return res

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/23/16, 11:47 AM
Seen: 517 times
Last updated: 6/23/16, 12:32 PM