diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 48082451f35..8e79376aa87 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -61,7 +61,7 @@ class account_bank_statement(osv.osv): return res def _get_period(self, cr, uid, context=None): - periods = self.pool.get('account.period').find(cr, uid) + periods = self.pool.get('account.period').find(cr, uid,context=context) if periods: return periods[0] return False diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 17fa05d5f24..c1f30824461 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -78,7 +78,7 @@ class account_cash_statement(osv.osv): """ res = {} for statement in self.browse(cr, uid, ids, context=context): - if statement.journal_id.type not in ('cash',): + if (statement.journal_id.type not in ('cash',)) or (not statement.journal_id.cash_control): continue start = end = 0 for line in statement.details_ids: @@ -289,13 +289,13 @@ class account_cash_statement(osv.osv): super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context) absl_proxy = self.pool.get('account.bank.statement.line') - TABLES = (('Profit', 'profit_account_id'), ('Loss', 'loss_account_id'),) + TABLES = ((_('Profit'), 'profit_account_id'), (_('Loss'), 'loss_account_id'),) for obj in self.browse(cr, uid, ids, context=context): if obj.difference == 0.0: continue - for item_label, item_account in TALBES: + for item_label, item_account in TABLES: if getattr(obj.journal_id, item_account): raise osv.except_osv(_('Error!'), _('There is no %s Account on the journal %s.') % (item_label, obj.journal_id.name,)) diff --git a/addons/account/i18n/fr.po b/addons/account/i18n/fr.po index 510dc185fa6..5a013ceacb9 100644 --- a/addons/account/i18n/fr.po +++ b/addons/account/i18n/fr.po @@ -14,7 +14,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-31 04:40+0000\n" +"X-Launchpad-Export-Date: 2012-11-03 05:03+0000\n" "X-Generator: Launchpad (build 16218)\n" #. module: account diff --git a/addons/account/i18n/ru.po b/addons/account/i18n/ru.po index 7e52f26f2a4..f07753022d5 100644 --- a/addons/account/i18n/ru.po +++ b/addons/account/i18n/ru.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-11-01 04:36+0000\n" +"X-Launchpad-Export-Date: 2012-11-03 05:03+0000\n" "X-Generator: Launchpad (build 16218)\n" #. module: account diff --git a/addons/account/i18n/sl.po b/addons/account/i18n/sl.po index 5e4f9a39e16..6748e5db3b1 100644 --- a/addons/account/i18n/sl.po +++ b/addons/account/i18n/sl.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-11-02 05:09+0000\n" +"X-Launchpad-Export-Date: 2012-11-03 05:04+0000\n" "X-Generator: Launchpad (build 16218)\n" #. module: account diff --git a/addons/account/i18n/zh_CN.po b/addons/account/i18n/zh_CN.po index 2e8e2d5d3da..d722cd5673b 100644 --- a/addons/account/i18n/zh_CN.po +++ b/addons/account/i18n/zh_CN.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-11-02 05:09+0000\n" +"X-Launchpad-Export-Date: 2012-11-03 05:04+0000\n" "X-Generator: Launchpad (build 16218)\n" #. module: account diff --git a/addons/account/partner.py b/addons/account/partner.py index a9b2b99588d..3355363308b 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -209,7 +209,7 @@ class res_partner(osv.osv): relation='account.fiscal.position', string="Fiscal Position", view_load=True, - help="The fiscal position will determine taxes and the accounts used for the partner.", + help="The fiscal position will determine taxes and accounts used for the partner.", ), 'property_payment_term': fields.property( 'account.payment.term', diff --git a/addons/account/product.py b/addons/account/product.py index 9be49b4c56a..0a6a0eda10c 100644 --- a/addons/account/product.py +++ b/addons/account/product.py @@ -30,14 +30,14 @@ class product_category(osv.osv): relation='account.account', string="Income Account", view_load=True, - help="This account will be used for invoices to value sales for the current product category"), + help="This account will be used for invoices to value sales."), 'property_account_expense_categ': fields.property( - 'account.account', + 'account.account', type='many2one', relation='account.account', string="Expense Account", view_load=True, - help="This account will be used for invoices to value expenses for the current product category"), + help="This account will be used for invoices to value expenses."), } product_category() @@ -60,14 +60,14 @@ class product_template(osv.osv): relation='account.account', string="Income Account", view_load=True, - help="This account will be used for invoices instead of the default one to value sales for the current product"), + help="This account will be used for invoices instead of the default one to value sales for the current product."), 'property_account_expense': fields.property( 'account.account', type='many2one', relation='account.account', string="Expense Account", view_load=True, - help="This account will be used for invoices instead of the default one to value expenses for the current product"), + help="This account will be used for invoices instead of the default one to value expenses for the current product."), } product_template() diff --git a/addons/account/product_view.xml b/addons/account/product_view.xml index 4d64af3e154..9b54647e726 100644 --- a/addons/account/product_view.xml +++ b/addons/account/product_view.xml @@ -49,9 +49,11 @@ - - - + + + + + diff --git a/addons/account/project/analytic_account_demo.xml b/addons/account/project/analytic_account_demo.xml index b53b76969ab..2c4acc6bc45 100644 --- a/addons/account/project/analytic_account_demo.xml +++ b/addons/account/project/analytic_account_demo.xml @@ -94,8 +94,8 @@ open - - Magasin BML 1 + + Millennium Industries normal @@ -121,8 +121,8 @@ - - DistriPC + + Delta PC normal @@ -145,8 +145,8 @@ open - - Leclerc + + Luminous Technologies normal @@ -161,8 +161,8 @@ - - OpenERP SA AT Work + + Think Big Systems normal diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml index dca9f2ddf12..88cf901fdae 100644 --- a/addons/account/project/project_view.xml +++ b/addons/account/project/project_view.xml @@ -35,7 +35,6 @@ - diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 3e8b9b04b62..dd573580c6c 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -277,7 +277,7 @@
- [[ getLines(o) and removeParentNode('section')]]There is nothing due with this customer + [[ getLines(o) and removeParentNode('section')]]There is nothing due with this customer.
diff --git a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml index f4e251aaca1..9eb8fe90895 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_menu.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_menu.xml @@ -3,7 +3,7 @@ - Time & Costs to Invoice + Time & Materials to Invoice account.analytic.line form tree,form @@ -12,8 +12,10 @@

- You will find here timesheets and purchases you did for contracts that can be reinvoiced to the customer. - If you want to record new jobs to invoice, you should use the timesheet menu instead. + You will find here timesheets and purchases you did for + contracts that can be reinvoiced to the customer. If you want + to record new activities to invoice, you should use the timesheet + menu instead.

diff --git a/addons/account_anglo_saxon/product.py b/addons/account_anglo_saxon/product.py index a2a5f7e6e95..87ca24753d6 100644 --- a/addons/account_anglo_saxon/product.py +++ b/addons/account_anglo_saxon/product.py @@ -38,14 +38,14 @@ class product_category(osv.osv): relation='account.account', string="Income Account", view_load=True, - help="This account will be used to value outgoing stock for the current product category using sale price"), + help="This account will be used to value outgoing stock using sale price."), 'property_account_expense_categ': fields.property( 'account.account', type='many2one', relation='account.account', string="Expense Account", view_load=True, - help="This account will be used to value outgoing stock for the current product category using cost price"), + help="This account will be used to value outgoing stock using cost price."), } product_category() @@ -68,14 +68,14 @@ class product_template(osv.osv): relation='account.account', string="Income Account", view_load=True, - help="This account will be used to value outgoing stock for the current product category using sale price"), + help="This account will be used to value outgoing stock using sale price."), 'property_account_expense': fields.property( 'account.account', type='many2one', relation='account.account', string="Expense Account", view_load=True, - help="This account will be used to value outgoing stock for the current product category using cost price"), + help="This account will be used to value outgoing stock using cost price."), } product_template() diff --git a/addons/account_anglo_saxon/product_view.xml b/addons/account_anglo_saxon/product_view.xml index 4acc69b7595..43029616c5b 100644 --- a/addons/account_anglo_saxon/product_view.xml +++ b/addons/account_anglo_saxon/product_view.xml @@ -29,10 +29,10 @@ product.category.property.form.inherit.stock product.category - + - + diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 585798a5235..ac9024fd51d 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -134,10 +134,11 @@ class account_asset_asset(osv.osv): def compute_depreciation_board(self, cr, uid, ids, context=None): depreciation_lin_obj = self.pool.get('account.asset.depreciation.line') + currency_obj = self.pool.get('res.currency') for asset in self.browse(cr, uid, ids, context=context): if asset.value_residual == 0.0: continue - posted_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_check', '=', True)]) + posted_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_check', '=', True)],order='depreciation_date desc') old_depreciation_line_ids = depreciation_lin_obj.search(cr, uid, [('asset_id', '=', asset.id), ('move_id', '=', False)]) if old_depreciation_line_ids: depreciation_lin_obj.unlink(cr, uid, old_depreciation_line_ids, context=context) @@ -148,7 +149,12 @@ class account_asset_asset(osv.osv): else: # depreciation_date = 1st January of purchase year purchase_date = datetime.strptime(asset.purchase_date, '%Y-%m-%d') - depreciation_date = datetime(purchase_date.year, 1, 1) + #if we already have some previous validated entries, starting date isn't 1st January but last entry + method period + if (len(posted_depreciation_line_ids)>0): + last_depreciation_date = datetime.strptime(depreciation_lin_obj.browse(cr,uid,posted_depreciation_line_ids[0],context=context).depreciation_date, '%Y-%m-%d') + depreciation_date = (last_depreciation_date+relativedelta(months=+asset.method_period)) + else: + depreciation_date = datetime(purchase_date.year, 1, 1) day = depreciation_date.day month = depreciation_date.month year = depreciation_date.year @@ -158,6 +164,10 @@ class account_asset_asset(osv.osv): for x in range(len(posted_depreciation_line_ids), undone_dotation_number): i = x + 1 amount = self._compute_board_amount(cr, uid, asset, i, residual_amount, amount_to_depr, undone_dotation_number, posted_depreciation_line_ids, total_days, depreciation_date, context=context) + company_currency = asset.company_id.currency_id.id + current_currency = asset.currency_id.id + # compute amount into company currency + amount = currency_obj.compute(cr, uid, current_currency, company_currency, amount, context=context) residual_amount -= amount vals = { 'amount': amount, @@ -191,7 +201,7 @@ class account_asset_asset(osv.osv): def _amount_residual(self, cr, uid, ids, name, args, context=None): cr.execute("""SELECT - l.asset_id as id, round(SUM(abs(l.debit-l.credit))) AS amount + l.asset_id as id, SUM(abs(l.debit-l.credit)) AS amount FROM account_move_line l WHERE @@ -349,8 +359,8 @@ class account_asset_depreciation_line(osv.osv): 'sequence': fields.integer('Sequence', required=True), 'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True), 'parent_state': fields.related('asset_id', 'state', type='char', string='State of Asset'), - 'amount': fields.float('Depreciation Amount', required=True), - 'remaining_value': fields.float('Amount to Depreciate', required=True), + 'amount': fields.float('Depreciation Amount', digits_compute=dp.get_precision('Account'), required=True), + 'remaining_value': fields.float('Amount to Depreciate', digits_compute=dp.get_precision('Account'),required=True), 'depreciated_value': fields.float('Amount Already Depreciated', required=True), 'depreciation_date': fields.date('Depreciation Date', select=1), 'move_id': fields.many2one('account.move', 'Depreciation Entry'), diff --git a/addons/account_budget/account_budget_view.xml b/addons/account_budget/account_budget_view.xml index 81b261d6faa..cb0466a1c92 100644 --- a/addons/account_budget/account_budget_view.xml +++ b/addons/account_budget/account_budget_view.xml @@ -284,7 +284,7 @@ - account.analytic.account.form.inherot.budget + account.analytic.account.form.inherit.budget account.analytic.account diff --git a/addons/account_payment/i18n/zh_CN.po b/addons/account_payment/i18n/zh_CN.po index abc36f292b9..20cb178fe73 100644 --- a/addons/account_payment/i18n/zh_CN.po +++ b/addons/account_payment/i18n/zh_CN.po @@ -13,7 +13,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-31 04:40+0000\n" +"X-Launchpad-Export-Date: 2012-11-03 05:04+0000\n" "X-Generator: Launchpad (build 16218)\n" #. module: account_payment diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 20997084a60..78c7e103946 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -305,7 +305,10 @@ class account_analytic_account(osv.osv): def create_send_note(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): - self.message_post(cr, uid, [obj.id], body=_("Contract for %s has been created.") % (obj.partner_id.name), + message = _("Contract created.") + if obj.partner_id: + message = _("Contract for %s has been created.") % (obj.partner_id.name,) + self.message_post(cr, uid, [obj.id], body=message, subtype="analytic.mt_account_status", context=context) account_analytic_account() diff --git a/addons/analytic/analytic_view.xml b/addons/analytic/analytic_view.xml index 2c6136f2629..17371f8609f 100644 --- a/addons/analytic/analytic_view.xml +++ b/addons/analytic/analytic_view.xml @@ -23,11 +23,11 @@ - - + + diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 54dcc5b4362..09f9cb23da2 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -20,11 +20,10 @@ ############################################################################## import logging -import werkzeug - import openerp from openerp.modules.registry import RegistryManager -from openerp.addons.web.controllers.main import login_and_redirect + +from ..res_users import SignupError _logger = logging.getLogger(__name__) @@ -41,22 +40,18 @@ class Controller(openerp.addons.web.http.Controller): user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token) return user_info - @openerp.addons.web.http.httprequest - def signup(self, req, dbname, token, name, login, password, state=''): - """ sign up a user (new or existing), and log it in """ - url = '/' + @openerp.addons.web.http.jsonrequest + def signup(self, req, dbname, token, name, login, password): + """ sign up a user (new or existing)""" registry = RegistryManager.get(dbname) with registry.cursor() as cr: + res_users = registry.get('res.users') + values = {'name': name, 'login': login, 'password': password} try: - res_users = registry.get('res.users') - values = {'name': name, 'login': login, 'password': password} - credentials = res_users.signup(cr, openerp.SUPERUSER_ID, values, token) - cr.commit() - return login_and_redirect(req, *credentials, redirect_url='/#%s'%state) - except Exception as e: - # signup error - _logger.exception('error when signup') - url = "/#action=login&error_message=%s" % werkzeug.urls.url_quote(e.message) - return werkzeug.utils.redirect(url) + res_users.signup(cr, openerp.SUPERUSER_ID, values, token) + except SignupError, e: + return {'error': openerp.tools.exception_to_unicode(e)} + cr.commit() + return {} # vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/auth_signup/res_users.py b/addons/auth_signup/res_users.py index 69eee4f18e0..973a8da6588 100644 --- a/addons/auth_signup/res_users.py +++ b/addons/auth_signup/res_users.py @@ -29,6 +29,9 @@ from openerp import SUPERUSER_ID from openerp.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools.safe_eval import safe_eval +class SignupError(Exception): + pass + def random_token(): # the token has an entropy of about 120 bits (6 bits/char * 20 chars) chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' @@ -101,12 +104,12 @@ class res_partner(osv.Model): partner_ids = self.search(cr, uid, [('signup_token', '=', token)], context=context) if not partner_ids: if raise_exception: - raise Exception("Signup token '%s' is not valid" % token) + raise SignupError("Signup token '%s' is not valid" % token) return False partner = self.browse(cr, uid, partner_ids[0], context) if check_validity and not partner.signup_valid: if raise_exception: - raise Exception("Signup token '%s' is no longer valid" % token) + raise SignupError("Signup token '%s' is no longer valid" % token) return False return partner @@ -194,7 +197,7 @@ class res_users(osv.Model): # check that uninvited users may sign up if 'partner_id' not in values: if not safe_eval(ir_config_parameter.get_param(cr, uid, 'auth_signup.allow_uninvited', 'False')): - raise Exception('Signup is not allowed for uninvited users') + raise SignupError('Signup is not allowed for uninvited users') # create a copy of the template user (attached to a specific partner_id if given) values['active'] = True diff --git a/addons/auth_signup/static/src/js/auth_signup.js b/addons/auth_signup/static/src/js/auth_signup.js index 0974b73292d..bb249429894 100644 --- a/addons/auth_signup/static/src/js/auth_signup.js +++ b/addons/auth_signup/static/src/js/auth_signup.js @@ -8,12 +8,20 @@ openerp.auth_signup = function(instance) { var d = this._super(); // to switch between the signup and regular login form - this.$('a.oe_signup_signup').click(function() { + this.$('a.oe_signup_signup').click(function(ev) { + if (ev) { + ev.preventDefault(); + } self.$el.addClass("oe_login_signup"); + return false; }); - this.$('a.oe_signup_back').click(function() { + this.$('a.oe_signup_back').click(function(ev) { + if (ev) { + ev.preventDefault(); + } self.$el.removeClass("oe_login_signup"); delete self.params.token; + return false; }); // if there is an error message in params, show it then forget it @@ -90,10 +98,19 @@ openerp.auth_signup = function(instance) { name: name, login: login, password: password, - state: $.param(this.params) + //state: $.param(this.params) }; - var url = "/auth_signup/signup?" + $.param(params); - window.location = url; + + var self = this, + super_ = this._super; + this.rpc('/auth_signup/signup', params) + .done(function(result) { + if (result.error) { + self.show_error(result.error); + } else { + super_.apply(self, [ev]); + } + }); } else { // regular login this._super(ev); diff --git a/addons/base_import/models.py b/addons/base_import/models.py index 7060e2752e6..996dbf7964d 100644 --- a/addons/base_import/models.py +++ b/addons/base_import/models.py @@ -316,17 +316,9 @@ class ir_import(orm.TransientModel): }] _logger.info('importing %d rows...', len(data)) - try: - import_result = self.pool[record.res_model].load( - cr, uid, import_fields, data, context=context) - _logger.info('done') - except Exception, e: - _logger.info(e) - return [{ - 'type': 'error', - 'message': unicode('No data have been imported.'), - 'record': False, - }] + import_result = self.pool[record.res_model].load( + cr, uid, import_fields, data, context=context) + _logger.info('done') # If transaction aborted, RELEASE SAVEPOINT is going to raise # an InternalError (ROLLBACK should work, maybe). Ignore that. diff --git a/addons/base_vat/base_vat_view.xml b/addons/base_vat/base_vat_view.xml index 6d15099dc5a..e5d8d9c92aa 100644 --- a/addons/base_vat/base_vat_view.xml +++ b/addons/base_vat/base_vat_view.xml @@ -9,7 +9,7 @@