Merge lp:~cv.clearcorp/openobject-addons/6.1-account_voucher-rate into lp:openobject-addons/6.1

Proposed by Carlos Vásquez (ClearCorp)
Status: Needs review
Proposed branch: lp:~cv.clearcorp/openobject-addons/6.1-account_voucher-rate
Merge into: lp:openobject-addons/6.1
Diff against target: 103 lines (+25/-8)
2 files modified
account/test/account_supplier_invoice.yml (+0/-1)
account_voucher/account_voucher.py (+25/-7)
To merge this branch: bzr merge lp:~cv.clearcorp/openobject-addons/6.1-account_voucher-rate
Reviewer Review Type Date Requested Status
Carlos Vásquez (ClearCorp) (community) Needs Resubmitting
OpenERP Core Team Pending
Review via email: mp+101938@code.launchpad.net

Description of the change

This fixes the first part of this but (see it's description)

To post a comment you must log in.
6739. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6740. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6741. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6742. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6743. By Xavier ALT

[MERGE] report_webkit: handle more gracefull remove of 'lib_path' + fix test in l10n_ch

6744. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6745. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6746. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6747. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6748. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6749. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6750. By Quentin (OpenERP) <email address hidden>

[IMP] portal: improved inheritancy when creating a new portal user

6751. By Quentin (OpenERP) <email address hidden>

[REF] l10n_be: added some comments

6752. By Quentin (OpenERP) <email address hidden>

[FIX] portal: moved the prepare_user_data on wizard rather than on the user

6753. By Antony Lesuisse (OpenERP)

[FIX] home action

6754. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6755. By nel

[FIX] stock: check if the move exists to avoid the key error

6756. By nel

[FIX] stock: small important fix

6757. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6758. By nel

[FIX] stock: check if currency on product or picking exists

6759. By Olivier Laurent (Open ERP)

[FIX] l10n_multilang should be certified since it's a dependancy for a certified module (l10n_ch)

6760. By Olivier Laurent (Open ERP)

[FIX] raise clear except_osv instead of traceback

6761. By Olivier Laurent (Open ERP)

[FIX] added missing certificate number

6762. By Olivier Dony (Odoo)

[MERGE] crm: multiple bugfixes for mass-conversion wizards

6763. By Olivier Dony (Odoo)

[MERGE] crm.lead: bugfixes for saleman allocation and convert to opportunity

6764. By Quentin (OpenERP) <email address hidden>

[MERGE] some fixes in constraints in account_coda

6765. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6766. By Xavier ALT

[MERGE] server action: fix missing active_model in context when calling server action run()

6767. By Xavier ALT

[MERGE] project_gtd: fix UnicodeDecodeError on GTD Task search view when user language is different than English

6768. By Xavier ALT

[MERGE] OPW 573248: crm: do not round localized user value as this will display NaN of kanban view (ex: decimal separator <> '.')

6769. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6770. By Xavier ALT

[MERGE] share: fix error on user creation, missing 'company_ids' raising constraint ValidationError

6771. By Xavier ALT

[MERGE] OPW 573134: wiki: fix 'wikijs' support of syntax: h1, h2, h3, img, attach

6772. By Olivier Dony (Odoo)

[FIX] mail.thread: fix SMTP headers when forwarding messages

mail.message.Message has case-insensitive behavior
for headers, but setting the header value *adds* a
new header even if the same header already exists.
This caused multiple issues when forwarding, because
the forwarded mail kept the original To: header.
Also changed the code to use capitalized header
names at all times, just for consistency.
Also removed unused variable ``mail_message``.

6773. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6774. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6775. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6776. By Olivier Dony (Odoo)

[FIX] account,sale,purchase: avoid white text in email notifications due to broken mail clients

Some strange mail client implementations seem to
selectively strip the background-color CSS in emails,
making a white-on-black button become white-on-white
invisible text. Replaced #FFF with #DDD in order
to more gracefully degrade in those cases.
Reproduced with Lotus Notes 8.

6777. By Olivier Dony (Odoo)

[FIX] account,sale,purchase: translations were not enabled for mail notifications

6778. By Xavier ALT

[MERGE] OPW 572907: account: account.financial.report balance should respect report sign

6779. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6780. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6781. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6782. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6783. By Xavier ALT

[FIX] stock: fix partial picking testing on non-existant 'new' stock.move state

6784. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6785. By Antony Lesuisse (OpenERP)

[FIX] point_of_sale typo only load pos enabled products

6786. By Antony Lesuisse (OpenERP)

[MERGE] 6.1-opw-573508-ado point_of_sale multiple rows for categories

6787. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6788. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6789. By nel

[MERGE]

6790. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6791. By Olivier Laurent (Open ERP)

[FIX] reverted __openerp__.py: the commented line was already commented before so it was wrongly uncommented

6792. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6793. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6794. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6795. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6796. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6797. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6798. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

Revision history for this message
Carlos Vásquez (ClearCorp) (cv.clearcorp) wrote :

I fixed the bug second part.

Now the voucher is able to correctly calculate the amount_currency, debit and credit in every currency combination.

I tried with a company set to a currency not base (rate != 1). I created invoices in the company currency, in the base currency and in a third, not base, currency. Then, for each case I registered payments with each of those currencies. Every case worked fine.

review: Needs Resubmitting
6799. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6800. By Olivier Laurent (Open ERP)

[FIX] account: reports: drop view before replacing them

6801. By Olivier Dony (Odoo)

[FIX] document,mail: show only personal attachments by default

6803. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6804. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6805. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6806. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6807. By Olivier Dony (Odoo)

[FIX] decimal_precision: properly invalidate cache when changing precisions

This was working previously because the cache was disabled,
due to bug #988743. Now that the cache is working again,
it needs to be properly invalidated whenever a decimal.precision
record is created or deleted, otherwise all computations
will use an incorrect precision.

6808. By Xavier ALT

[MERGE] crm_partner_assign: test: be more lenient about partner localisation

    As of today, google maps tend to localize:
       Avenue de la Liberté 56, 1000 Brussels, , Belgium
    As:
       Place de la Liberté 56, 1000 Bruxelles, Belgique

    making imprecision and failing geolocalizaton test of
    'crm.crm_case_abcfuelcounits0' (current modification is backported from
    trunk unit-test)

6809. By Xavier ALT

[MERGE] OPW 575004: stock: fix font for product name/variant in packaging report

6810. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6811. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6812. By Xavier ALT

[MERGE] OPW 574991: rml reports: move setLang() before <pto_header/> otherwise it won't be correctly translated

6813. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6814. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6815. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6816. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6817. By Xavier ALT

[MERGE] OPW 574652: hr_expense: add correct decimal precision on 'amount' field

6818. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6819. By Olivier Dony (Odoo)

[FIX] stock: Warehouse Manager should have all rights on stock.move

6820. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6821. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6822. By Olivier Dony (Odoo)

[FIX] crm: missing index on user_id, which is used by ir.rules

6823. By Olivier Dony (Odoo)

[MERGE] OPW 575424: mrp: error on analytic entries when workcenter has no product

6824. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6825. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6826. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6827. By Olivier Dony (Odoo)

[MERGE] OPW 575437: account_payment: missing voucher entries when importing payment orders into bank statement

6828. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6829. By Olivier Dony (Odoo)

[FIX] edi: fix Invoice preview template, uos_id field not required so may be missing

6830. By Quentin (OpenERP) <email address hidden>

[REF] account_coda: stripped dummy spaces at end of lines

6831. By Quentin (OpenERP) <email address hidden>

[FIX] account_coda: fixed coda import to work with iban bank accounts

6832. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6833. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6834. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6835. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6836. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6837. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6838. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6839. By Olivier Dony (Odoo)

[MERGE] OPW 575526: fix returning product with upstream stock moves + multiple returns

6840. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6841. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6842. By Fabien Meghazi (OpenERP)

[REM] Removed <image> tags from wizards

6843. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6844. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6845. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6846. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6847. By Olivier Dony (Odoo)

[MERGE] OPW 575624: product,account_payment: respect current symbol position in reports

6848. By Olivier Dony (Odoo)

[FIX] stock: properly pass production lot number as SQL query parameter

6849. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6850. By Olivier Dony (Odoo)

[FIX] stock: correct order of query parameters, broken in commit 6848

6851. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6852. By Olivier Dony (Odoo)

[MERGE] OPW 575500: correct importing invoices in bank statements in multi-currency context

6853. By Olivier Dony (Odoo)

[MERGE] l10n_ch: bugfixes from Camptocamp, courtesy of Yannick Vaucher

6854. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6855. By Christophe Simonis (OpenERP)

[FIX] base_vat: correct Switzerland VAT check

6856. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6857. By Olivier Dony (Odoo)

[MERGE] mail: avoid obscure failure when processing batches of emails with attachments

  This issue was caused by the way browse_records are cached,
  in combination with the deletion of messages just after sending
  them. When processing a second message, the attachment.datas
  function fields gets computed for all messages that are being
  browsed, including the first message that was already deleted,
  causing an exception. The value of the function field had
  already been computed for the first message, but had been
  discarded by the message.refresh() call.
  Hopefully this kind of issue will disappear once we implement
  the new ORM API.

6858. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6859. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6860. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6861. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6862. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

6863. By Carlos Vásquez (ClearCorp)

[MRG] merge from first feature branch, used to continue with an updated addons 6.1 branch

6864. By Carlos Vásquez (ClearCorp)

[FIX] supplier payment with company currency not in rate = 1, with invoice and payment in foreign currency calculated a wrong change move line

Revision history for this message
Carlos Vásquez (ClearCorp) (cv.clearcorp) wrote :

I just re-uploaded the branch with the latest upstream revisions and with some other fixes to support payments (supplier payment) with company's currency with a rate not set to 1.

Unmerged revisions

6864. By Carlos Vásquez (ClearCorp)

[FIX] supplier payment with company currency not in rate = 1, with invoice and payment in foreign currency calculated a wrong change move line

6863. By Carlos Vásquez (ClearCorp)

[MRG] merge from first feature branch, used to continue with an updated addons 6.1 branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/test/account_supplier_invoice.yml'
2--- account/test/account_supplier_invoice.yml 2011-12-19 16:54:40 +0000
3+++ account/test/account_supplier_invoice.yml 2012-06-30 19:56:18 +0000
4@@ -27,7 +27,6 @@
5 address_invoice_id: base.res_partner_address_3000
6 check_total: 3000.0
7 company_id: base.main_company
8- currency_id: base.EUR
9 invoice_line:
10 - account_id: account.a_expense
11 name: '[PC1] Basic PC'
12
13=== modified file 'account_voucher/account_voucher.py'
14--- account_voucher/account_voucher.py 2012-03-30 11:07:16 +0000
15+++ account_voucher/account_voucher.py 2012-06-30 19:56:18 +0000
16@@ -231,14 +231,14 @@
17 for voucher in self.browse(cr, uid, ids, context=context):
18 if voucher.currency_id:
19 if voucher.company_id.currency_id.id == voucher.payment_rate_currency_id.id:
20- rate = 1 / voucher.payment_rate
21+ rate = voucher.payment_rate
22 else:
23 ctx = context.copy()
24 ctx.update({'date': voucher.date})
25 voucher_rate = self.browse(cr, uid, voucher.id, context=ctx).currency_id.rate
26 company_currency_rate = voucher.company_id.currency_id.rate
27- rate = voucher_rate * company_currency_rate
28- res[voucher.id] = voucher.amount / rate
29+ rate = company_currency_rate / voucher_rate
30+ res[voucher.id] = voucher.amount * rate
31 return res
32
33 _name = 'account.voucher'
34@@ -758,6 +758,10 @@
35 return vals
36
37 def proforma_voucher(self, cr, uid, ids, context=None):
38+ '''
39+ This method is executed by the workflow when the voucher is validated.
40+
41+ '''
42 self.action_move_line_create(cr, uid, ids, context=context)
43 return True
44
45@@ -1020,7 +1024,10 @@
46 # if the amount encoded in voucher is equal to the amount unreconciled, we need to compute the
47 # currency rate difference
48 if line.amount == line.amount_unreconciled:
49- currency_rate_difference = line.move_line_id.amount_residual - amount
50+ if voucher_brw.type == 'payment':
51+ currency_rate_difference = amount - line.move_line_id.amount_residual
52+ else:
53+ currency_rate_difference = line.move_line_id.amount_residual - amount
54 else:
55 currency_rate_difference = 0.0
56 move_line = {
57@@ -1076,12 +1083,18 @@
58 elif line.move_line_id.currency_id.id == voucher_brw.payment_rate_currency_id.id:
59 # if the rate is specified on the voucher, we must use it
60 voucher_rate = currency_obj.browse(cr, uid, voucher_currency, context=ctx).rate
61- amount_currency = (move_line['debit'] - move_line['credit']) * voucher_brw.payment_rate * voucher_rate
62+ amount_currency = currency_obj.compute(cr, uid, voucher_brw.company_id.currency_id.id, voucher_brw.currency_id.id, (move_line['debit'] - move_line['credit']), context=context)
63+ amount_currency = amount_currency * voucher_brw.payment_rate
64 else:
65 # otherwise we use the rates of the system (giving the voucher date in the context)
66 amount_currency = currency_obj.compute(cr, uid, company_currency, line.move_line_id.currency_id.id, move_line['debit']-move_line['credit'], context=ctx)
67 if line.amount == line.amount_unreconciled and line.move_line_id.currency_id.id == voucher_currency:
68- foreign_currency_diff = line.move_line_id.amount_residual_currency + amount_currency
69+ # The move_line_id.amount_residual_currency is positive if receivable and debit, or payable and credit
70+ # The amount_currency is positive if debit (for the new line to create)
71+ if line.move_line_id.account_id and line.move_line_id.account_id.type == 'payable':
72+ foreign_currency_diff = line.move_line_id.amount_residual_currency - amount_currency
73+ else:
74+ foreign_currency_diff = line.move_line_id.amount_residual_currency + amount_currency
75
76 move_line['amount_currency'] = amount_currency
77 voucher_line = move_line_obj.create(cr, uid, move_line)
78@@ -1186,19 +1199,24 @@
79
80 def action_move_line_create(self, cr, uid, ids, context=None):
81 '''
82- Confirm the vouchers given in ids and create the journal entries for each of them
83+ Confirm the vouchers given in ids and create the journal entries for each of them.
84+ The method proforma_voucher() just calls this one.
85+
86 '''
87+
88 if context is None:
89 context = {}
90 move_pool = self.pool.get('account.move')
91 move_line_pool = self.pool.get('account.move.line')
92 for voucher in self.browse(cr, uid, ids, context=context):
93 if voucher.move_id:
94+ # Skip if voucher already has a move, usually indicates that it is posted
95 continue
96 company_currency = self._get_company_currency(cr, uid, voucher.id, context)
97 current_currency = self._get_current_currency(cr, uid, voucher.id, context)
98 # we select the context to use accordingly if it's a multicurrency case or not
99 context = self._sel_context(cr, uid, voucher.id, context)
100+ # TODO: ctx and context seem to be the same, a double check is needed
101 # But for the operations made by _convert_amount, we always need to give the date in the context
102 ctx = context.copy()
103 ctx.update({'date': voucher.date})