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+', '+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}) > > To unsubscribe from this bug, go to: > https://bugs.launchpad.net/openobject-addons/+bug/776644/+subscribe