[V5]Invoiced Repair Orders

Bug #776644 reported by luis tobar
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP Publisher's Warranty Team

Bug Description

When try to invoice a lot of repair orders the module fails. i did a bit little test and repair the fail changed the object name invoice.obj by inv.obj in the code. ( part code atached)

Regards
Luis

class mrp_repair_fee(osv.osv, ProductChangeMixin):
    _name = 'mrp.repair.fee'
    _description = 'Repair Fees line'
    def copy_data(self, cr, uid, id, default=None, context=None):
        if not default: default = {}
        default.update( {'invoice_line_id':False,'invoiced':False})
        return super(mrp_repair_fee, self).copy_data(cr, uid, id, default, context)
    def _amount_line(self, cr, uid, ids, field_name, arg, context):
        res = {}
        cur_obj=self.pool.get('res.currency')
        for line in self.browse(cr, uid, ids):
            res[line.id] = line.to_invoice and line.price_unit * line.product_uom_qty or 0
            cur = line.repair_id.pricelist_id.currency_id
            res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
        return res

    _columns = {
        'repair_id': fields.many2one('mrp.repair', 'Repair Order Ref', required=True, ondelete='cascade', select=True),
        'name': fields.char('Description', size=64, select=True,required=True),
        'product_id': fields.many2one('product.product', 'Product'),
        'product_uom_qty': fields.float('Quantity', digits=(16,2), required=True),
        'price_unit': fields.float('Unit Price', required=True),
        'product_uom': fields.many2one('product.uom', 'Product UoM', required=True),
        'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal',digits=(16, int(config['price_accuracy']))),
        'tax_id': fields.many2many('account.tax', 'repair_fee_line_tax', 'repair_fee_line_id', 'tax_id', 'Taxes'),
        'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', readonly=True),
        'to_invoice': fields.boolean('To Invoice'),
        'invoiced': fields.boolean('Invoiced',readonly=True),
    }
                    invoice=invoice_obj.browse(cr, uid,inv_id) -----------> inv.obj
                    invoice_vals = {
                        'name': invoice.name +', '+repair.name,
                        'origin': invoice.origin+', '+repair.name,
                        'comment':(comment and (invoice.comment and invoice.comment+"\n"+comment or comment)) or (invoice.comment and invoice.comment or ''),
                    }
                    invoice_obj.write(cr, uid, [inv_id],invoice_vals,context=context) --------> inv.obj.
                else:
                    if not repair.partner_id.property_account_receivable:
                        raise osv.except_osv(_('Error !'), _('No account defined for partner "%s".') % repair.partner_id.name )
                    account_id = repair.partner_id.property_account_receivable.id
                    inv = {
                        'name': repair.name,
                        'origin':repair.name,
                        'type': 'out_invoice',
                        'account_id': account_id,
                        'partner_id': repair.partner_id.id,
                        'address_invoice_id': repair.address_id.id,
                        'currency_id': repair.pricelist_id.currency_id.id,
                        'comment': repair.quotation_notes,
                        'fiscal_position': repair.partner_id.property_account_position.id
                    }
                    inv_obj = self.pool.get('account.invoice')
                    inv_id = inv_obj.create(cr, uid, inv)
                    invoices_group[repair.partner_invoice_id.id] = inv_id
                self.write(cr, uid, repair.id , {'invoiced':True,'invoice_id' : inv_id})

Related branches

affects: account-banking → openobject-addons
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Luis,

I have tested your scenario at my end but all are working as expected and I am not able to faced the module are fails.
So would you please provide more information or proper steps to reproduce it.

Thanks and waiting for your reply!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
luis tobar (ltobar) wrote : Re: [Bug 776644] Re: Invoiced Repai Orders
Download full text (4.8 KiB)

Hi Amit,

In V6.02 that is work correctly, but in V5.15 & V5.16 don't work and
code have the mistake in object name (invoice_obj)
mentioned in bug report.

Regards,

Luis

El 16-05-2011, a las 7:41, Amit Parik (OpenERP) escribió:

