X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=addons%2Fhr_timesheet_invoice%2Fhr_timesheet_invoice.py;fp=addons%2Fhr_timesheet_invoice%2Fhr_timesheet_invoice.py;h=ec8c89dbe6454dc5d712694df27d993a6e11e2f9;hb=cbe2dbb672a6c55d86f2e515f9d1cdfee426ef80;hp=a3d96b1cebac0485490c85ea29a2f1c476a41908;hpb=d78192c489d3be66cd6487b39f5ce7ba4733a187;p=odoo%2Fodoo.git diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index a3d96b1..ec8c89d 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -99,7 +99,7 @@ class account_analytic_account(osv.osv): class account_analytic_line(osv.osv): _inherit = 'account.analytic.line' _columns = { - 'invoice_id': fields.many2one('account.invoice', 'Invoice', ondelete="set null"), + 'invoice_id': fields.many2one('account.invoice', 'Invoice', ondelete="set null", copy=False), 'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Invoiceable', help="It allows to set the discount while making invoice, keep empty if the activities should not be invoiced."), } @@ -141,14 +141,6 @@ class account_analytic_line(osv.osv): _('You cannot modify an invoiced analytic line!')) return True - def copy(self, cursor, user, obj_id, default=None, context=None): - if default is None: - default = {} - default = default.copy() - default.update({'invoice_id': False}) - return super(account_analytic_line, self).copy(cursor, user, obj_id, - default, context=context) - def _get_invoice_price(self, cr, uid, account, product_id, user_id, qty, context = {}): pro_price_obj = self.pool.get('product.pricelist') if account.pricelist_id: @@ -291,6 +283,7 @@ class account_analytic_line(osv.osv): curr_line['name'] += "\n" + ("\n".join(map(lambda x: unicode(x) or '',note))) invoice_line_obj.create(cr, uid, curr_line, context=context) cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id IN %s", (last_invoice, account.id, tuple(ids))) + self.invalidate_cache(cr, uid, ['invoice_id'], ids, context=context) invoice_obj.button_reset_taxes(cr, uid, [last_invoice], context) return invoices @@ -314,23 +307,13 @@ class hr_analytic_timesheet(osv.osv): } return res - def copy(self, cursor, user, obj_id, default=None, context=None): - if default is None: - default = {} - default = default.copy() - default.update({'invoice_id': False}) - return super(hr_analytic_timesheet, self).copy(cursor, user, obj_id, - default, context=context) - - - class account_invoice(osv.osv): _inherit = "account.invoice" - def _get_analytic_lines(self, cr, uid, id, context=None): - iml = super(account_invoice, self)._get_analytic_lines(cr, uid, id, context=context) + def _get_analytic_lines(self, cr, uid, ids, context=None): + iml = super(account_invoice, self)._get_analytic_lines(cr, uid, ids, context=context) - inv = self.browse(cr, uid, [id], context=context)[0] + inv = self.browse(cr, uid, ids, context=context)[0] if inv.type == 'in_invoice': obj_analytic_account = self.pool.get('account.analytic.account') for il in iml: