From 988ad9ccc978bfd6f2aee0f17728ad38f16b1a6c Mon Sep 17 00:00:00 2001 From: "vda (Open ERP)" Date: Wed, 10 Nov 2010 12:48:32 +0530 Subject: [PATCH 01/23] [IMP] Share web addon. bzr revid: vda@tinyerp.com-20101110071832-ftzgmrd3trsz0icr --- addons/share/__openerp__.py | 2 ++ addons/share/web/__init__.py | 2 ++ addons/share/web/controllers.py | 37 +++++++++++++++++++++++++++ addons/share/web/editors.py | 44 +++++++++++++++++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 addons/share/web/__init__.py create mode 100644 addons/share/web/controllers.py create mode 100644 addons/share/web/editors.py diff --git a/addons/share/__openerp__.py b/addons/share/__openerp__.py index 21b63fd3bc1..393afb9717b 100644 --- a/addons/share/__openerp__.py +++ b/addons/share/__openerp__.py @@ -48,6 +48,8 @@ 'wizard/share_wizard_view.xml' ], 'installable': True, + 'active': False, + 'web': True, } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/share/web/__init__.py b/addons/share/web/__init__.py new file mode 100644 index 00000000000..f95bb222c10 --- /dev/null +++ b/addons/share/web/__init__.py @@ -0,0 +1,2 @@ +import controllers +import editors \ No newline at end of file diff --git a/addons/share/web/controllers.py b/addons/share/web/controllers.py new file mode 100644 index 00000000000..c658a3eede5 --- /dev/null +++ b/addons/share/web/controllers.py @@ -0,0 +1,37 @@ +import urlparse + +import cherrypy + +from openobject.tools import expose, ast +import openerp.controllers +from openerp.controllers import actions +from openerp.utils import rpc, TinyDict + +class Piratepad(openerp.controllers.SecuredController): + _cp_path = "/share" + + @expose() + def index(self, **kw): + domain = ast.literal_eval(kw['domain']) + search_domain = ast.literal_eval(kw['search_domain']) + filter_domain = ast.literal_eval(kw['filter_domain']) + + context = ast.literal_eval(kw['context']) + view_name = context.get('_terp_view_name') + + domain.extend(search_domain) + + action_id = rpc.RPCProxy('ir.actions.actions').search([('name','=',view_name)], 0, 0, 0, context) + if action_id: + action_id = action_id[0] + + model = 'share.wizard' + proxy = rpc.RPCProxy(model) + + share_wiz_id = rpc.RPCProxy('ir.ui.menu').search([('name','=', 'Share Wizard')]) + context.update({'active_ids': share_wiz_id, 'active_id': share_wiz_id[0], '_terp_view_name': 'Share Wizard'}) + data = {'domain': str(domain), 'action_id':action_id} + id = proxy.create(data, context) + res = rpc.session.execute('object', 'execute', model, 'go_step_1', [id], context) + return actions.execute(res, ids=[id]) + diff --git a/addons/share/web/editors.py b/addons/share/web/editors.py new file mode 100644 index 00000000000..b55afbf0896 --- /dev/null +++ b/addons/share/web/editors.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +import openobject.templating + +class SidebarTemplateEditor(openobject.templating.TemplateEditor): + templates = ['/openerp/widgets/templates/sidebar.mako'] + ADD_SHARE_BUTTON = u'id="sidebar"' + + def insert_share_link(self, output): + # Insert the link on the line right after the link to open the + # attachment form + form_opener_insertion = output.index( + '\n', + output.index(self.ADD_SHARE_BUTTON)) + 1 + output = output[:form_opener_insertion] + \ + '''

${_("Share View")}

+ + + \n''' + \ + output[form_opener_insertion:] + return output + + def edit(self, template, template_text): + output = super(SidebarTemplateEditor, self).edit(template, template_text) + + output = self.insert_share_link(output) + return output \ No newline at end of file From 15f8f81e0568ebbf3ab303f9c22e023a23b96ada Mon Sep 17 00:00:00 2001 From: "vda (Open ERP)" Date: Mon, 15 Nov 2010 16:07:06 +0530 Subject: [PATCH 02/23] [FIX] Improved share action method,share url and passed active db in email. bzr revid: vda@tinyerp.com-20101115103706-vhkrxbnrw73sljmr --- addons/share/__openerp__.py | 1 - addons/share/web/controllers.py | 50 +++++++++++++---------------- addons/share/web/editors.py | 16 ++++----- addons/share/wizard/share_wizard.py | 1 + 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/addons/share/__openerp__.py b/addons/share/__openerp__.py index 393afb9717b..768d24974a5 100644 --- a/addons/share/__openerp__.py +++ b/addons/share/__openerp__.py @@ -48,7 +48,6 @@ 'wizard/share_wizard_view.xml' ], 'installable': True, - 'active': False, 'web': True, } diff --git a/addons/share/web/controllers.py b/addons/share/web/controllers.py index c658a3eede5..18ed74a2d5e 100644 --- a/addons/share/web/controllers.py +++ b/addons/share/web/controllers.py @@ -1,37 +1,33 @@ -import urlparse +from openobject.tools import expose, ast +from openerp.controllers import actions +from openerp.utils import rpc +import openerp.controllers import cherrypy -from openobject.tools import expose, ast -import openerp.controllers -from openerp.controllers import actions -from openerp.utils import rpc, TinyDict + class Piratepad(openerp.controllers.SecuredController): _cp_path = "/share" @expose() - def index(self, **kw): - domain = ast.literal_eval(kw['domain']) - search_domain = ast.literal_eval(kw['search_domain']) - filter_domain = ast.literal_eval(kw['filter_domain']) - - context = ast.literal_eval(kw['context']) - view_name = context.get('_terp_view_name') - + def index(self, domain, search_domain, context, name): + domain = ast.literal_eval(domain) + search_domain = ast.literal_eval(search_domain) domain.extend(search_domain) - action_id = rpc.RPCProxy('ir.actions.actions').search([('name','=',view_name)], 0, 0, 0, context) - if action_id: - action_id = action_id[0] - - model = 'share.wizard' - proxy = rpc.RPCProxy(model) - - share_wiz_id = rpc.RPCProxy('ir.ui.menu').search([('name','=', 'Share Wizard')]) - context.update({'active_ids': share_wiz_id, 'active_id': share_wiz_id[0], '_terp_view_name': 'Share Wizard'}) - data = {'domain': str(domain), 'action_id':action_id} - id = proxy.create(data, context) - res = rpc.session.execute('object', 'execute', model, 'go_step_1', [id], context) - return actions.execute(res, ids=[id]) - + context = ast.literal_eval(context) + view_name = context.get('_terp_view_name') or name + if view_name: + action_id = rpc.RPCProxy('ir.actions.actions').search([('name','=',view_name)], 0, 0, 0, context) + if action_id: + action_id = action_id[0] + share_model = 'share.wizard' + share_root_url = cherrypy.config.get('server.socket_host') + ':' + str(cherrypy.config.get('server.socket_port')) + + share_wiz_id = rpc.RPCProxy('ir.ui.menu').search([('name','=', 'Share Wizard')]) + context.update({'active_ids': share_wiz_id, 'active_id': share_wiz_id[0], '_terp_view_name': 'Share Wizard', 'share_root_url': share_root_url}) + sharing_view_id = rpc.RPCProxy(share_model).create({'domain': str(domain), 'action_id':action_id}, context) + + return actions.execute(rpc.session.execute('object', 'execute', share_model, 'go_step_1', [sharing_view_id], context), ids=[sharing_view_id], context=context) + diff --git a/addons/share/web/editors.py b/addons/share/web/editors.py index b55afbf0896..fadbe50ff72 100644 --- a/addons/share/web/editors.py +++ b/addons/share/web/editors.py @@ -12,24 +12,20 @@ class SidebarTemplateEditor(openobject.templating.TemplateEditor): '\n', output.index(self.ADD_SHARE_BUTTON)) + 1 output = output[:form_opener_insertion] + \ - '''

