openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #03475
[Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
Juan José Scarafía has proposed merging lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools.
Requested reviews:
Pedro Manuel Baeza (pedro.baeza)
For more details, see:
https://code.launchpad.net/~sistemas-adhoc/account-financial-tools/currency_update/+merge/204759
We make base currency based on currency marked as base and not related to company currency because sometimes your company currency is not the same you use as base currency. We think this way is more appropiate
--
https://code.launchpad.net/~sistemas-adhoc/account-financial-tools/currency_update/+merge/204759
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch lp:account-financial-tools.
=== modified file 'currency_rate_update/currency_rate_update.py'
--- currency_rate_update/currency_rate_update.py 2013-12-13 19:33:25 +0000
+++ currency_rate_update/currency_rate_update.py 2014-02-04 17:51:03 +0000
@@ -165,7 +165,7 @@
def run_currency_update(self, cr, uid):
"update currency at the given frequence"
factory = Currency_getter_factory()
- curr_obj = self.pool.get('res_currency')
+ curr_obj = self.pool.get('res.currency')
rate_obj = self.pool.get('res.currency.rate')
companies = self.pool.get('res.company').search(cr, uid, [])
for comp in self.pool.get('res.company').browse(cr, uid, companies):
@@ -177,8 +177,18 @@
search_filter = []
if comp.multi_company_currency_enable :
search_filter = [('company_id','=',comp.id)]
- #we fetch the main currency. The main rate should be set at 1.00
- main_curr = comp.currency_id.name
+ #we fetch the main currency looking for currency with base = true. The main rate should be set at 1.00
+ main_curr_ids = curr_obj.search(cr, uid, [('base','=',True),('company_id','=',comp.id)])
+ if not main_curr_ids:
+ # If we can not find a base currency for this company we look for one with no company set
+ main_curr_ids = curr_obj.search(cr, uid, [('base','=',True),('company_id','=', False)])
+ if main_curr_ids:
+ main_curr_rec = curr_obj.browse(cr, uid, main_curr_ids[0])
+ else:
+ print ('Error !', 'There is no base currency set!')
+ if main_curr_rec.rate != 1:
+ print ('Error !', 'Base currency rate should be 1.00!')
+ main_curr = main_curr_rec.name
for service in comp.services_to_use :
print "comp.services_to_use =", comp.services_to_use
note = service.note or ''
Follow ups
-
[Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: noreply, 2014-05-13
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Joël Grand-Guillaume, 2014-05-09
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Yannick Vaucher @ Camptocamp, 2014-05-02
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Juan José Scarafía, 2014-02-12
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Frederic Clementi - Camptocamp, 2014-02-12
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Leonardo Pistone @ camptocamp, 2014-02-12
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Pedro Manuel Baeza, 2014-02-12
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Frederic Clementi - Camptocamp, 2014-02-12
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Juan José Scarafía, 2014-02-04
-
Re: [Merge] lp:~sistemas-adhoc/account-financial-tools/currency_update into lp:account-financial-tools
From: Pedro Manuel Baeza, 2014-02-04