diff --git a/currency_rate_update/__openerp__.py b/currency_rate_update/__openerp__.py index 6a16088c1..a4808596b 100644 --- a/currency_rate_update/__openerp__.py +++ b/currency_rate_update/__openerp__.py @@ -33,6 +33,7 @@ "view/service_cron_data.xml", "view/currency_rate_update.xml", "view/company_view.xml", + "security/rule.xml", "security/ir.model.access.csv", ], "demo": [], diff --git a/currency_rate_update/i18n/currency_rate_update.pot b/currency_rate_update/i18n/currency_rate_update.pot index 78874a702..426acdbb6 100755 --- a/currency_rate_update/i18n/currency_rate_update.pot +++ b/currency_rate_update/i18n/currency_rate_update.pot @@ -27,7 +27,7 @@ msgstr "" #. module: currency_rate_update #: help:res.company,auto_currency_up:0 -msgid "Automatical update of the currencies for this company" +msgid "Automatic update of the currencies for this company" msgstr "" #. module: currency_rate_update @@ -157,7 +157,7 @@ msgstr "" #. module: currency_rate_update #: field:currency.rate.update.service,company_id:0 -msgid "Linked Company" +msgid "Company" msgstr "" #. module: currency_rate_update diff --git a/currency_rate_update/model/company.py b/currency_rate_update/model/company.py index 23ee79467..a71d27987 100644 --- a/currency_rate_update/model/company.py +++ b/currency_rate_update/model/company.py @@ -44,7 +44,7 @@ class res_company(models.Model): # Activate the currency update auto_currency_up = fields.Boolean( string='Automatic Update', - help="Automatical update of the currencies for this company") + help="Automatic update of the currencies for this company") # Function field that allows to know the # multi company currency implementation multi_company_currency_enable = fields.Boolean( diff --git a/currency_rate_update/model/currency_rate_update.py b/currency_rate_update/model/currency_rate_update.py index 8cfe926a7..9eb75f87d 100644 --- a/currency_rate_update/model/currency_rate_update.py +++ b/currency_rate_update/model/currency_rate_update.py @@ -212,7 +212,7 @@ class Currency_rate_update_service(models.Model): string='Currencies to update with ' 'this service') # Link with company - company_id = fields.Many2one('res.company', 'Linked Company') + company_id = fields.Many2one('res.company', 'Company') # Note fileds that will be used as a logger note = fields.Text('Update logs') max_delta_days = fields.Integer( @@ -237,6 +237,9 @@ class Currency_rate_update_service(models.Model): @api.one def refresh_currency(self): """Refresh the currencies rates !!for all companies now""" + _logger.info( + 'Starting to refresh currencies with service %s (company: %s)', + self.service, self.company_id.name) factory = Currency_getter_factory() curr_obj = self.env['res.currency'] rate_obj = self.env['res.currency.rate'] @@ -289,6 +292,9 @@ class Currency_rate_update_service(models.Model): 'name': rate_name } rate_obj.create(vals) + _logger.info( + 'Updated currency %s via service %s', + curr.name, self.service) # Show the most recent note at the top msg = '%s \n%s currency updated. %s' % ( @@ -303,7 +309,7 @@ class Currency_rate_update_service(models.Model): repr(exc), note ) - _logger.info(repr(exc)) + _logger.error(repr(exc)) self.write({'note': error_msg}) if self._context.get('cron', False): midnight = time(0, 0) @@ -322,4 +328,6 @@ class Currency_rate_update_service(models.Model): @api.model def _run_currency_update(self): + _logger.info('Starting the currency rate update cron') self.run_currency_update() + _logger.info('End of the currency rate update cron') diff --git a/currency_rate_update/security/rule.xml b/currency_rate_update/security/rule.xml new file mode 100644 index 000000000..835618857 --- /dev/null +++ b/currency_rate_update/security/rule.xml @@ -0,0 +1,13 @@ + + + + + + Current Rate Update Service multi-company + + + ['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])] + + + + diff --git a/currency_rate_update/view/currency_rate_update.xml b/currency_rate_update/view/currency_rate_update.xml index 166f9325d..e7c5fa62c 100644 --- a/currency_rate_update/view/currency_rate_update.xml +++ b/currency_rate_update/view/currency_rate_update.xml @@ -7,6 +7,8 @@ + @@ -20,25 +22,40 @@ currency.rate.update.service
- - + + + - + - - - - - + + + + + + + + + Currency Rate Update + currency.rate.update.service + tree,form + {'currency_rate_update_main_view': True} + + + + diff --git a/currency_rate_update/view/service_cron_data.xml b/currency_rate_update/view/service_cron_data.xml index cfc640849..8577dc632 100644 --- a/currency_rate_update/view/service_cron_data.xml +++ b/currency_rate_update/view/service_cron_data.xml @@ -9,7 +9,7 @@ - (None,) + ()