diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 16e3cc656cd..dcbaf683674 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -141,22 +141,23 @@ 2 - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -200,10 +201,12 @@ - - - - + + + + + + @@ -247,23 +250,23 @@ form - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -290,12 +293,14 @@ - - - - - - + + + + + + + + @@ -478,7 +483,7 @@ - + @@ -495,6 +500,6 @@ - + diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py index eee754435cd..d027559cdce 100644 --- a/addons/account/wizard/account_change_currency.py +++ b/addons/account/wizard/account_change_currency.py @@ -48,27 +48,24 @@ class account_change_currency(osv.osv_memory): data = self.read(cr, uid, ids)[0] new_currency = data['currency_id'] - for invoice in obj_inv.browse(cr, uid, context['active_ids'], context=context): - if invoice.currency_id.id == new_currency: - continue + invoice = obj_inv.browse(cr, uid, context['active_id'], context=context) + if invoice.currency_id.id == new_currency: + return {} + rate = obj_currency.browse(cr, uid, new_currency).rate + for line in invoice.invoice_line: + new_price = 0 + if invoice.company_id.currency_id.id == invoice.currency_id.id: + new_price = line.price_unit * rate - for line in invoice.invoice_line: - rate = obj_currency.browse(cr, uid, new_currency).rate - new_price = 0 - if invoice.company_id.currency_id.id == invoice.currency_id.id: - new_price = line.price_unit * rate + if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id == new_currency: + old_rate = invoice.currency_id.rate + new_price = line.price_unit / old_rate - if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id == new_currency: - old_rate = invoice.currency_id.rate - new_price = line.price_unit / old_rate - - if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id != new_currency: - old_rate = invoice.currency_id.rate - new_price = (line.price_unit / old_rate ) * rate - - obj_inv_line.write(cr, uid, [line.id], {'price_unit' : new_price}) - invoice_ids.append(invoice.id) - obj_inv.write(cr, uid, invoice_ids, {'currency_id' : new_currency}, context=context) + if invoice.company_id.currency_id.id != invoice.currency_id.id and invoice.company_id.currency_id.id != new_currency: + old_rate = invoice.currency_id.rate + new_price = (line.price_unit / old_rate ) * rate + obj_inv_line.write(cr, uid, [line.id], {'price_unit' : new_price}) + obj_inv.write(cr, uid, [invoice.id], {'currency_id' : new_currency}, context=context) return {} account_change_currency() diff --git a/addons/account/wizard/account_change_currency_view.xml b/addons/account/wizard/account_change_currency_view.xml index 33b351bb85c..4a246f4034f 100644 --- a/addons/account/wizard/account_change_currency_view.xml +++ b/addons/account/wizard/account_change_currency_view.xml @@ -8,6 +8,7 @@ form + @@ -29,7 +30,7 @@ new - + \ No newline at end of file diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index f7e9d79b27a..d14f2c68e3a 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -46,6 +46,7 @@ class account_invoice_refund(osv.osv_memory): account_m_line_obj = self.pool.get('account.move.line') mod_obj = self.pool.get('ir.model.data') act_obj = self.pool.get('ir.actions.act_window') + wf_service = netsvc.LocalService('workflow') if context is None: context = {} @@ -111,7 +112,6 @@ class account_invoice_refund(osv.osv_memory): to_reconcile_ids[line.account_id.id] = [line.id] if type(line.reconcile_id) != osv.orm.browse_null : reconcile_obj.unlink(cr, uid, line.reconcile_id.id) - wf_service = netsvc.LocalService('workflow') wf_service.trg_validate(uid, 'account.invoice', \ refund.id, 'invoice_open', cr) refund = inv_obj.browse(cr, uid, refund_id[0],context=context) diff --git a/addons/account/wizard/account_invoice_refund_view.xml b/addons/account/wizard/account_invoice_refund_view.xml index 7962bb150cf..5e84847577d 100644 --- a/addons/account/wizard/account_invoice_refund_view.xml +++ b/addons/account/wizard/account_invoice_refund_view.xml @@ -8,6 +8,7 @@ form + @@ -15,7 +16,7 @@ - + @@ -36,10 +37,10 @@ new - + view_mode="form" target="new" view_type="form" /> --> \ No newline at end of file diff --git a/addons/account/wizard/account_pay_invoice_view.xml b/addons/account/wizard/account_pay_invoice_view.xml index 0a8e64d299f..aebdce1434c 100644 --- a/addons/account/wizard/account_pay_invoice_view.xml +++ b/addons/account/wizard/account_pay_invoice_view.xml @@ -25,14 +25,25 @@ + + Pay Invoice + ir.actions.act_window + account.invoice.pay + form + form + + {'record_id' : active_id} + new + - + id="action_view_account_invoice_pay"/> --> account.invoice.pay.writeoff.form