From 61ba9cbd10d7c16655f89421843a08c33b43e4c8 Mon Sep 17 00:00:00 2001 From: Amit Dodiya Date: Thu, 21 Mar 2013 10:57:24 +0530 Subject: [PATCH 1/2] [FIX] account_invoice: due date is reset to current date when we have no payment term and due date is manually defined bzr revid: ado@tinyerp.com-20130321052724-ck8ly3e5leo6cd2a --- addons/account/account_invoice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index b4705245268..d68f9786e21 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -539,10 +539,13 @@ class account_invoice(osv.osv): def onchange_payment_term_date_invoice(self, cr, uid, ids, payment_term_id, date_invoice): res = {} + inv_record = self.browse(cr, uid, ids) if not date_invoice: date_invoice = time.strftime('%Y-%m-%d') - if not payment_term_id: - return {'value':{'date_due': date_invoice}} #To make sure the invoice has a due date when no payment term + if not payment_term_id and inv_record.date_due: + return {'value':{'date_due': inv_record.date_due}} #To make sure the invoice due date should contain due date which is entered by user when there is no payment term defined + if not payment_term_id and not inv_record.date_due: + return {'value':{'date_due': date_invoice}} #To make sure that the invoice due date contain current date when there is no payment term and no due date defined pterm_list = self.pool.get('account.payment.term').compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice) if pterm_list: pterm_list = [line[0] for line in pterm_list] From 5e9679a2e1647e5638f1605697d52e04b6c9d09b Mon Sep 17 00:00:00 2001 From: Amit Dodiya Date: Mon, 13 May 2013 16:10:53 +0530 Subject: [PATCH 2/2] [FIX]sale_line_to_invoice: while creating invoice from sale order line the tax is not added on invoice bzr revid: ado@tinyerp.com-20130513104053-46zb10ajjr5ev1ar --- addons/sale/wizard/sale_line_invoice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py index e6121b23dd8..ed072c40663 100644 --- a/addons/sale/wizard/sale_line_invoice.py +++ b/addons/sale/wizard/sale_line_invoice.py @@ -55,6 +55,7 @@ class sale_order_line_make_invoice(osv.osv_memory): @return: """ + inv_obj = self.pool.get('account.invoice') a = order.partner_id.property_account_receivable.id if order.partner_id and order.partner_id.property_payment_term.id: pay_term = order.partner_id.property_payment_term.id @@ -76,7 +77,8 @@ class sale_order_line_make_invoice(osv.osv_memory): 'company_id': order.company_id and order.company_id.id or False, 'date_invoice': fields.date.today(), } - inv_id = self.pool.get('account.invoice').create(cr, uid, inv) + inv_id = inv_obj.create(cr, uid, inv) + inv_obj.button_reset_taxes(cr, uid, [inv_id], context=context) return inv_id sales_order_line_obj = self.pool.get('sale.order.line')