> Hello Luis,
>
> I have tested your scenario at my end but all are working as
> expected and I am not able to faced the module are fails.
> So would you please provide more information or proper steps to
> reproduce it.
>
> Thanks and waiting for your reply!
>
> ** Changed in: openobject-addons
> Status: New => Incomplete
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/776644
>
> Title:
> Invoiced Repai Orders
>
> Status in OpenERP Modules (addons):
> Incomplete
>
> Bug description:
> When try to invoice a lot of repair orders the module fails. i did
> a bit little test and repair the fail changed the object name
> invoice.obj by inv.obj in the code. ( part code atached)
>
> Regards
> Luis
>
>
>
> class mrp_repair_fee(osv.osv, ProductChangeMixin):
> _name = 'mrp.repair.fee'
> _description = 'Repair Fees line'
> def copy_data(self, cr, uid, id, default=None, context=None):
> if not default: default = {}
> default.update( {'invoice_line_id':False,'invoiced':False})
> return super(mrp_repair_fee, self).copy_data(cr, uid, id,
> default, context)
> def _amount_line(self, cr, uid, ids, field_name, arg, context):
> res = {}
> cur_obj=self.pool.get('res.currency')
> for line in self.browse(cr, uid, ids):
> res[line.id] = line.to_invoice and line.price_unit *
> line.product_uom_qty or 0
> cur = line.repair_id.pricelist_id.currency_id
> res[line.id] = cur_obj.round(cr, uid, cur, res[line.id])
> return res
>
> _columns = {
> 'repair_id': fields.many2one('mrp.repair', 'Repair Order
> Ref', required=True, ondelete='cascade', select=True),
> 'name': fields.char('Description', size=64,
> select=True,required=True),
> 'product_id': fields.many2one('product.product', 'Product'),
> 'product_uom_qty': fields.float('Quantity', digits=(16,2),
> required=True),
> 'price_unit': fields.float('Unit Price', required=True),
> 'product_uom': fields.many2one('product.uom', 'Product
> UoM', required=True),
> 'price_subtotal': fields.function(_amount_line,
> method=True, string='Subtotal',digits=(16,
> int(config['price_accuracy']))),
> 'tax_id': fields.many2many('account.tax',
> 'repair_fee_line_tax', 'repair_fee_line_id', 'tax_id', 'Taxes'),
> 'invoice_line_id': fields.many2one('account.invoice.line',
> 'Invoice Line', readonly=True),
> 'to_invoice': fields.boolean('To Invoice'),
> 'invoiced': fields.boolean('Invoiced',readonly=True),
> }
> invoice=invoice_obj.browse(cr, uid,inv_id)
> -----------> inv.obj
> invoice_vals = {
> 'name': invoice.name +', '+repair.name,
> 'origin': invoice.origin+', '+r...

Read more...

Revision history for this message
Amit Parik (amit-parik) wrote : Re: Invoiced Repai Orders

Hello Luis,

Thanks for your quick reply!

I have tested your issue in v5.0.16 also but it is also working fine.
I think you have miss something if you have not "True" the "To invoice" boolean field in operations line then it will not create the invoice line.

I have attached video for your reference with v5.0.16 so would you please check it and notify me where you faced the problem.

Thanks and waiting for your reply!

Revision history for this message
Amit Parik (amit-parik) wrote :
Revision history for this message
luis tobar (ltobar) wrote :

Hi Amit,

For one to one repair - invoice work well. But when you have over 1 repair order to invoice ,in one invoice for a same partner, the module fail, because the object invoice_obj don´t exist .....by the way, the "inv_obj" objetc is in the module. I had the change invoice_obj by inv_obj and module run ok.

Then to invoice a lot of repair orders for a same partner don´t work, also i am using web client.

Regards
Luis

PD. Nice video software, where i can obtain it ? Thanks.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Luis,

Thanks for your quick reply!

You are right the invoice_obj in not defined in action_invoice_create it should be change to "inv_obj" and define inv_obj = self.pool.get('account.invoice') before the if condition and it is already improved in v6.

So I am confirming this issue for the v5.

Thanks for the reporting!

summary: - Invoiced Repai Orders
+ []Invoiced Repai Orders
summary: - []Invoiced Repai Orders
+ [V5]Invoiced Repai Orders
Changed in openobject-addons:
assignee: nobody → OpenERP Publisher's Warranty Team (openerp-opw)
importance: Undecided → Medium
status: Incomplete → Confirmed
Amit Parik (amit-parik)
summary: - [V5]Invoiced Repai Orders
+ [V5]Invoiced Repair Orders
Revision history for this message
Valencia Rodrigues (OpenERP) (vro-openerp) wrote :

Hello Luis,

Thanks for reporting the issue.

This has been fixed in lp:~openerp-dev/openobject-addons/5.0-bug-776644-vro by revision 2911 <email address hidden>. It will be merged in stable 5.0 soon.

Thanks

Changed in openobject-addons:
status: Confirmed → Fix Committed
Changed in openobject-addons:
importance: Medium → Low
Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.