${_("Share View")}

+ '''

${_("Sharing")}

@@ -41,4 +37,4 @@ class SidebarTemplateEditor(openobject.templating.TemplateEditor): output = super(SidebarTemplateEditor, self).edit(template, template_text) output = self.insert_share_link(output) - return output \ No newline at end of file + return output diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 9349980933f..4943f6a6e10 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -427,6 +427,7 @@ class share_create(osv.osv_memory): body += _("You may use the following login and password to get access to this protected area:") + "\n" body += "%s: %s" % (_("Username"), result_line.login) + "\n" body += "%s: %s" % (_("Password"), result_line.password) + "\n" + body += "%s: %s" % (_("Database"), cr.dbname) + "\n" else: body += _("This additional data has been automatically added to your current access.\n") body += _("You may use your existing login and password to view it. As a reminder, your login is %s.\n") % result_line.login From b352ccc815709862a24ab4eb8aca97ded3ff9502 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 10:53:05 +0530 Subject: [PATCH 03/23] [IMP] account_voucher: writeoff implementation bzr revid: psi@tinyerp.co.in-20101119052305-tmev02bzyyy2n3b0 --- addons/account/account_move_line.py | 2 + addons/account_voucher/account_voucher.py | 125 +++--------------- .../wizard/account_voucher_payment_option.py | 80 +++-------- .../wizard/account_voucher_payment_option.xml | 3 +- 4 files changed, 37 insertions(+), 173 deletions(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 93d5c37bd08..16ea52b65d4 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -716,6 +716,8 @@ class account_move_line(osv.osv): account_id = line['account_id']['id'] partner_id = (line['partner_id'] and line['partner_id']['id']) or False writeoff = debit - credit + if 'write_off' in context and context['write_off']['writeoff_amount']: + writeoff = context['write_off']['writeoff_amount'] # Ifdate_p in context => take this date if context.has_key('date_p') and context['date_p']: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 14abad25413..bc5fef3ab44 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -543,7 +543,7 @@ class account_voucher(osv.osv): mod_obj = self.pool.get('ir.model.data') if context is None: context = {} - voucher = self.browse(cr, uid, [ids[0]], context=context)[0] + voucher = self.browse(cr, uid, ids, context=context)[0] debit= credit = 0.0 if voucher.line_dr_ids: for line in voucher.line_dr_ids: @@ -666,7 +666,6 @@ class account_voucher(osv.osv): 'date': inv.date, 'date_maturity': inv.date_due } - if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0): master_line = move_line_pool.create(cr, uid, move_line) @@ -719,9 +718,14 @@ class account_voucher(osv.osv): sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0 master_line = move_line_pool.create(cr, uid, move_line) + test_ids.append('master_line') if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) + writeoff_account_id = False + writeoff_journal_id = False + writeoff_period_id = inv.period_id.id, + comment = False if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total): diff = line_total @@ -745,119 +749,22 @@ class account_voucher(osv.osv): move_line['account_id'] = account_id move_line_pool.create(cr, uid, move_line) + for rec_ids in rec_list_ids: + if len(rec_ids) >= 2: + if 'write_off' in context and context['write_off']['writeoff_acc_id']: + writeoff_account_id = context['write_off']['writeoff_acc_id'] + writeoff_journal_id = context['write_off']['writeoff_journal_id'] + comment = context['write_off']['comment'] + self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + else: + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) + self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', 'number': name, }) move_pool.post(cr, uid, [move_id], context={}) - for rec_ids in rec_list_ids: - if len(rec_ids) >= 2: - move_line_pool.reconcile_partial(cr, uid, rec_ids) - return True - - def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): - if context is None: - context = {} - seq_obj = self.pool.get('ir.sequence') - #TODO check if we can use different period for payment and the writeoff line - assert len(ids)==1, "Can only pay one voucher at a time" - voucher = self.browse(cr, uid, ids[0]) - if voucher.number: - name = voucher.number - elif voucher.journal_id.sequence_id: - name = seq_obj.get_id(cr, uid, voucher.journal_id.sequence_id.id) - else: - raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !')) - if not voucher.reference: - ref = name.replace('/','') - else: - ref = voucher.reference - - src_account_id = voucher.account_id.id - # Take the seq as name for move - types = {'sale': -1, 'purchase': 1, 'payment': 1, 'receipt': -1} - direction = types[voucher.type] - #take the choosen date - if 'date_p' in context and context['date_p']: - date = context['date_p'] - else: - date = time.strftime('%Y-%m-%d') - # Take the amount in currency and the currency of the payment - if 'amount_currency' in context and context['amount_currency'] and 'currency_id' in context and context['currency_id']: - amount_currency = context['amount_currency'] - currency_id = context['currency_id'] - else: - amount_currency = False - currency_id = False - pay_journal = self.pool.get('account.journal').read(cr, uid, pay_journal_id, ['type'], context=context) - if voucher.type in ('sale', 'receipt'): - if pay_journal['type'] == 'bank': - entry_type = 'bank_pay_voucher' # Bank payment - else: - entry_type = 'pay_voucher' # Cash payment - else: - entry_type = 'cont_voucher' - - # Pay attention to the sign for both debit/credit AND amount_currency - l1 = { - 'debit': direction * pay_amount>0 and direction * pay_amount, - 'credit': direction * pay_amount<0 and - direction * pay_amount, - 'account_id': src_account_id, - 'partner_id': voucher.partner_id.id, - 'ref':ref, - 'date': date, - 'currency_id':currency_id, - 'amount_currency':amount_currency and direction * amount_currency or 0.0, - 'company_id': voucher.company_id.id, - } - l2 = { - 'debit': direction * pay_amount<0 and - direction * pay_amount, - 'credit': direction * pay_amount>0 and direction * pay_amount, - 'account_id': pay_account_id, - 'partner_id': voucher.partner_id.id, - 'ref':ref, - 'date': date, - 'currency_id':currency_id, - 'amount_currency':amount_currency and - direction * amount_currency or 0.0, - 'company_id': voucher.company_id.id, - } - - if not name: - name = voucher.line_ids and voucher.line_ids[0].name or voucher.number - l1['name'] = name - l2['name'] = name - lines = [(0, 0, l1), (0, 0, l2)] - move = {'ref': ref, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id, 'name': name, 'date': date} - move_id = self.pool.get('account.move').create(cr, uid, move, context=context) - - line_ids = [] - total = 0.0 - line = self.pool.get('account.move.line') - move_ids = [move_id,] - if voucher.move_id: - move_ids.append(voucher.move_id.id) - cr.execute('SELECT id FROM account_move_line '\ - 'WHERE move_id IN %s', - ((move_id,),)) - lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) ) - for l in lines: - if l.account_id.id == src_account_id: - line_ids.append(l.id) - total += (l.debit or 0.0) - (l.credit or 0.0) - - voc_id, name = self.name_get(cr, uid, [voucher.id], context=context)[0] - if (not round(total,self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))) or writeoff_acc_id: - self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context) - else: - code = voucher.currency_id.code - # TODO: use currency's formatting function - msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining)") % \ - (name, pay_amount, code, voucher.amount_total, code, total, code) - self.log(cr, uid, voc_id, msg) - self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context) - # Update the stored value (fields.function), so we write to trigger recompute - self.write(cr, uid, ids, {'state':'posted'}, context=context) return True def copy(self, cr, uid, id, default={}, context=None): diff --git a/addons/account_voucher/wizard/account_voucher_payment_option.py b/addons/account_voucher/wizard/account_voucher_payment_option.py index cbc22364fed..408bf909fd2 100644 --- a/addons/account_voucher/wizard/account_voucher_payment_option.py +++ b/addons/account_voucher/wizard/account_voucher_payment_option.py @@ -21,6 +21,7 @@ from osv import fields, osv from tools.translate import _ +import decimal_precision as dp class account_voucher_pay_writeoff(osv.osv_memory): """ @@ -28,11 +29,22 @@ class account_voucher_pay_writeoff(osv.osv_memory): """ _name = "account.voucher.pay.writeoff" _description = "Pay Voucher" + + def _get_amount(self, cr, uid, context=None): + voucher_obj = self.pool.get('account.voucher') + voucher = voucher_obj.browse(cr, uid, context['voucher_id'], context=context) + amount = 0.0 + for line in voucher.line_ids: + amount += line.amount_unreconciled + diff = amount - voucher.amount + return diff + _columns = { 'payment_option':fields.selection([ ('not_reconcile', 'Do not reconcile balance'), ('close_balance', 'close the balance'), ], 'Payment Option', required=True), + 'writeoff_amount': fields.float('Writeoff Amount', required=True, digits_compute = dp.get_precision('Account')), 'writeoff_acc_id': fields.many2one('account.account', 'Write-Off account'), 'writeoff_journal_id': fields.many2one('account.journal', 'Write-Off journal'), 'comment': fields.char('Comment', size=64, required=True), @@ -41,76 +53,18 @@ class account_voucher_pay_writeoff(osv.osv_memory): _defaults = { 'payment_option': 'not_reconcile', 'comment': 'Write-Off', + 'writeoff_amount': _get_amount } def pay_and_reconcile_writeoff(self, cr, uid, ids, context=None): voucher_obj = self.pool.get('account.voucher') - data = self.read(cr, uid, ids,context=context)[0] + data = self.read(cr, uid, ids, context=context)[0] voucher_id = context.get('voucher_id', False) - if data['payment_option'] == 'not_reconcile': - voucher_obj.action_move_line_create(cr, uid, [voucher_id], context=context) - return {} - context.update({'write_off':data}) - self.pool.get('account.voucher.pay').pay_and_reconcile(cr, uid, [voucher_id], context=context) + if data['payment_option'] == 'close_balance': + context.update({'write_off':data}) + voucher_obj.action_move_line_create(cr, uid, [voucher_id], context=context) return {} account_voucher_pay_writeoff() -class account_voucher_pay(osv.osv_memory): - """ - Generate pay invoice wizard, user can make partial or full payment for invoice. - """ - _name = "account.voucher.pay" - _description = "Pay Voucher" - - def pay_and_reconcile(self, cr, uid, ids, context=None): - cur_obj = self.pool.get('res.currency') - voucher_obj = self.pool.get('account.voucher') - if context is None: - context = {} - voucher = voucher_obj.browse(cr, uid, [ids[0]], context=context)[0] - writeoff_account_id = False - writeoff_journal_id = False - comment = False - - if 'write_off' in context and context['write_off'] : - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - - amount = voucher.amount - journal = voucher.journal_id - # Compute the amount in company's currency, with the journal currency (which is equal to payment currency) - # when it is needed : If payment currency (according to selected journal.currency) is <> from company currency - if journal.currency and voucher.company_id.currency_id.id<>journal.currency.id: - ctx = {'date': voucher.date} - amount = cur_obj.compute(cr, uid, journal.currency.id, voucher.company_id.currency_id.id, amount, context=ctx) - currency_id = journal.currency.id - # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency - context.update({'amount_currency': voucher.amount, 'currency_id': currency_id}) - - if voucher.company_id.currency_id.id<>voucher.currency_id.id: - ctx = {'date':voucher.date} - amount = cur_obj.compute(cr, uid, voucher.currency_id.id, voucher.company_id.currency_id.id, amount, context=ctx) - currency_id = voucher.currency_id.id - # Put the paid amount in currency, and the currency, in the context if currency is different from company's currency - context.update({'amount_currency':voucher.amount,'currency_id':currency_id}) - - # Take the choosen date - if comment: - context.update({'date_p':voucher.date, 'comment':comment}) - else: - context.update({'date_p':voucher.date, 'comment':False}) - - acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id - if not acc_id: - raise osv.except_osv(_('Error !'), _('Your journal must have a default credit and debit account.')) - - voucher_obj.pay_and_reconcile(cr, uid, ids, - amount, acc_id, voucher.period_id.id, journal.id, writeoff_account_id, - voucher.period_id, writeoff_journal_id, context, voucher.name) - return {} - -account_voucher_pay() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_voucher/wizard/account_voucher_payment_option.xml b/addons/account_voucher/wizard/account_voucher_payment_option.xml index 85980cd2b33..e762bcbc657 100644 --- a/addons/account_voucher/wizard/account_voucher_payment_option.xml +++ b/addons/account_voucher/wizard/account_voucher_payment_option.xml @@ -12,9 +12,10 @@ + + - From e86ddeff43666f1f36a0b11842c0389e17c6874d Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 14:10:37 +0530 Subject: [PATCH 04/23] [IMP] account_voucher:Writeoff implementation for customer and supplier payments bzr revid: psi@tinyerp.co.in-20101119084037-jcqxpwz5349jwkm1 --- addons/account_voucher/account_voucher.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index bc5fef3ab44..d1e260dab66 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -718,7 +718,6 @@ class account_voucher(osv.osv): sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 move_line['amount_currency'] = company_currency <> current_currency and sign * line.amount or 0.0 master_line = move_line_pool.create(cr, uid, move_line) - test_ids.append('master_line') if line.move_line_id.id: rec_ids = [master_line, line.move_line_id.id] rec_list_ids.append(rec_ids) @@ -749,16 +748,18 @@ class account_voucher(osv.osv): move_line['account_id'] = account_id move_line_pool.create(cr, uid, move_line) + voucher = self.browse(cr, uid, ids)[0] + for rec_ids in rec_list_ids: if len(rec_ids) >= 2: - if 'write_off' in context and context['write_off']['writeoff_acc_id']: - writeoff_account_id = context['write_off']['writeoff_acc_id'] - writeoff_journal_id = context['write_off']['writeoff_journal_id'] - comment = context['write_off']['comment'] - self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - else: - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) - + for line in voucher.line_ids: + if line.amount_unreconciled != line.amount: + if 'write_off' in context and context['write_off']['writeoff_acc_id']: + writeoff_account_id = context['write_off']['writeoff_acc_id'] + writeoff_journal_id = context['write_off']['writeoff_journal_id'] + comment = context['write_off']['comment'] + self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', From 9373354e815a683f3d026d0fd6306ca4b0598f3c Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Fri, 19 Nov 2010 16:43:56 +0530 Subject: [PATCH 05/23] [IMP] account_voucher:Writeoff implementation for customer and supplier payments bzr revid: psi@tinyerp.co.in-20101119111356-1mxdvqj04xawm7b3 --- addons/account_voucher/account_voucher.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index d1e260dab66..0425dc41ee9 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -759,7 +759,8 @@ class account_voucher(osv.osv): writeoff_journal_id = context['write_off']['writeoff_journal_id'] comment = context['write_off']['comment'] self.pool.get('account.move.line').reconcile(cr, uid, rec_ids, 'manual', writeoff_account_id, writeoff_period_id, writeoff_journal_id, context) - self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) + else: + self.pool.get('account.move.line').reconcile_partial(cr, uid, rec_ids, 'manual', context) self.write(cr, uid, [inv.id], { 'move_id': move_id, 'state': 'posted', From e1d9d1d6c6f4f40cd0a4df8bef2bc6c9ffa912dd Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 19 Nov 2010 13:20:03 +0100 Subject: [PATCH 06/23] [FIX] stock,hr,pos,project,...: cleanup some calls to _( ) - only literal strings should ever been used! bzr revid: odo@openerp.com-20101119122003-4r52xuupedyhgmcx --- addons/base_module_quality/speed_test/speed_test.py | 2 +- addons/hr_holidays/hr_holidays.py | 6 +++--- addons/hr_payroll/hr_payroll.py | 12 ++++++------ addons/point_of_sale/wizard/pos_open_statement.py | 2 +- addons/project_scrum/project_scrum.py | 6 +++--- addons/stock/product.py | 2 +- addons/stock/stock.py | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/addons/base_module_quality/speed_test/speed_test.py b/addons/base_module_quality/speed_test/speed_test.py index d8445afcdee..611ada2c13e 100644 --- a/addons/base_module_quality/speed_test/speed_test.py +++ b/addons/base_module_quality/speed_test/speed_test.py @@ -113,7 +113,7 @@ This test checks the speed of the module. Note that at least 5 demo data is need except Exception, e: self.log.warning('Error in read method', exc_info=True) list2 = [obj, _("Error in Read method")] - speed_list = [obj, size, code_base_complexity, code_half_complexity, code_size_complexity, _("Error in Read method:" + str(e))] + speed_list = [obj, size, code_base_complexity, code_half_complexity, code_size_complexity, _("Error in Read method") + ": %s " % e] else: if size < 5: speed_list = [obj, size, code_base_complexity, code_half_complexity, code_size_complexity, _("Warning! Not enough demo data")] diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 0cba8c7223f..f5896f3a722 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -364,15 +364,15 @@ class hr_holidays(osv.osv): leave_asked = record.number_of_days_temp if record.holiday_type == 'employee' and record.type == 'remove': if record.employee_id and not record.holiday_status_id.limit: - leaves_rest = self.pool.get('hr.holidays.status').get_days( cr, uid, [record.holiday_status_id.id], record.employee_id.id, False)[record.holiday_status_id.id]['remaining_leaves'] + leaves_rest = obj_hr_holiday_status.get_days( cr, uid, [record.holiday_status_id.id], record.employee_id.id, False)[record.holiday_status_id.id]['remaining_leaves'] if leaves_rest < leave_asked: - raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for %s while available leaves are less than asked leaves.' %(record.employee_id.name))) + raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for employee %s while there are too few remaining leave days.') % (record.employee_id.name)) nb = -(record.number_of_days_temp) elif record.holiday_type == 'category' and record.type == 'remove': if record.category_id and not record.holiday_status_id.limit: leaves_rest = obj_hr_holiday_status.get_days_cat( cr, uid, [record.holiday_status_id.id], record.category_id.id, False)[record.holiday_status_id.id]['remaining_leaves'] if leaves_rest < leave_asked: - raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for %s while available leaves are less than asked leaves.' %(record.category_id.name))) + raise osv.except_osv(_('Warning!'),_('You cannot validate leaves for category %s while there are too few remaining leave days.') % (record.category_id.name)) nb = -(record.number_of_days_temp) else: nb = record.number_of_days_temp diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index bc2a4581cc3..851e3994348 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -176,7 +176,7 @@ class hr_contract(osv.osv): exp = line.category_id.condition calculate = eval(exp, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) if not calculate: continue @@ -191,7 +191,7 @@ class hr_contract(osv.osv): #Please have a look at the configuration guide. amt = eval(base, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) if sal_type in ('gross', 'net'): if line.amount_type == 'per': @@ -281,7 +281,7 @@ class hr_contract(osv.osv): try: amount = line.amount * eval(str(line.category_id.base), obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) elif line.amount_type in ('fix', 'func'): amount = line.amount cd = line.category_id.code.lower() @@ -855,7 +855,7 @@ class hr_payslip(osv.osv): try: amount = line.amount * eval(str(line.category_id.base), obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) elif line.amount_type in ('fix', 'func'): amount = line.amount cd = line.category_id.code.lower() @@ -1147,7 +1147,7 @@ class hr_payslip(osv.osv): exp = line.category_id.condition calculate = eval(exp, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) if not calculate: continue @@ -1162,7 +1162,7 @@ class hr_payslip(osv.osv): #Please have a look at the configuration guide. amt = eval(base, obj) except Exception, e: - raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ' % (e))) + raise osv.except_osv(_('Variable Error !'), _('Variable Error: %s ') % (e)) if sal_type in ('gross', 'net'): if line.amount_type == 'per': diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py index 954f95070c8..2040c390efe 100644 --- a/addons/point_of_sale/wizard/pos_open_statement.py +++ b/addons/point_of_sale/wizard/pos_open_statement.py @@ -49,7 +49,7 @@ class pos_open_statement(osv.osv_memory): for journal in journal_obj.browse(cr, uid, journal_ids, context=context): ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)], context=context) if len(ids): - raise osv.except_osv(_('Message'), _('You can not open a Cashbox for "%s".\nPlease close its related cash register.' %(journal.name))) + raise osv.except_osv(_('Message'), _('You can not open a Cashbox for "%s".\nPlease close its related cash register.') %(journal.name)) number = '' if journal.sequence_id: diff --git a/addons/project_scrum/project_scrum.py b/addons/project_scrum/project_scrum.py index 75f9cfd4a63..804cff01487 100644 --- a/addons/project_scrum/project_scrum.py +++ b/addons/project_scrum/project_scrum.py @@ -330,7 +330,7 @@ class project_scrum_meeting(osv.osv): if meeting_id and meeting_id.sprint_id.scrum_master_id.user_email: res = self.email_send(cr, uid, ids, meeting_id.sprint_id.scrum_master_id.user_email) if not res: - raise osv.except_osv(_('Error !'), _(' Email Not send to the scrum master %s!' % meeting_id.sprint_id.scrum_master_id.name)) + raise osv.except_osv(_('Error !'), _('Email notification could not be sent to the scrum master %s') % meeting_id.sprint_id.scrum_master_id.name) else: raise osv.except_osv(_('Error !'), _('Please provide email address for scrum master defined on sprint.')) return True @@ -343,7 +343,7 @@ class project_scrum_meeting(osv.osv): if meeting_id.sprint_id.product_owner_id.user_email: res = self.email_send(cr,uid,ids,meeting_id.sprint_id.product_owner_id.user_email) if not res: - raise osv.except_osv(_('Error !'), _(' Email Not send to the product owner %s!' % meeting_id.sprint_id.product_owner_id.name)) + raise osv.except_osv(_('Error !'), _('Email notification could not be sent to the product owner %s') % meeting_id.sprint_id.product_owner_id.name) else: raise osv.except_osv(_('Error !'), _('Please provide email address for product owner defined on sprint.')) return True @@ -358,7 +358,7 @@ class project_scrum_meeting(osv.osv): body = _('Hello ') + meeting_id.sprint_id.scrum_master_id.name + ",\n" + " \n" +_('I am sending you Daily Meeting Details of date')+ ' %s ' % (meeting_id.date)+ _('for the Sprint')+ ' %s\n' % (meeting_id.sprint_id.name) body += "\n"+ _('*Tasks since yesterday:')+ '\n_______________________%s' % (meeting_id.question_yesterday) + '\n' +_("*Task for Today:")+ '\n_______________________ %s\n' % (meeting_id.question_today )+ '\n' +_('*Blocks encountered:') +'\n_______________________ %s' % (meeting_id.question_blocks or _('No Blocks')) body += "\n\n"+_('Thank you')+",\n"+ user.name - sub_name = meeting_id.name or _('Scrum Meeting of')+ "%s" %meeting_id.date + sub_name = meeting_id.name or _('Scrum Meeting of %s') % meeting_id.date flag = tools.email_send(user_email , [email], sub_name, body, reply_to=None, openobject_id=str(meeting_id.id)) if not flag: return False diff --git a/addons/stock/product.py b/addons/stock/product.py index ddb582f4a3c..615ef20c516 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -71,7 +71,7 @@ class product_product(osv.osv): product_obj=self.browse(cr,uid,ids)[0] account_variation = product_obj.categ_id.property_stock_variation account_variation_id = account_variation and account_variation.id or False - if not account_variation_id: raise osv.except_osv(_('Error!'), _('Variation Account is not specified for Product Category: %s' % (product_obj.categ_id.name))) + if not account_variation_id: raise osv.except_osv(_('Error!'), _('Variation Account is not specified for Product Category: %s') % (product_obj.categ_id.name)) move_ids = [] loc_ids = location_obj.search(cr, uid,[('usage','=','internal')]) for rec_id in ids: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 5c6ef0bb3e7..6a8907e744c 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1143,7 +1143,7 @@ class stock_picking(osv.osv): if move.state in ('done', 'cancel'): continue partial_data = partial_datas.get('move%s'%(move.id), False) - assert partial_data, _('Do not Found Partial data of Stock Move Line :%s' %(move.id)) + assert partial_data, _('Missing partial picking data for move #%s') % (move.id) product_qty = partial_data.get('product_qty',0.0) move_product_qty[move.id] = product_qty product_uom = partial_data.get('product_uom',False) @@ -2274,7 +2274,7 @@ class stock_move(osv.osv): if move.state in ('done', 'cancel'): continue partial_data = partial_datas.get('move%s'%(move.id), False) - assert partial_data, _('Do not Found Partial data of Stock Move Line :%s' %(move.id)) + assert partial_data, _('Missing partial picking data for move #%s') % (move.id) product_qty = partial_data.get('product_qty',0.0) move_product_qty[move.id] = product_qty product_uom = partial_data.get('product_uom',False) From 4342ea125216e9fe563a95715db3a629e5c06e2d Mon Sep 17 00:00:00 2001 From: "vda (Open ERP)" Date: Sat, 20 Nov 2010 12:30:51 +0530 Subject: [PATCH 07/23] [FIX] Fixed share action according to framework,share_root_url. bzr revid: vda@tinyerp.com-20101120070051-vnlh1dp99shaxpoa --- addons/share/web/controllers.py | 4 +--- addons/share/web/editors.py | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/share/web/controllers.py b/addons/share/web/controllers.py index 18ed74a2d5e..c37af991b25 100644 --- a/addons/share/web/controllers.py +++ b/addons/share/web/controllers.py @@ -15,7 +15,6 @@ class Piratepad(openerp.controllers.SecuredController): domain = ast.literal_eval(domain) search_domain = ast.literal_eval(search_domain) domain.extend(search_domain) - context = ast.literal_eval(context) view_name = context.get('_terp_view_name') or name if view_name: @@ -23,11 +22,10 @@ class Piratepad(openerp.controllers.SecuredController): if action_id: action_id = action_id[0] share_model = 'share.wizard' - share_root_url = cherrypy.config.get('server.socket_host') + ':' + str(cherrypy.config.get('server.socket_port')) + share_root_url = cherrypy.request.base share_wiz_id = rpc.RPCProxy('ir.ui.menu').search([('name','=', 'Share Wizard')]) context.update({'active_ids': share_wiz_id, 'active_id': share_wiz_id[0], '_terp_view_name': 'Share Wizard', 'share_root_url': share_root_url}) sharing_view_id = rpc.RPCProxy(share_model).create({'domain': str(domain), 'action_id':action_id}, context) - return actions.execute(rpc.session.execute('object', 'execute', share_model, 'go_step_1', [sharing_view_id], context), ids=[sharing_view_id], context=context) diff --git a/addons/share/web/editors.py b/addons/share/web/editors.py index fadbe50ff72..9059e841034 100644 --- a/addons/share/web/editors.py +++ b/addons/share/web/editors.py @@ -20,12 +20,13 @@ class SidebarTemplateEditor(openobject.templating.TemplateEditor): From 6f3ef38b8832d8ccb1d6a0cf03a36e2f952a8085 Mon Sep 17 00:00:00 2001 From: "vda (Open ERP)" Date: Mon, 22 Nov 2010 12:08:23 +0530 Subject: [PATCH 08/23] [FIX] Fixed share root url with direct access of user. bzr revid: vda@tinyerp.com-20101122063823-suc6cj5k8cu7y7ac --- addons/share/wizard/share_wizard.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 4943f6a6e10..bce94c1dc3e 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -99,12 +99,16 @@ class share_create(osv.osv_memory): for new_user in wizard_data.new_users.split('\n'): # attempt to show more user-friendly msg than default constraint error existing = user_obj.search(cr, 1, [('login', '=', new_user)]) + password = generate_random_pass() + if wizard_data.share_root_url: + wizard_data.share_root_url = wizard_data.share_root_url + '/openerp/login?db=%s'%(cr.dbname) + '&user=%s'%(new_user) + '&password=%s'%(password) + self.write(cr, 1, [uid], {'share_root_url': wizard_data.share_root_url}) if existing: raise osv.except_osv(_('User already exists'), _('This username (%s) already exists, perhaps data has already been shared with this person.\nYou may want to try selecting existing shared users instead.')) user_id = user_obj.create(cr, 1, { 'login': new_user, - 'password': generate_random_pass(), + 'password': password, 'name': new_user, 'user_email': new_user, 'groups_id': [(6,0,[group_id])], @@ -395,7 +399,6 @@ class share_create(osv.osv_memory): # C. all_relations = obj0 + obj1 + obj2 + obj3 self._link_or_copy_current_user_rules(cr, uid, group_id, all_relations, context=context) - # so far, so good -> populate summary results and return them self._create_result_lines(cr, uid, wizard_data, context=context) From 648aca8ca01e25e041fcea9ca25a23fa69115e7b Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Mon, 22 Nov 2010 13:38:06 +0530 Subject: [PATCH 09/23] [REF] Account_sequence: add help tooltip on internal number field bzr revid: mra@mra-laptop-20101122080806-h3ptk0sfkrbivryf --- addons/account_sequence/account_sequence.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_sequence/account_sequence.py b/addons/account_sequence/account_sequence.py index 39b2327452d..309bf3bc803 100644 --- a/addons/account_sequence/account_sequence.py +++ b/addons/account_sequence/account_sequence.py @@ -26,7 +26,7 @@ class account_move(osv.osv): _inherit = 'account.move' _columns = { - 'internal_sequence_number': fields.char('Internal Number', size=64, readonly=True), + 'internal_sequence_number': fields.char('Internal Number', size=64, readonly=True, help='Internal Sequence Number'), } def post(self, cr, uid, ids, context=None): @@ -55,7 +55,7 @@ class account_move_line(osv.osv): _inherit = "account.move.line" _columns = { - 'internal_sequence_number': fields.related('move_id','internal_sequence_number', type='char', relation='account.move', string='Internal Number'), + 'internal_sequence_number': fields.related('move_id','internal_sequence_number', type='char', relation='account.move', help='Internal Sequence Number', string='Internal Number'), } account_move_line() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From b432214145445453262462476c914dcaca025e9e Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Mon, 22 Nov 2010 14:23:19 +0530 Subject: [PATCH 10/23] [REM] pos: Remove cash journal as it available from account and no more refrence on pos too bzr revid: mra@mra-laptop-20101122085319-kw1nyxq03ce57brp --- addons/point_of_sale/account_statement_demo.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/account_statement_demo.xml b/addons/point_of_sale/account_statement_demo.xml index 3862c3c97cb..c4850ded0a3 100644 --- a/addons/point_of_sale/account_statement_demo.xml +++ b/addons/point_of_sale/account_statement_demo.xml @@ -13,7 +13,7 @@ - + Bancontact Journal From e3fdc5e3291dccbb615c20f87f5aa4aa6918a593 Mon Sep 17 00:00:00 2001 From: "ARA (OpenERP)" Date: Mon, 22 Nov 2010 15:20:07 +0530 Subject: [PATCH 11/23] [REF] point_of_sale: fix the yml partner_id warning bzr revid: ara@tinyerp.com-20101122095007-b5128lopvy02ux1a --- addons/point_of_sale/point_of_sale.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 8bee8a4245c..b4b2ff9cb9f 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -752,6 +752,7 @@ class pos_order(osv.osv): 'period_id': period, 'tax_code_id': tax_code_id, 'tax_amount': tax_amount, + 'partner_id': order.partner_id and order.partner_id.id or False }, context=context) # For each remaining tax with a code, whe create a move line @@ -817,6 +818,7 @@ class pos_order(osv.osv): or 0.0, 'journal_id': order.sale_journal.id, 'period_id': period, + 'partner_id': order.partner_id and order.partner_id.id or False }, context=context)) From 6ff9caa04af0d0885bb1d24b90bf85c512377db6 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 16:40:50 +0530 Subject: [PATCH 12/23] [IMP] account: cumulative balance for journal report bzr revid: psi@tinyerp.co.in-20101122111050-jjwk79g6m5lq7g0p --- addons/account/report/account_journal.py | 20 +++- addons/account/report/account_journal.rml | 112 +++++++++++----------- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 82af01cdb0b..336a32b2a7a 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -117,10 +117,22 @@ class journal_print(report_sxw.rml_parse, common_report_header): move_state = ['draft','posted'] if self.target_move == 'posted': move_state = ['posted'] - - self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '',(tuple(move_state), period_id, tuple(journal_id) )) - ids = map(lambda x: x[0], self.cr.fetchall()) - return obj_mline.browse(self.cr, self.uid, ids) + self.cr.execute("SELECT l.id, l.date, l.ref, l.name, l.debit, l.credit, m.name as move_name, acc.code as account_code, rp.name as partner_name "\ + "FROM account_move_line l "\ + "LEFT JOIN account_move m ON (m.id=l.move_id) "\ + "LEFT JOIN account_account acc ON (l.account_id = acc.id) "\ + "LEFT JOIN res_partner rp ON (l.partner_id=rp.id) "\ + "WHERE m.state IN %s "\ + "AND l.period_id = %s "\ + "AND l.journal_id IN %s " + self.query_get_clause + " "\ + "ORDER BY l."+ self.sort_selection + " ", + (tuple(move_state), period_id, tuple(journal_id) )) + res = self.cr.dictfetchall() + account_sum = 0.0 + for l in res: + account_sum += l['debit'] - l['credit'] + l['progress'] = account_sum + return res def _set_get_account_currency_code(self, account_id): self.cr.execute("SELECT c.symbol AS code "\ diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index cb37b4e83f5..0a20da7fc9a 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -176,9 +176,9 @@ - - - + + + @@ -202,44 +202,44 @@ - [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] + [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] + [[ data['model']=='ir.ui.menu' and 'Chart of Account' or removeParentNode('para') ]] Fiscal Year - Journal + Journal Filters By - Entries Sorted By + Entries Sorted By Target Moves - - [[ get_account(data) or '' ]] + + [[ get_account(data) or '' ]] [[ get_fiscalyear(data) or '' ]] - [[o.journal_id.name ]] - [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] - [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] - - Start Period - End Period - - - [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] - - - - [[ get_sortby(data) ]] - [[ get_target_move(data) ]] - - + [[o.journal_id.name ]] + [[ get_filter(data)=='No Filter' and get_filter(data) or removeParentNode('para') ]] + [[ get_filter(data)=='Date' or removeParentNode('blockTable') ]] + + Start Date + End Date + + + [[ formatLang(get_start_date(data),date=True) ]] + [[ formatLang(get_end_date(data),date=True) ]] + + + [[ get_filter(data)=='Periods' or removeParentNode('blockTable') ]] + + Start Period + End Period + + + [[ get_start_period(data) or removeParentNode('para') ]] + [[ get_end_period(data) or removeParentNode('para') ]] + + + + [[ get_sortby(data) ]] + [[ get_target_move(data) ]] + + @@ -269,14 +269,14 @@ [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]] - [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] - [[ line.ref ]] - [[ line.account_id.code ]] - [[ line.partner_id and line.partner_id.name ]] - [[ line.move_id.name ]] - [[ line.name ]] - [[ formatLang(line.debit) ]] - [[ formatLang(line.credit) ]] - [[ formatLang(line.credit - line.debit) ]] [[ company.currency_id.symbol ]] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['ref'] or '' ]] + [[ line['account_code'] or '' ]] + [[ line['partner_name'] or '' ]] + [[ line['move_name'] or '' ]] - [[ line['name'] or '' ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit']) ]] + [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] @@ -290,8 +290,8 @@ Move/Entry label Debit Credit - Balance - Currency + Balance + Currency [[o.period_id.name ]] @@ -301,19 +301,19 @@ [[ formatLang(sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang(sum_credit(o.period_id.id, o.journal_id.id)) ]] - [[ formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((sum_debit(o.period_id.id, o.journal_id.id) - sum_credit(o.period_id.id, o.journal_id.id))) ]] [[ company.currency_id.symbol ]] [[lines(o.period_id.id, o.journal_id.id) or removeParentNode('story') ]] - [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line.date,date=True) ]] - [[ line.ref ]] - [[ line.account_id.code ]] - [[ line.partner_id and line.partner_id.name ]] - [[ line.move_id.name ]] - [[ line.name ]] - [[ formatLang(line.debit) ]] - [[ formatLang(line.credit) ]] - [[ formatLang(line.credit - line.debit) ]] [[ company.currency_id.symbol ]] - [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.symbol or '']] + [[ repeatIn(lines(o.period_id.id, o.journal_id.id), 'line') ]][[ formatLang(line['date'],date=True) ]] + [[ line['ref'] or '' ]] + [[ line['account_code'] or '' ]] + [[ line['partner_name'] or '' ]] + [[ line['move_name'] or '' ]] - [[ line['name'] or '' ]] + [[ formatLang(line['debit']) ]] + [[ formatLang(line['credit']) ]] + [[ formatLang(line['progress']) ]] [[ company.currency_id.symbol ]] + [[ line.currency_id and formatLang(line.amount_currency) or '' ]] [[ line.currency_id.symbol or '']] From 1785b797a4ca1357ca3c8a0aa9912dd6b6146cf1 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Mon, 22 Nov 2010 16:52:10 +0530 Subject: [PATCH 13/23] [FIX] account: small change in journal report bzr revid: psi@tinyerp.co.in-20101122112210-ohdvm7ivvgjz9ncx --- addons/account/report/account_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 336a32b2a7a..fcab2312c42 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -130,7 +130,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): res = self.cr.dictfetchall() account_sum = 0.0 for l in res: - account_sum += l['debit'] - l['credit'] + account_sum += l['credit']-l['debit'] l['progress'] = account_sum return res From d452c65969688234760affac1d87cac3857206db Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 22 Nov 2010 12:44:29 +0100 Subject: [PATCH 14/23] [REV] alterations to server side of share wizard bzr revid: xmo@openerp.com-20101122114429-cmi5h10t5iwv9x0l --- addons/share/wizard/share_wizard.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index bce94c1dc3e..152bc55969b 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -99,16 +99,12 @@ class share_create(osv.osv_memory): for new_user in wizard_data.new_users.split('\n'): # attempt to show more user-friendly msg than default constraint error existing = user_obj.search(cr, 1, [('login', '=', new_user)]) - password = generate_random_pass() - if wizard_data.share_root_url: - wizard_data.share_root_url = wizard_data.share_root_url + '/openerp/login?db=%s'%(cr.dbname) + '&user=%s'%(new_user) + '&password=%s'%(password) - self.write(cr, 1, [uid], {'share_root_url': wizard_data.share_root_url}) if existing: raise osv.except_osv(_('User already exists'), _('This username (%s) already exists, perhaps data has already been shared with this person.\nYou may want to try selecting existing shared users instead.')) user_id = user_obj.create(cr, 1, { 'login': new_user, - 'password': password, + 'password': generate_random_pass(), 'name': new_user, 'user_email': new_user, 'groups_id': [(6,0,[group_id])], From c2aedebfcb7be64cc9de0f87c8879cef5321c702 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 22 Nov 2010 12:47:55 +0100 Subject: [PATCH 15/23] [IMP] cleanup JS share button/link bzr revid: xmo@openerp.com-20101122114755-00wuiehftfx3mm5t --- addons/share/web/editors.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/addons/share/web/editors.py b/addons/share/web/editors.py index 9059e841034..c628969ec8d 100644 --- a/addons/share/web/editors.py +++ b/addons/share/web/editors.py @@ -20,13 +20,15 @@ class SidebarTemplateEditor(openobject.templating.TemplateEditor): From 11d5607f05a0ec673d6a41b6e9cb82995478a682 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 22 Nov 2010 13:12:27 +0100 Subject: [PATCH 16/23] [FIX] share: naming of classes in web module bzr revid: xmo@openerp.com-20101122121227-bjx7fi4r3ospdml1 --- addons/share/web/controllers.py | 2 +- addons/share/web/editors.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/share/web/controllers.py b/addons/share/web/controllers.py index c37af991b25..4a9b5f69cb7 100644 --- a/addons/share/web/controllers.py +++ b/addons/share/web/controllers.py @@ -7,7 +7,7 @@ import cherrypy -class Piratepad(openerp.controllers.SecuredController): +class ShareWizardController(openerp.controllers.SecuredController): _cp_path = "/share" @expose() diff --git a/addons/share/web/editors.py b/addons/share/web/editors.py index c628969ec8d..06591ef36f6 100644 --- a/addons/share/web/editors.py +++ b/addons/share/web/editors.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import openobject.templating -class SidebarTemplateEditor(openobject.templating.TemplateEditor): +class ShareActionEditor(openobject.templating.TemplateEditor): templates = ['/openerp/widgets/templates/sidebar.mako'] ADD_SHARE_BUTTON = u'id="sidebar"' @@ -20,14 +20,14 @@ class SidebarTemplateEditor(openobject.templating.TemplateEditor):