This repository was archived by the owner on Mar 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
10.0 17012018 #95
Open
iledarn
wants to merge
18
commits into
itpp-labs:10.0
Choose a base branch
from
iledarn:10.0-17012018
base: 10.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
10.0 17012018 #95
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b3fec20
[ADD] telegram_expense_manager: currency_id in expenses account.move.…
c5c51f6
[FIX] telegram_expense_manager: typo
c6e537c
[ADD] telegram_expense_manager: multicurrency expenses
7ada112
[ADD] telegram_expense_manager: multicurrency /income
18e08e6
[ADD] telegram_expense_manager: multicurrency in total row for /accou…
9feee23
[ADD] telegram_expense_manager: multicurrency /account_all report
a7b4567
[ADD] telegram_expense_manager: res.currency.alias
47c113d
[ADD] telegram_expense_manager: use currency aliases to get an expens…
ed9bec1
[FIX] telegram_expense_manager: base_currency might not have rate 1
050d398
[ADD] telegram_expense_manager: add em_currency_id on partner's form
4ac68c0
[ADD] telegram_expense_manager: allow multicurrency by default
87b2c0a
[FIX] telegram_expense_manager: search currency by name first, if fai…
ca01be3
[FIX] telegram_expense_manager: fix multicurrency /account_all report
4874de3
[ADD] telegram_expense_manager: multicurrency expense record report
e645bd0
[FIX] telegram_expense_manager: take currency from alias if there is …
e77fd45
[ADD] telegram_expense_manager: case-insensitive currency search
b3262fd
[FIX] telegram_expense_manager: don't specify base currency in accoun…
ab00b11
[ADD] telegram_expense_manager: data file for currency aliases
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
import re | ||
|
||
from odoo import models, api, fields | ||
from odoo.exceptions import AccessError | ||
from odoo.tools.translate import _ | ||
|
@@ -233,10 +235,13 @@ def em_handle_callback_data(self, callback_data, raw_text, add_record=None): | |
error = None | ||
|
||
if callback_data.get('action') == ASK_AMOUNT: | ||
m = re.match(r'([0-9][ +\-\/0-9.,]*) ?([^0-9]*)', raw_text) | ||
amount = m.group(1) | ||
currency = m.group(2) | ||
if not record: | ||
record = add_record('', raw_text) | ||
record = add_record('', amount, currency=currency) | ||
else: | ||
record.em_update_amount(raw_text) | ||
record.em_update_amount(amount, currency=currency) | ||
elif callback_data.get('action') == ASK_NOTE: | ||
record.em_update_note(raw_text) | ||
elif callback_data.get('action') == ASK_ANALYTIC: | ||
|
@@ -466,9 +471,17 @@ def _em_add_record(self, | |
|
||
journal = self.env.ref(journal_ref) | ||
|
||
currency_id = currency and self.env['res.currency'].search([('name', '=', currency)], limit=1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a way to use different currency names, e.g. RUB |
||
|
||
if currency_id: | ||
analytic_account_lst = [from_data.get('analytic_account_id'), to_data.get('analytic_account_id')] | ||
analytic_account_ids = self.env['account.analytic.account'].browse(analytic_account_lst) | ||
analytic_account_ids._attach_new_currency(currency_id) | ||
|
||
common = { | ||
'partner_id': self.id, | ||
'name': text or 'unknown', | ||
'currency_id': currency_id and currency_id.id or None, | ||
} | ||
if isinstance(amount, basestring): | ||
amount = float(amount.replace(',', '.')) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base_currency might not have rate 1, so you need to dived after computing sum,
e.g
base_currency = RUB, rate = 0.017
EUR = 1.2
USD = 1
Then without dividing you will get sum in USD rather than in base_currency