[MERGE]: Merge with lp:openobject-trunk-dev-addons2

bzr revid: aag@tinyerp.co.in-20110106051259-24c6ewm2xowxepno
This commit is contained in:
aag (OpenERP) 2011-01-06 10:42:59 +05:30
commit a961a4f81f
169 changed files with 511 additions and 465 deletions

View File

@ -100,6 +100,57 @@ class account_move_line(osv.osv):
return query
def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
"""
This function returns the residual amount on a receivable or payable account.move.line.
By default, it returns an amount in the currency of this journal entry (maybe different
of the company currency), but if you pass 'residual_in_company_currency' = True in the
context then the returned amount will be in company currency.
"""
res = {}
if context is None:
context = {}
cur_obj = self.pool.get('res.currency')
for move_line in self.browse(cr, uid, ids, context=context):
res[move_line.id] = {
'amount_residual': 0.0,
'amount_residual_currency': 0.0,
}
if move_line.reconcile_id:
continue
if not move_line.account_id.type in ('payable', 'receivable'):
#this function does not suport to be used on move lines not related to payable or receivable accounts
continue
if move_line.currency_id:
move_line_total = move_line.amount_currency
sign = move_line.amount_currency < 0 and -1 or 1
else:
move_line_total = move_line.debit - move_line.credit
sign = (move_line.debit - move_line.credit) < 0 and -1 or 1
line_total_in_company_currency = move_line.debit - move_line.credit
context_unreconciled = context.copy()
if move_line.reconcile_partial_id:
for payment_line in move_line.reconcile_partial_id.line_partial_ids:
if payment_line.id == move_line.id:
continue
if payment_line.currency_id and move_line.currency_id and payment_line.currency_id.id == move_line.currency_id.id:
move_line_total += payment_line.amount_currency
else:
if move_line.currency_id:
context_unreconciled.update({'date': payment_line.date})
amount_in_foreign_currency = cur_obj.compute(cr, uid, move_line.company_id.currency_id.id, move_line.currency_id.id, (payment_line.debit - payment_line.credit), round=False, context=context_unreconciled)
move_line_total += amount_in_foreign_currency
else:
move_line_total += (payment_line.debit - payment_line.credit)
line_total_in_company_currency += (payment_line.debit - payment_line.credit)
result = move_line_total
res[move_line.id]['amount_residual_currency'] = sign * (move_line.currency_id and self.pool.get('res.currency').round(cr, uid, move_line.currency_id, result) or result)
res[move_line.id]['amount_residual'] = sign * line_total_in_company_currency
return res
def default_get(self, cr, uid, fields, context=None):
data = self._default_get(cr, uid, fields, context=context)
for f in data.keys():
@ -433,6 +484,8 @@ class account_move_line(osv.osv):
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2),
'reconcile_partial_id': fields.many2one('account.move.reconcile', 'Partial Reconcile', readonly=True, ondelete='set null', select=2),
'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry.", digits_compute=dp.get_precision('Account')),
'amount_residual_currency': fields.function(_amount_residual, method=True, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in its currency (maybe different of the company currency)."),
'amount_residual': fields.function(_amount_residual, method=True, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in the company currency."),
'currency_id': fields.many2one('res.currency', 'Currency', help="The optional other currency if it is a multi-currency entry."),
'period_id': fields.many2one('account.period', 'Period', required=True, select=2),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, select=1),
@ -676,6 +729,7 @@ class account_move_line(osv.osv):
company_list.append(line.company_id.id)
for line in self.browse(cr, uid, ids, context=context):
company_currency_id = line.company_id.currency_id
if line.reconcile_id:
raise osv.except_osv(_('Warning'), _('Already Reconciled!'))
if line.reconcile_partial_id:
@ -688,8 +742,7 @@ class account_move_line(osv.osv):
else:
unmerge.append(line.id)
total += (line.debit or 0.0) - (line.credit or 0.0)
if not total:
if self.pool.get('res.currency').is_zero(cr, uid, company_currency_id, total):
res = self.reconcile(cr, uid, merges+unmerge, context=context)
return res
r_id = move_rec_obj.create(cr, uid, {
@ -771,6 +824,19 @@ class account_move_line(osv.osv):
libelle = context['comment']
else:
libelle = _('Write-Off')
cur_obj = self.pool.get('res.currency')
cur_id = False
amount_currency_writeoff = 0.0
if context.get('company_currency_id',False) != context.get('currency_id',False):
cur_id = context.get('currency_id',False)
for line in unrec_lines:
if line.currency_id and line.currency_id.id == context.get('currency_id',False):
amount_currency_writeoff += line.amount_currency
else:
tmp_amount = cur_obj.compute(cr, uid, line.account_id.company_id.currency_id.id, context.get('currency_id',False), abs(line.debit-line.credit), context={'date': line.date})
amount_currency_writeoff += (line.debit > 0) and tmp_amount or -tmp_amount
writeoff_lines = [
(0, 0, {
'name': libelle,
@ -779,8 +845,8 @@ class account_move_line(osv.osv):
'account_id': account_id,
'date': date,
'partner_id': partner_id,
'currency_id': account.currency_id.id or False,
'amount_currency': account.currency_id.id and -currency or 0.0
'currency_id': cur_id or (account.currency_id.id or False),
'amount_currency': amount_currency_writeoff and -1 * amount_currency_writeoff or (account.currency_id.id and -1 * currency or 0.0)
}),
(0, 0, {
'name': libelle,
@ -789,7 +855,9 @@ class account_move_line(osv.osv):
'account_id': writeoff_acc_id,
'analytic_account_id': context.get('analytic_id', False),
'date': date,
'partner_id': partner_id
'partner_id': partner_id,
'currency_id': cur_id or (account.currency_id.id or False),
'amount_currency': amount_currency_writeoff and amount_currency_writeoff or (account.currency_id.id and currency or 0.0)
})
]
@ -802,6 +870,8 @@ class account_move_line(osv.osv):
})
writeoff_line_ids = self.search(cr, uid, [('move_id', '=', writeoff_move_id), ('account_id', '=', account_id)])
if account_id == writeoff_acc_id:
writeoff_line_ids = [writeoff_line_ids[1]]
ids += writeoff_line_ids
r_id = move_rec_obj.create(cr, uid, {
@ -1283,4 +1353,4 @@ class account_move_line(osv.osv):
account_move_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -489,7 +489,7 @@ msgstr "Date de création"
#. module: account
#: selection:account.journal,type:0
msgid "Purchase Refund"
msgstr "Remboursement d'achat"
msgstr "Avoir fournisseur"
#. module: account
#: selection:account.journal,type:0
@ -1632,7 +1632,7 @@ msgstr "Compte fournisseurs débiteurs"
#: field:account.tax,account_paid_id:0
#: field:account.tax.template,account_paid_id:0
msgid "Refund Tax Account"
msgstr "Compte de taxe à payer"
msgstr "Compte de taxe pour avoirs"
#. module: account
#: view:account.bank.statement:0
@ -9899,7 +9899,7 @@ msgstr "Rechercher une facture"
#: view:account.invoice.report:0
#: model:ir.actions.act_window,name:account.action_account_invoice_refund
msgid "Refund"
msgstr "Rembourser"
msgstr "Créer un avoir"
#. module: account
#: field:wizard.multi.charts.accounts,bank_accounts_id:0

View File

@ -88,32 +88,14 @@ class account_invoice(osv.osv):
return [('none', _('Free Reference'))]
def _amount_residual(self, cr, uid, ids, name, args, context=None):
res = {}
if context is None:
context = {}
cur_obj = self.pool.get('res.currency')
data_inv = self.browse(cr, uid, ids, context=context)
for inv in data_inv:
if inv.reconciled:
res[inv.id] = 0.0
continue
inv_total = inv.amount_total
context_unreconciled = context.copy()
for lines in inv.move_lines:
if lines.currency_id and lines.currency_id.id == inv.currency_id.id:
if inv.type in ('out_invoice','in_refund'):
inv_total += lines.amount_currency
else:
inv_total -= lines.amount_currency
else:
context_unreconciled.update({'date': lines.date})
amount_in_invoice_currency = cur_obj.compute(cr, uid, inv.company_id.currency_id.id, inv.currency_id.id,abs(lines.debit-lines.credit),round=False,context=context_unreconciled)
inv_total -= amount_in_invoice_currency
result = inv_total
res[inv.id] = self.pool.get('res.currency').round(cr, uid, inv.currency_id, result)
return res
result = {}
for invoice in self.browse(cr, uid, ids, context=context):
result[invoice.id] = 0.0
if invoice.move_id:
for m in invoice.move_id.line_id:
if m.account_id.type in ('receivable','payable'):
result[invoice.id] = m.amount_residual_currency
return result
# Give Journal Items related to the payment reconciled to this invoice
# Return ids of partial and total payments related to the selected invoices

View File

@ -64,8 +64,8 @@ class common_report_header(object):
def _get_target_move(self, data):
if data.get('form', False) and data['form'].get('target_move', False):
if data['form']['target_move'] == 'all':
return 'All Entries'
return 'All Posted Entries'
return _('All Entries')
return _('All Posted Entries')
return ''
def _get_end_date(self, data):
@ -94,10 +94,10 @@ class common_report_header(object):
def _get_filter(self, data):
if data.get('form', False) and data['form'].get('filter', False):
if data['form']['filter'] == 'filter_date':
return 'Date'
return _('Date')
elif data['form']['filter'] == 'filter_period':
return 'Periods'
return 'No Filter'
return _('Periods')
return _('No Filter')
def _sum_debit_period(self, period_id, journal_id=None):
journals = journal_id or self.journal_ids

View File

@ -16,98 +16,98 @@
<field name="name">Account Entry</field>
<field ref="model_account_move" name="model_id"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="account_move_line_comp_rule" model="ir.rule">
<field name="name">Entry lines</field>
<field model="ir.model" name="model_id" ref="model_account_move_line"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="journal_period_comp_rule" model="ir.rule">
<field name="name">Journal Period</field>
<field model="ir.model" name="model_id" ref="model_account_journal_period"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="journal_comp_rule" model="ir.rule">
<field name="name">Journal multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_journal"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="analytic_journal_comp_rule" model="ir.rule">
<field name="name">Analytic journal multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_analytic_journal"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="analytic_journal_comp_rule_false" model="ir.rule">
<field name="name">Analytic journal multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_analytic_journal"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="period_comp_rule" model="ir.rule">
<field name="name">Period multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_period"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="fiscal_year_comp_rule" model="ir.rule">
<field name="name">Fiscal year multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_fiscalyear"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="account_comp_rule" model="ir.rule">
<field name="name">Account multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_account"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="tax_comp_rule" model="ir.rule">
<field name="name">Tax multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_tax"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','=',user.company_id.id)]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="tax_code_comp_rule" model="ir.rule">
<field name="name">Tax code multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_tax_code"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="invoice_comp_rule" model="ir.rule">
<field name="name">Invoice multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_invoice"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="account_fiscal_position_comp_rule" model="ir.rule">
<field name="name">Account fiscal Mapping company rule</field>
<field model="ir.model" name="model_id" ref="model_account_fiscal_position"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="account_model_comp_rule" model="ir.rule">
<field name="name">Account model company rule</field>
<field model="ir.model" name="model_id" ref="model_account_model"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
</data></openerp>

View File

@ -72,7 +72,7 @@ class account_change_currency(osv.osv_memory):
new_price = (line.price_unit / old_rate ) * rate
obj_inv_line.write(cr, uid, [line.id], {'price_unit': new_price})
obj_inv.write(cr, uid, [invoice.id], {'currency_id': new_currency}, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
account_change_currency()

View File

@ -215,7 +215,7 @@ class account_fiscalyear_close(osv.osv_memory):
cr.execute('UPDATE account_fiscalyear ' \
'SET end_journal_period_id = %s ' \
'WHERE id = %s', (ids[0], old_fyear.id))
return {}
return {'type': 'ir.actions.act_window_close'}
account_fiscalyear_close()

View File

@ -57,7 +57,7 @@ class account_fiscalyear_close_state(osv.osv_memory):
fy_pool = self.pool.get('account.fiscalyear')
fy_code = fy_pool.browse(cr, uid, fy_id, context=context).code
fy_pool.log(cr, uid, fy_id, "Fiscal year '%s' is closed, no more modification allowed." % (fy_code))
return {}
return {'type': 'ir.actions.act_window_close'}
account_fiscalyear_close_state()

View File

@ -43,7 +43,7 @@ class account_invoice_confirm(osv.osv_memory):
if record['state'] not in ('draft','proforma','proforma2'):
raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!"))
wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_open', cr)
return {}
return {'type': 'ir.actions.act_window_close'}
account_invoice_confirm()
@ -67,7 +67,7 @@ class account_invoice_cancel(osv.osv_memory):
if record['state'] in ('cancel','paid'):
raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!"))
wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_cancel', cr)
return {}
return {'type': 'ir.actions.act_window_close'}
account_invoice_cancel()

View File

@ -42,7 +42,7 @@ class account_open_closed_fiscalyear(osv.osv_memory):
ids_move = move_obj.search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
if ids_move:
cr.execute('delete from account_move where id IN %s', (tuple(ids_move),))
return {}
return {'type': 'ir.actions.act_window_close'}
account_open_closed_fiscalyear()

View File

@ -50,7 +50,7 @@ class account_period_close(osv.osv_memory):
# Log message for Period
for period_id, name in period_pool.name_get(cr, uid, [id]):
period_pool.log(cr, uid, period_id, "Period '%s' is closed, no more modification allowed for this period." % (name))
return {}
return {'type': 'ir.actions.act_window_close'}
account_period_close()

View File

@ -101,7 +101,7 @@ class account_move_line_reconcile(osv.osv_memory):
context.update({'stop_reconcile': True})
account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
period_id, journal_id, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
account_move_line_reconcile()
@ -145,7 +145,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
if context is None:
context = {}
account_move_line_obj.reconcile_partial(cr, uid, context['active_ids'], 'manual', context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
def trans_rec_reconcile(self, cr, uid, ids, context=None):
account_move_line_obj = self.pool.get('account.move.line')
@ -169,7 +169,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
context.update({'stop_reconcile': True})
account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
period_id, journal_id, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
account_move_line_reconcile_writeoff()

View File

@ -83,7 +83,7 @@ class account_partner_reconcile_process(osv.osv_memory):
res_partner_obj.write(cr, uid, partner_id[0], {'last_reconciliation_date': time.strftime('%Y-%m-%d')}, context)
#TODO: we have to find a way to update the context of the current tab (we could open a new tab with the context but it's not really handy)
#TODO: remove that comments when the client side dev is done
return {}
return {'type': 'ir.actions.act_window_close'}
_columns = {
'to_reconcile': fields.float('Remaining Partners', readonly=True, help='This is the remaining partners for who you should check if there is something to reconcile or not. This figure already count the current partner as reconciled.'),

View File

@ -19,8 +19,6 @@
#
##############################################################################
from lxml import etree
from osv import osv
class account_balance_report(osv.osv_memory):
@ -38,4 +36,4 @@ class account_balance_report(osv.osv_memory):
account_balance_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -22,8 +22,6 @@
import time
from datetime import datetime
from dateutil.relativedelta import relativedelta
from lxml import etree
from osv import osv, fields
from tools.translate import _

View File

@ -19,8 +19,6 @@
#
##############################################################################
from lxml import etree
from osv import osv, fields
from tools.translate import _
@ -86,4 +84,4 @@ class account_bs_report(osv.osv_memory):
account_bs_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -19,8 +19,6 @@
#
##############################################################################
from lxml import etree
from osv import osv, fields
class account_pl_report(osv.osv_memory):
@ -60,4 +58,4 @@ class account_pl_report(osv.osv_memory):
account_pl_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -37,7 +37,7 @@ class account_state_open(osv.osv_memory):
raise osv.except_osv(_('Warning'), _('Invoice is already reconciled'))
wf_service = netsvc.LocalService("workflow")
res = wf_service.trg_validate(uid, 'account.invoice', context['active_ids'][0], 'open_test', cr)
return {}
return {'type': 'ir.actions.act_window_close'}
account_state_open()

View File

@ -31,7 +31,7 @@ class account_unreconcile(osv.osv_memory):
context = {}
if context.get('active_ids', False):
obj_move_line._remove_move_reconcile(cr, uid, context['active_ids'], context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
account_unreconcile()
@ -46,7 +46,7 @@ class account_unreconcile_reconcile(osv.osv_memory):
rec_ids = context['active_ids']
if rec_ids:
obj_move_reconcile.unlink(cr, uid, rec_ids, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
account_unreconcile_reconcile()

View File

@ -38,7 +38,7 @@ class validate_account_move(osv.osv_memory):
if not ids_move:
raise osv.except_osv(_('Warning'), _('Specified Journal does not have any account move entries in draft state for this period'))
obj_move.button_validate(cr, uid, ids_move, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
validate_account_move()
@ -60,7 +60,7 @@ class validate_account_move_lines(osv.osv_memory):
if not move_ids:
raise osv.except_osv(_('Warning'), _('Selected Entry Lines does not have any account move enties in draft state'))
obj_move.button_validate(cr, uid, move_ids, context)
return {}
return {'type': 'ir.actions.act_window_close'}
validate_account_move_lines()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -53,7 +53,7 @@ class analytic_plan_create_model(osv.osv_memory):
'target': 'new',
}
else:
return {}
return {'type': 'ir.actions.act_window_close'}
analytic_plan_create_model()

View File

@ -21,7 +21,7 @@
#
##############################################################################
from osv import fields, osv
from osv import osv
class account_invoice_line(osv.osv):
_inherit = "account.invoice.line"

View File

@ -6,21 +6,21 @@
<field name="name">Budget post multi-company</field>
<field name="model_id" ref="model_account_budget_post"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="budget_comp_rule" model="ir.rule">
<field name="name">Budget multi-company</field>
<field name="model_id" ref="model_crossovered_budget"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="budget_lines_comp_rule" model="ir.rule">
<field name="name">Budget lines multi-company</field>
<field name="model_id" ref="model_crossovered_budget_lines"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
</data>

View File

@ -5,7 +5,7 @@
<field name="name">Account Coda model company rule</field>
<field model="ir.model" name="model_id" ref="model_account_coda"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
</data></openerp>

View File

@ -10,7 +10,7 @@
<field name="name">Payment Mode company rule</field>
<field model="ir.model" name="model_id" ref="model_payment_mode"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
</data>

View File

@ -65,7 +65,7 @@ class payment_order_create(osv.osv_memory):
data = self.read(cr, uid, ids, [], context=context)[0]
line_ids = data['entries']
if not line_ids:
return {}
return {'type': 'ir.actions.act_window_close'}
payment = order_obj.browse(cr, uid, context['active_id'], context=context)
t = None
@ -90,7 +90,7 @@ class payment_order_create(osv.osv_memory):
'date': date_to_pay,
'currency': line.invoice and line.invoice.currency_id.id or False,
}, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
def search_entries(self, cr, uid, ids, context=None):
line_obj = self.pool.get('account.move.line')

View File

@ -37,7 +37,7 @@ class account_payment_make_payment(osv.osv_memory):
# obj_act = self.pool.get('ir.actions.act_window')
# order = obj_payment_order.browse(cr, uid, context['active_id'], context)
obj_payment_order.set_done(cr, uid, [context['active_id']], context)
return {}
return {'type': 'ir.actions.act_window_close'}
# t = order.mode and order.mode.type.code or 'manual'
# if t == 'manual':
# obj_payment_order.set_done(cr,uid,context['active_id'],context)

View File

@ -65,7 +65,7 @@ class account_payment_populate_statement(osv.osv_memory):
data = self.read(cr, uid, ids, [], context=context)[0]
line_ids = data['lines']
if not line_ids:
return {}
return {'type': 'ir.actions.act_window_close'}
statement = statement_obj.browse(cr, uid, context['active_id'], context=context)

View File

@ -27,25 +27,6 @@ from osv import osv, fields
import decimal_precision as dp
from tools.translate import _
class account_move_line(osv.osv):
_inherit = 'account.move.line'
def _unreconciled(self, cr, uid, ids, prop, unknow_none, context=None):
res = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id] = line.debit - line.credit
if line.reconcile_partial_id:
res[line.id] = 0
for partial in line.reconcile_partial_id.line_partial_ids:
res[line.id] += partial.debit - partial.credit
res[line.id] = abs(res[line.id])
return res
_columns = {
'amount_unreconciled': fields.function(_unreconciled, method=True, string='Unreconciled Amount'),
}
account_move_line()
class account_voucher(osv.osv):
@ -165,6 +146,8 @@ class account_voucher(osv.osv):
return abs(amount - abs(credit - debit))
def onchange_line_ids(self, cr, uid, ids, line_dr_ids, line_cr_ids, amount):
if not line_dr_ids and not line_cr_ids:
return {'value':{}}
line_dr_ids = [x[2] for x in line_dr_ids]
line_cr_ids = [x[2] for x in line_cr_ids]
return {'value': {'writeoff_amount': self._compute_writeoff_amount(cr, uid, line_dr_ids, line_cr_ids, amount)}}
@ -491,31 +474,32 @@ class account_voucher(osv.osv):
continue
total_credit += line.credit or 0.0
total_debit += line.debit or 0.0
for line in moves:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
continue
if line.debit and line.reconcile_partial_id and ttype == 'payment':
continue
original_amount = line.credit or line.debit or 0.0
amount_unreconciled = currency_pool.compute(cr, uid, line.currency_id and line.currency_id.id or company_currency, currency_id, abs(line.amount_residual_currency), context=context_multi_currency)
rs = {
'name':line.move_id.name,
'type': line.credit and 'dr' or 'cr',
'move_line_id':line.id,
'account_id':line.account_id.id,
'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, original_amount, context=context_multi_currency),
'amount_original': currency_pool.compute(cr, uid, line.currency_id and line.currency_id.id or company_currency, currency_id, line.currency_id and abs(line.amount_currency) or original_amount, context=context_multi_currency),
'date_original':line.date,
'date_due':line.date_maturity,
'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled, context=context_multi_currency)
'amount_unreconciled': amount_unreconciled,
}
if line.credit:
amount = min(line.amount_unreconciled, total_debit)
rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount, context=context_multi_currency)
amount = min(amount_unreconciled, currency_pool.compute(cr, uid, company_currency, currency_id, abs(total_debit), context=context_multi_currency))
rs['amount'] = amount
total_debit -= amount
else:
amount = min(line.amount_unreconciled, total_credit)
rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount, context=context_multi_currency)
amount = min(amount_unreconciled, currency_pool.compute(cr, uid, company_currency, currency_id, abs(total_credit), context=context_multi_currency))
rs['amount'] = amount
total_credit -= amount
default['value']['line_ids'].append(rs)
@ -687,6 +671,7 @@ class account_voucher(osv.osv):
debit = -credit
credit = 0.0
sign = debit - credit < 0 and -1 or 1
#create the first line of the voucher
move_line = {
'name': inv.name or '/',
'debit': debit,
@ -701,9 +686,7 @@ 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)
move_line_pool.create(cr, uid, move_line)
rec_list_ids = []
line_total = debit - credit
if inv.type == 'sale':
@ -712,9 +695,14 @@ class account_voucher(osv.osv):
line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount, context=context_multi_currency)
for line in inv.line_ids:
#create one move line per voucher line where amount is not 0.0
if not line.amount:
continue
amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency)
#we check if the voucher line is fully paid or not and create a move line to balance the payment and initial invoice if needed
if line.amount == line.amount_unreconciled:
amount = line.move_line_id.amount_residual #residual amount in company currency
else:
amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency)
move_line = {
'journal_id': inv.journal_id.id,
'period_id': inv.period_id.id,
@ -753,9 +741,9 @@ class account_voucher(osv.osv):
raise osv.except_osv(_('No Account Base Code and Account Tax Code!'),_("You have to configure account base code and account tax code on the '%s' tax!") % (tax_data.name))
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)
voucher_line = move_line_pool.create(cr, uid, move_line)
if line.move_line_id.id:
rec_ids = [master_line, line.move_line_id.id]
rec_ids = [voucher_line, line.move_line_id.id]
rec_list_ids.append(rec_ids)
if not currency_pool.is_zero(cr, uid, inv.currency_id, line_total):
@ -764,7 +752,6 @@ class account_voucher(osv.osv):
if inv.payment_option == 'with_writeoff':
account_id = inv.writeoff_acc_id.id
elif inv.type in ('sale', 'receipt'):
# if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'):
account_id = inv.partner_id.property_account_receivable.id
else:
account_id = inv.partner_id.property_account_payable.id
@ -776,12 +763,11 @@ class account_voucher(osv.osv):
'date': inv.date,
'credit': diff > 0 and diff or 0.0,
'debit': diff < 0 and -diff or 0.0,
'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
'currency_id': company_currency <> current_currency and current_currency or False,
#'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
#'currency_id': company_currency <> current_currency and current_currency or False,
}
move_line_pool.create(cr, uid, move_line)
self.write(cr, uid, [inv.id], {
'move_id': move_id,
'state': 'posted',
@ -817,6 +803,8 @@ class account_voucher_line(osv.osv):
currency_pool = self.pool.get('res.currency')
rs_data = {}
for line in self.browse(cr, uid, ids, context=context):
ctx = context.copy()
ctx.update({'date': line.voucher_id.date})
res = {}
company_currency = line.voucher_id.journal_id.company_id.currency_id.id
voucher_currency = line.voucher_id.currency_id.id
@ -826,13 +814,15 @@ class account_voucher_line(osv.osv):
res['amount_original'] = 0.0
res['amount_unreconciled'] = 0.0
elif move_line.currency_id:
res['amount_original'] = currency_pool.compute(cr, uid, move_line.currency_id.id, voucher_currency, move_line.amount_currency, context=ctx)
elif move_line and move_line.credit > 0:
res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit)
res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit, context=ctx)
else:
res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.debit)
res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.debit, context=ctx)
if move_line:
res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.amount_unreconciled)
res['amount_unreconciled'] = currency_pool.compute(cr, uid, move_line.currency_id and move_line.currency_id.id or company_currency, voucher_currency, abs(move_line.amount_residual_currency), context=ctx)
rs_data[line.id] = res
return rs_data

View File

@ -17,11 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import fields, osv
import pooler
from tools import config
import tools
class sale_receipt_report(osv.osv):

View File

@ -5,13 +5,13 @@
<field name="name">Voucher multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_voucher"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="voucher_line_comp_rule" model="ir.rule">
<field name="name">Voucher Line multi-company</field>
<field model="ir.model" name="model_id" ref="model_account_voucher_line"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
</data>
</openerp>

View File

@ -3,7 +3,7 @@
-
!record {model: account.voucher, id: account_voucher_seagate_0}:
account_id: account.a_recv
amount: 0.0
amount: 30000.0
company_id: base.main_company
currency_id: base.EUR
journal_id: account.sales_journal
@ -13,7 +13,6 @@
type: cr
partner_id: base.res_partner_seagate
period_id: account.period_9
tax_amount: 0.0
type: sale
-

View File

@ -89,13 +89,13 @@
<form string="Bill Payment">
<group col="6" colspan="4">
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="journal_id"
domain="[('type','in',['bank', 'cash'])]"
widget="selection" select="1"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
string="Payment Method"/>
<field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="2"/>
<field name="account_id"
@ -152,13 +152,13 @@
<form string="Bill Payment">
<group col="6" colspan="4">
<field name="partner_id" domain="[('supplier','=',True)]" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" context="{'invoice_currency':currency_id}" string="Supplier"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="journal_id"
domain="[('type','in',['bank', 'cash'])]"
widget="selection" select="1"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
string="Payment Method"/>
<field name="amount" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="2"/>
<field name="account_id"
@ -199,9 +199,9 @@
<group col="2" colspan="1">
<group col="2" colspan="1">
<separator string="Payment Options" colspan="2"/>
<field name="payment_option" required="1"/>
<field name="writeoff_amount"
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"/>
<field name="payment_option" required="1"/>
<field name="writeoff_acc_id"
attrs="{'invisible':[('payment_option','!=','with_writeoff')], 'required':[('payment_option','=','with_writeoff')]}"
domain="[('type','=','other')]"/>
@ -211,6 +211,7 @@
attrs="{'invisible':[('payment_option','!=','with_writeoff')]}"
groups="analytic.group_analytic_accounting"/>
</group>
<separator string="Other Information" colspan="2"/>
<group col="4" colspan="1">
<field name="currency_id" invisible="True"/>
<field name="number"/>
@ -236,6 +237,8 @@
<field name="credit"/>
<field name="state"/>
<field name="reconcile_id"/>
<field name="amount_currency"/>
<field name="currency_id"/>
</tree>
</field>
</page>
@ -286,15 +289,15 @@
<form string="Customer Payment">
<group col="6" colspan="4">
<field name="partner_id" required="1" on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)" string="Customer"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="amount"
string="Paid Amount"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="journal_id"
domain="[('type','in',['bank', 'cash'])]"
widget="selection" select="1"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"
string="Payment Method"/>
<field name="amount"
string="Paid Amount"
on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="date" select="1" on_change="onchange_date(partner_id, journal_id, amount, currency_id, type, date)"/>
<field name="reference" select="1" string="Payment Ref"/>
<field name="name" colspan="2"/>
<field name="account_id"
@ -373,6 +376,8 @@
<field name="credit"/>
<field name="state"/>
<field name="reconcile_id"/>
<field name="amount_currency"/>
<field name="currency_id"/>
</tree>
</field>
</page>

View File

@ -39,11 +39,11 @@ class account_statement_from_invoice_lines(osv.osv_memory):
context = {}
statement_id = context.get('statement_id', False)
if not statement_id:
return {}
return {'type': 'ir.actions.act_window_close'}
data = self.read(cr, uid, ids, context=context)[0]
line_ids = data['line_ids']
if not line_ids:
return {}
return {'type': 'ir.actions.act_window_close'}
line_obj = self.pool.get('account.move.line')
statement_obj = self.pool.get('account.bank.statement')
@ -115,7 +115,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
'voucher_id': voucher_id,
'date': time.strftime('%Y-%m-%d'), #time.strftime('%Y-%m-%d'), #line.date_maturity or,
}, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
account_statement_from_invoice_lines()

View File

@ -55,7 +55,7 @@ class account_voucher_unreconcile(osv.osv_memory):
# wf_service = netsvc.LocalService("workflow")
# wf_service.trg_validate(uid, 'account.voucher', context.get('active_id'), 'cancel_voucher', cr)
return {}
return {'type': 'ir.actions.act_window_close'}
account_voucher_unreconcile()

View File

@ -5,7 +5,7 @@
<field name="name">Analytic multi company rule</field>
<field model="ir.model" name="model_id" ref="model_account_analytic_account"/>
<field eval="True" name="global"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('company_id','=',False),('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
</record>
<record id="group_analytic_accounting" model="res.groups" context="{'noadmin':True}">
<field name="name">Useability / Analytic Accounting</field>

View File

@ -220,7 +220,7 @@ class auction_lots_send_aie(osv.osv_memory):
def send_pdf(self, cr, uid, ids, context=None):
threaded_calculation = threading.Thread(target=self._send, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}
return {'type': 'ir.actions.act_window_close'}
auction_lots_send_aie()

View File

@ -137,7 +137,7 @@ class auction_lots_pay(osv.osv_memory):
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','obj_price'])
args = pickle.dumps(lots)
self._catalog_send(datas['uname'], datas['password'], datas['dates'], args)
return {}
return {'type': 'ir.actions.act_window_close'}
auction_lots_pay()

View File

@ -41,6 +41,6 @@ class auction_lots_able(osv.osv_memory):
if context is None:
context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'ach_emp':True})
return {}
return {'type': 'ir.actions.act_window_close'}
auction_lots_able()

View File

@ -52,7 +52,7 @@ class auction_lots_auction_move(osv.osv_memory):
rec_ids = auction_lots_obj.browse(cr, uid, context.get('active_ids', []))
for current in self.browse(cr, uid, ids, context=context):
if not (current.auction_id and len(context.get('active_ids', []))):
return {}
return {'type': 'ir.actions.act_window_close'}
for rec in rec_ids:
new_id = auction_lot_history_obj.create(cr, uid, {
@ -70,7 +70,7 @@ class auction_lots_auction_move(osv.osv_memory):
'sel_inv_id': None,
'obj_num': None,
'state': 'draft'})
return {}
return {'type': 'ir.actions.act_window_close'}
auction_lots_auction_move()

View File

@ -90,7 +90,7 @@ class wiz_auc_lots_buyer_map(osv.osv_memory):
for lots in lots_obj.browse(cr, uid, rec_ids, context=context):
if lots.ach_login == current.ach_login:
lots_obj.write(cr, uid, [lots.id], {'ach_uid': current.ach_uid.id}, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
context=None, toolbar=False, submenu=False):

View File

@ -49,7 +49,7 @@ class auction_lots_cancel(osv.osv):
supplier_refund_inv_id = invoice_obj.refund(cr, uid, [lot.ach_inv_id.id])
if lot.sel_inv_id:
customer_refund_inv_id = invoice_obj.refund(cr, uid, [lot.sel_inv_id.id])
return {}
return {'type': 'ir.actions.act_window_close'}
_columns = {
}

View File

@ -38,6 +38,6 @@ class auction_lots_enable(osv.osv_memory):
if context is None:
context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_id',False), {'ach_emp':False})
return {}
return {'type': 'ir.actions.act_window_close'}
auction_lots_enable()

View File

@ -178,7 +178,7 @@ class auction_lots_numerotate(osv.osv_memory):
for rec_id in rec_ids:
lots_obj.write(cr, uid, [rec_id.id], {'obj_num':nbr})
nbr+=1
return {}
return {'type': 'ir.actions.act_window_close'}
auction_lots_numerotate()

View File

@ -100,7 +100,7 @@ class auction_pay_buy(osv.osv_memory):
})
for lot in lots:
lot_obj.write(cr, uid, [lot.id], {'statement_id':[(4, new_id)]})
return {}
return {'type': 'ir.actions.act_window_close'}
auction_pay_buy()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -52,6 +52,6 @@ class auction_pay_sel(osv.osv_memory):
journal_id = datas.get('journal_id', False)
if lot.sel_inv_id:
p = invoice_obj.pay_and_reconcile(['lot.sel_inv_id.id'], datas['amount'], datas['dest_account_id'], journal_id, account_id, period_id, journal_id, context)
return {}
return {'type': 'ir.actions.act_window_close'}
auction_pay_sel()

View File

@ -29,7 +29,7 @@ class auction_payer(osv.osv_memory):
if context is None:
context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'is_ok':True, 'state':'paid'})
return {}
return {'type': 'ir.actions.act_window_close'}
auction_payer()
@ -50,7 +50,7 @@ class auction_payer_sel(osv.osv_memory):
if context is None:
context = {}
self.pool.get('auction.lots').write(cr, uid, context.get('active_ids', []), {'paid_vnd':True})
return {}
return {'type': 'ir.actions.act_window_close'}
auction_payer_sel()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -82,6 +82,6 @@ class auction_transfer_unsold_object(osv.osv):
'ach_inv_id':None,
'sel_inv_id':None,
'state':'draft'})
return {}
return {'type': 'ir.actions.act_window_close'}
auction_transfer_unsold_object()

View File

@ -20,7 +20,7 @@
##############################################################################
from osv import fields, osv
from osv.osv import osv_pool
from osv.osv import osv_pool, object_proxy
from tools.translate import _
import ir
import pooler
@ -184,7 +184,7 @@ class audittrail_log_line(osv.osv):
audittrail_log_line()
class audittrail_objects_proxy(osv_pool):
class audittrail_objects_proxy(object_proxy):
""" Uses Object proxy for auditing changes on object of subscribed Rules"""
def get_value_text(self, cr, uid, field_name, values, model, context=None):

View File

@ -1150,8 +1150,9 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
('weekly', 'Weeks'),
('monthly', 'Months'),
('yearly', 'Years'), ], 'Frequency'),
'interval': fields.integer('Interval', help="Repeat every (Days/Week/Month/Year)"),
'end_type' : fields.selection([('forever', 'Forever'), ('count', 'Fix amout of times'), ('end_date','End date')], 'Way to end reccurency'),
'interval': fields.integer('Repeat every', help="Repeat every (Days/Week/Month/Year)"),
'count': fields.integer('Repeat', help="Repeat x times"),
'mo': fields.boolean('Mon'),
'tu': fields.boolean('Tue'),
@ -1189,6 +1190,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
return res
_defaults = {
'end_type' : 'forever',
'state': 'tentative',
'class': 'public',
'show_as': 'busy',

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Attendee form view-->
<!-- Attendee form view-->
<record id="base_calendar_attendee_form_view" model="ir.ui.view">
<field name="name">calendar.attendee.form</field>
@ -348,18 +347,21 @@
<group col="4" colspan="4" name="rrule">
<group col="4" colspan="4">
<field name="rrule_type" string="Recurrency period"
attrs="{'readonly':[('recurrent_uid','!=',False)]}" />
<label string="" colspan="2"/>
attrs="{'readonly':[('recurrent_uid','!=',False)]}" />
<field name="interval" />
<separator string="End of recurrency" colspan="4"/>
<field name="count" attrs="{'readonly': [('end_date','!=',False)]}"/>
<field name="end_type" />
<label string=" " colspan="2" />
<newline />
<field name="end_date" attrs="{'readonly': [('count','!=',False)]}"/>
<field name="count" attrs="{'invisible' : [('end_type', '!=', 'count')] }"/>
<label string=" " colspan="2" />
<newline />
<field name="end_date" attrs="{'invisible' : [('end_type', '!=', 'end_date')] }"/>
<newline />
<separator string="Repeat interval" colspan="4"/>
<field name="interval" /> <label string="" colspan="2"/>
</group>
<group col="8" colspan="4" name="Select weekdays" attrs="{'invisible' :[('rrule_type','not in', ['weekly'])]}">
<separator string="Choose day where repeat the meeting" colspan="8"/>
@ -379,13 +381,13 @@
<group col="2" colspan="1">
<field name="select1" />
</group>
<group col="2" colspan="1"
attrs="{'invisible' : [('select1','=','day')]}">
<group col="2" colspan="1">
<field name="day"
attrs="{'required' : [('select1','=','date'), ('rrule_type','=','monthly')]}" />
attrs="{'required' : [('select1','=','date'), ('rrule_type','=','monthly')],
'invisible' : ['|', ('select1','=','day'), ('rrule_type','!=','monthly')]}" />
</group>
<group col="3" colspan="1"
attrs="{'invisible' : [('select1','=','date'), ('rrule_type','=','monthly')]}">
attrs="{'invisible' : ['|', ('select1','=','date'), ('rrule_type','!=','monthly')]}">
<field name="byday" string="The"
attrs="{'required' : [('select1','=','day'), ('rrule_type','=','monthly')]}" />
<field name="week_list" nolabel="1"

View File

@ -68,7 +68,7 @@ send an Email to Invited Person')
model = False
context_id = context and context.get('active_id', False) or False
if not context or not context.get('model'):
return {}
return {'type': 'ir.actions.act_window_close'}
else:
model = context.get('model')
@ -89,7 +89,7 @@ send an Email to Invited Person')
if context_id:
ref = {'ref': '%s,%s' % (model, base_calendar.base_calendar_id2real_id(context_id))}
else:
return {}
return {'type': 'ir.actions.act_window_close'}
if type == 'internal':
if not datas.get('user_ids'):
@ -144,7 +144,7 @@ send an Email to Invited Person')
att_obj._send_mail(cr, uid, attendees, mail_to, \
email_from = current_user.user_email or tools.config.get('email_from', False))
return {}
return {'type': 'ir.actions.act_window_close'}
def onchange_partner_id(self, cr, uid, ids, partner_id, *args, **argv):

View File

@ -150,7 +150,7 @@ class base_calendar_set_exrule(osv.osv_memory):
+ enddate + monthstring + yearstring
model_obj.write(cr, uid, ex_id,{'exrule': exrule_string})
return {}
return {'type': 'ir.actions.act_window_close'}
_defaults = {
'freq': lambda *x: 'None',

View File

@ -78,7 +78,7 @@ class calendar_event_edit_all(osv.osv_memory):
model = context.get('model', False)
model_obj = self.pool.get(model)
model_obj.modify_all(cr, uid, [context_id], datas, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
_name = "calendar.event.edit.all"
_description = "Calendar Edit all event"

View File

@ -40,9 +40,7 @@ from random import seed, sample
from string import letters, digits
from osv import fields,osv
import pooler
import tools
from tools.translate import _
from service import security
magic_md5 = '$1$'

View File

@ -35,7 +35,7 @@ def _get_graph(self, cr, uid, datas, context=None):
module_data = mod_obj.get_relation_graph(cr, uid, module.name, context=context)
if module_data['module_file']:
mod_obj.write(cr, uid, [module.id], {'file_graph': module_data['module_file']}, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
class create_graph(wizard.interface):
states = {

View File

@ -100,7 +100,7 @@ def _record_objects(self, cr, uid, data, context):
for s_id in search_ids:
args=(cr.dbname,uid,obj_name,'copy',s_id,{},context)
mod.recording_data.append(('query',args, {}, s_id))
return {}
return {'type': 'ir.actions.act_window_close'}
def _check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)

View File

@ -90,7 +90,7 @@ def _record_objects(self, cr, uid, data, context):
for s_id in search_ids:
args=(cr.dbname,uid,obj_name,'copy',s_id,{},context)
mod.recording_data.append(('query',args, {}, s_id))
return {}
return {'type': 'ir.actions.act_window_close'}
def inter_call(self,cr,uid,data,context):
res=base_module_save._create_module(self,cr, uid, data, context)

View File

@ -196,7 +196,6 @@ class report_creator(osv.osv):
res = super(report_creator, self).read(cr, user, ids, fields, context, load)
if (not context) or 'report_id' not in context:
return res
ctx = context or {}
wp = ''
for data in res:
if not data.get('sql_query'):

View File

@ -49,7 +49,7 @@ class report_menu_create(osv.osv_memory):
if context_id:
data = self.browse(cr, uid, ids, context=context)
if not data:
return {}
return {'type': 'ir.actions.act_window_close'}
data = data[0]
board = obj_board.browse(cr, uid, context_id, context=context)
@ -77,7 +77,7 @@ class report_menu_create(osv.osv_memory):
'action': 'ir.actions.act_window, ' + str(action_id)
}, context=context)
obj_board.write(cr, uid, context_id, {'menu_id': menu_id})
return {}
return {'type': 'ir.actions.act_window_close'}
report_menu_create()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -145,7 +145,7 @@ def _set_filter_value(self, cr, uid, data, context):
'condition' : form_data['condition']
}
pooler.get_pool(cr.dbname).get('base_report_creator.report.filter').create(cr,uid,create_dict,context)
return {}
return {'type': 'ir.actions.act_window_close'}
def _set_form_value(self, cr, uid, data, context):
field_id = data['form']['field_id']
@ -199,7 +199,7 @@ def _set_operator(self, cr, uid, data, context):
elif field.ttype in ('boolean', 'selection'):
operator.append(('=','Equals'))
operator.append(('<>','Not Equals'))
return {}
return {'type': 'ir.actions.act_window_close'}
class set_filter_fields(wizard.interface):
states = {

View File

@ -36,8 +36,7 @@ upload the report using the same wizard.
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'depends': ['base'],
'init_xml': ['security/base_report_security.xml',
'wizard/base_report_design_view.xml'],
'init_xml': ['wizard/base_report_design_view.xml'],
'update_xml': ['base_report_designer_installer.xml'],
'demo_xml': [],
'installable': True,

View File

@ -344,7 +344,6 @@ if __name__ == "__main__":
parser.error("incorrect number of arguments")
import sys
import StringIO
fname = sys.argv[1]
f = fname

View File

@ -140,28 +140,16 @@ class ServerParameter( unohelper.Base, XJobExecutor ):
ErrorDialog("Connection Refuse...","Please enter valid Login/Password")
self.win.endExecute()
try:
ids = self.sock.execute(sDatabase,UID,sPassword, 'res.groups' , 'search', [('name','=','OpenOfficeReportDesigner')])
ids_module =self.sock.execute(sDatabase, UID, sPassword, 'ir.module.module', 'search', [('name','=','base_report_designer'),('state', '=', 'installed')])
dict_groups =self.sock.execute(sDatabase, UID,sPassword, 'res.groups' , 'read',ids,['users'])
except :
import traceback,sys
info = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
self.logobj.log_write('ServerParameter', LOG_ERROR, info)
if not len(ids) :
ErrorDialog("Group Not Found!!! Create a group named \n\n"'"OpenOfficeReportDesigner"'" \n\n ","","Group Name Error")
self.logobj.log_write('Group Error',LOG_WARNING, ':Create a group OpenOfficeReportDesigner using database %s' % (sDatabase))
self.win.endExecute()
if not len(ids_module):
ErrorDialog("Please Install base_report_designer module", "", "Module Uninstalled Error")
self.logobj.log_write('Module Not Found',LOG_WARNING, ':base_report_designer not install in database %s' % (sDatabase))
self.win.endExecute()
if UID not in dict_groups[0]['users']:
ErrorDialog("Connection Refuse...","You have not access these Report Designer")
self.logobj.log_write('Connection Refuse',LOG_WARNING, " Not Access Report Designer ")
self.win.endExecute()
else:
desktop=getDesktop()
doc = desktop.getCurrentComponent()

View File

@ -1,22 +0,0 @@
<?xml version="1.0" ?>
<openerp>
<data noupdate="1">
<record id="res_groups_openofficereportdesigner0" model="res.groups">
<field eval="[(6,0,[])]" name="menu_access"/>
<field eval="[(6,0,[])]" name="rule_groups"/>
<field eval="[(6,0,[ref('base.user_root')])]" name="users"/>
<field eval="&quot;&quot;&quot;OpenOfficeReportDesigner&quot;&quot;&quot;" name="name"/>
</record>
<record id="ir_model_access_openofficereportdesigner0" model="ir.model.access">
<field name="model_id" ref="base.model_ir_actions_report_xml"/>
<field eval="1" name="perm_read"/>
<field eval="&quot;&quot;&quot;OpenOfficeReportDesigner&quot;&quot;&quot;" name="name"/>
<field eval="1" name="perm_unlink"/>
<field eval="1" name="perm_write"/>
<field eval="1" name="perm_create"/>
<field name="group_id" ref="res_groups_openofficereportdesigner0"/>
</record>
</data>
</openerp>

View File

@ -171,7 +171,7 @@ class res_currency(osv.osv):
if isinstance(ids, (int, long)):
ids = [ids]
reads = self.read(cr, uid, ids, ['name','symbol'], context, load='_classic_write')
return [(x['id'], tools.ustr(x['name']) + ' (' + tools.ustr(x['symbol']) + ')') for x in reads]
return [(x['id'], tools.ustr(x['name']) + (x['symbol'] and (' (' + tools.ustr(x['symbol']) + ')') or '')) for x in reads]
res_currency()

View File

@ -4,5 +4,6 @@
"access_board_note_type","board.note.type","model_board_note_type","base.group_user",1,1,1,1
"access_board_note","board.note","model_board_note","base.group_user",1,1,1,1
"access_board_board_sale_salesman","board.board.sale.salesman","model_board_board","base.group_sale_salesman",1,1,1,1
"access_res_log_report","res.log.report","model_res_log_report","base.group_user",1,1,1,1
"access_res_log_report_system","res.log.report system","model_res_log_report",base.group_system,1,0,0,0
"access_res_log_report_erp_manager","res.log.report erp_manager","model_res_log_report",base.group_erp_manager,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
4 access_board_note_type board.note.type model_board_note_type base.group_user 1 1 1 1
5 access_board_note board.note model_board_note base.group_user 1 1 1 1
6 access_board_board_sale_salesman board.board.sale.salesman model_board_board base.group_sale_salesman 1 1 1 1
7 access_res_log_report res.log.report model_res_log_report base.group_user 1 1 1 1
8 access_res_log_report_system res.log.report system model_res_log_report base.group_system 1 0 0 0
9 access_res_log_report_erp_manager res.log.report erp_manager model_res_log_report base.group_erp_manager 1 0 0 0

View File

@ -78,7 +78,7 @@ class board_menu_create(osv.osv_memory):
'action': 'ir.actions.act_window,' + str(action_id)
}, context=context)
#End Loop
return {}
return {'type': 'ir.actions.act_window_close'}
_name = "board.menu.create"
_description = "Menu Create"

View File

@ -125,7 +125,7 @@ class crm_lead(crm_case, osv.osv):
'channel_id': fields.many2one('res.partner.canal', 'Channel'),
'contact_name': fields.char('Contact Name', size=64),
'partner_name': fields.char("Customer Name", size=64),
'partner_name': fields.char("Customer Name", size=64,help='The name of the future partner that will be created while converting the into opportunity'),
'optin': fields.boolean('Opt-In', help="If opt-in is checked, this contact has accepted to receive emails."),
'optout': fields.boolean('Opt-Out', help="If opt-out is checked, this contact has refused to receive emails or unsubscribed to a campaign."),
'type':fields.selection([

View File

@ -57,8 +57,8 @@
help="Convert to Opportunity" icon="gtk-go-forward"
type="object"/>
<newline />
<field name="section_id" widget="selection" />
<field name="user_id" />
<field name="section_id" widget="selection" />
<field name="stage_id" domain="[('type','=','lead'),('section_ids', '=', section_id)]" />
<group col="2" colspan="1">
<button name="stage_previous" string=""
@ -89,7 +89,7 @@
<field name="state_id"/>
</group>
<group colspan="2" col="3">
<separator string="Communication" colspan="4" col="3"/>
<separator string="Communication History" colspan="4" col="3"/>
<field name="email_from" widget="email"/>
<newline/>
<field name="phone"/>
@ -160,7 +160,7 @@
<field name="day_close"/>
</group>
</page>
<page string="History" groups="base.group_extended">
<page string="Communication &amp; History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" widget="char" size="512"/>
</group>

View File

@ -169,18 +169,21 @@
<group col="4" colspan="4" name="rrule">
<group col="4" colspan="4">
<field name="rrule_type" string="Recurrency period"
attrs="{'readonly':[('recurrent_uid','!=',False)]}" />
<label string="" colspan="2"/>
attrs="{'readonly':[('recurrent_uid','!=',False)]}" />
<field name="interval" />
<separator string="End of recurrency" colspan="4"/>
<field name="count" attrs="{'readonly': [('end_date','!=',False)]}"/>
<field name="end_type" />
<label string=" " colspan="2" />
<newline />
<field name="end_date" attrs="{'readonly': [('count','!=',False)]}"/>
<field name="count" attrs="{'invisible' : [('end_type', '!=', 'count')] }"/>
<label string=" " colspan="2" />
<newline />
<field name="end_date" attrs="{'invisible' : [('end_type', '!=', 'end_date')] }"/>
<newline />
<separator string="Repeat interval" colspan="4"/>
<field name="interval" /> <label string="" colspan="2"/>
</group>
<group col="8" colspan="4" name="Select weekdays" attrs="{'invisible' :[('rrule_type','not in', ['weekly'])]}">
<separator string="Choose day where repeat the meeting" colspan="8"/>
@ -200,13 +203,13 @@
<group col="2" colspan="1">
<field name="select1" />
</group>
<group col="2" colspan="1"
attrs="{'invisible' : [('select1','=','day')]}">
<group col="2" colspan="1">
<field name="day"
attrs="{'required' : [('select1','=','date'), ('rrule_type','=','monthly')]}" />
attrs="{'required' : [('select1','=','date'), ('rrule_type','=','monthly')],
'invisible' : ['|', ('select1','=','day'), ('rrule_type','!=','monthly')]}" />
</group>
<group col="3" colspan="1"
attrs="{'invisible' : [('select1','=','date'), ('rrule_type','=','monthly')]}">
attrs="{'invisible' : ['|', ('select1','=','date'), ('rrule_type','!=','monthly')]}">
<field name="byday" string="The"
attrs="{'required' : [('select1','=','day'), ('rrule_type','=','monthly')]}" />
<field name="week_list" nolabel="1"

View File

@ -146,7 +146,7 @@
</group>
</page>
<page string="History" groups="base.group_extended">
<page string="Communication &amp; History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char" size="512"/>
</group>

View File

@ -22,8 +22,6 @@
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="section_id"
invisible="context.get('invisible_section', True)" />
<field name="user_id" />
<field name="state" />
<button name="case_cancel" string="Cancel"

View File

@ -50,7 +50,7 @@ class crm_add_note(osv.osv_memory):
act = 'case_' + obj.state
getattr(case_pool, act)(cr, uid, [case.id])
return {}
return {'type': 'ir.actions.act_window_close'}
def default_get(self, cr, uid, fields, context=None):
"""

View File

@ -48,7 +48,7 @@ class crm_lead2opportunity(osv.osv_memory):
"""
record_id = context and context.get('active_id') or False
if not record_id:
return {}
return {'type': 'ir.actions.act_window_close'}
leads = self.pool.get('crm.lead')
models_data = self.pool.get('ir.model.data')

View File

@ -73,7 +73,7 @@ class crm_merge_opportunity(osv.osv_memory):
for this in self.browse(cr, uid, ids, context=context):
for opp in this.opportunity_ids:
opp_obj.write(cr, uid, opp.id, {
opp_obj.write(cr, uid, [opp.id], {
'stage_id': opp.stage_id.id or current_opp.stage_id.id or False,
'priority': opp.priority or current_opp.priority,
'email_from': opp.email_from or current_opp.email_from,
@ -108,7 +108,7 @@ class crm_merge_opportunity(osv.osv_memory):
elif this.state in ['cancel', 'open', 'pending']:
act = 'case_' + this.state
getattr(opp_obj, act)(cr, uid, [record_id])
return {}
return {'type': 'ir.actions.act_window_close'}
_columns = {
'opportunity_ids' : fields.many2many('crm.lead', 'merge_opportunity_rel', 'merge_id', 'opportunity_id', 'Opportunities', domain=[('type', '=', 'opportunity')]),

View File

@ -156,7 +156,7 @@ class crm_send_new_email(osv.osv_memory):
act = 'case_' + obj.state
getattr(case_pool, act)(cr, uid, [case.id])
return {}
return {'type': 'ir.actions.act_window_close'}
def default_get(self, cr, uid, fields, context=None):
"""
@ -217,7 +217,7 @@ class crm_send_new_email(osv.osv_memory):
# In the case where the crm.case does not exist in the database
if not model:
return {}
return {'type': 'ir.actions.act_window_close'}
model_pool = self.pool.get(model)
res_id = hist.res_id

View File

@ -12,7 +12,7 @@
<field name="name">Claims</field>
<field name="res_model">crm.claim</field>
<field name="view_type">form</field>
<field name="view_mode">tree,calendar,form,graph</field>
<field name="view_mode">tree,calendar,form</field>
<field name="view_id" ref="crm_case_claims_tree_view"/>
<field name="context">{'search_default_section_id': section_id, "search_default_current":1,"search_default_user_id":uid, "stage_type":'claim'}</field>
<field name="search_view_id" ref="crm_claim.view_crm_case_claims_filter"/>
@ -40,12 +40,6 @@
<field name="act_window_id" ref="crm_case_categ_claim0"/>
</record>
<record model="ir.actions.act_window.view" id="action_crm_sec_graph_view_act_job">
<field name="sequence" eval="4"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="crm_case_graph_view_stage_cost"/>
<field name="act_window_id" ref="crm_case_categ_claim0"/>
</record>
<menuitem name="Claims" id="menu_crm_case_claims"
parent="base.menu_aftersale" action="crm_case_categ_claim0" sequence="1"/>

View File

@ -155,7 +155,7 @@
<field name="resolution" colspan="2" nolabel="1"/>
</group>
</page>
<page string="History" groups="base.group_extended">
<page string="Communication &amp; History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>
@ -168,7 +168,7 @@
context="{'mail':'reply', 'model': 'crm.claim', 'include_original' : True}"
icon="terp-mail-replied" type="action" attrs="{'invisible': [('history', '!=', True)]}" />
</tree>
<form string="History">
<form string="Communication &amp; History">
<group col="4" colspan="4">
<field name="email_from"/>
<field name="date"/>
@ -226,20 +226,6 @@
</field>
</record>
<!-- Claim Graph view -->
<record model="ir.ui.view" id="crm_case_graph_view_stage_cost">
<field name="name">CRM -Graph</field>
<field name="model">crm.claim</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Cases By Stage and Estimates" type="bar" orientation="vertical">
<field name="stage_id"/>
<field name="planned_cost" operator="+"/>
<field name="planned_revenue" operator="+"/>
</graph>
</field>
</record>
<!-- Crm claim Search view -->

View File

@ -73,6 +73,8 @@ class crm_claim_report(osv.osv):
'date_closed': fields.date('Close Date', readonly=True),
'date_deadline': fields.date('Deadline', readonly=True),
'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"),
'email': fields.integer('# Emails', size=128, readonly=True),
'probability': fields.float('Probability',digits=(16,2),readonly=True, group_operator="avg")
}
def init(self, cr):
@ -103,13 +105,15 @@ class crm_claim_report(osv.osv):
c.type_action as type_action,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
(SELECT count(id) FROM mailgate_message WHERE model='crm.claim' AND res_id=c.id AND history=True) AS email,
(SELECT avg(probability) FROM crm_case_stage WHERE type='claim' AND id=c.stage_id) AS probability,
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected
from
crm_claim c
group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),to_char(c.date, 'YYYY-MM-DD'),\
c.state, c.user_id,c.section_id, c.stage_id,\
c.categ_id,c.partner_id,c.company_id,c.create_date,
c.priority,c.type_action,c.date_deadline,c.date_closed
c.priority,c.type_action,c.date_deadline,c.date_closed,c.id
)""")
crm_claim_report()

View File

@ -19,6 +19,8 @@
<field name="day" invisible="1"/>
<field name="nbr" string="#Claim" sum="#Claim"/>
<field name="delay_close" avg="Avg Closing Delay"/>
<field name="email"/>
<field name="probability" widget="progressbar"/>
<field name="delay_expected"/>
<field name="state" invisible="1"/>
<field name="stage_id" invisible="1"/>

View File

@ -140,7 +140,7 @@
type="object" icon="gtk-convert" />
</group>
</page>
<page string="History" groups="base.group_extended">
<page string="Communication &amp; History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>

View File

@ -92,7 +92,7 @@
icon="gtk-convert" />
</group>
</page>
<page string="History" groups="base.group_extended">
<page string="Communication &amp; History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>

View File

@ -31,6 +31,7 @@ based on geolocalization.
'author': 'OpenERP SA',
'depends': ['crm'],
'update_xml': [
'security/ir.model.access.csv',
'res_partner_view.xml',
'wizard/crm_forward_to_partner_view.xml',
'crm_lead_view.xml',

View File

@ -86,7 +86,20 @@
</field>
</record>
<!-- Crm Lead Assign report Graph View -->
<record id="view_report_crm_lead_assign_graph" model="ir.ui.view">
<field name="name">crm.lead.assign.graph</field>
<field name="model">crm.lead.report.assign</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph orientation="horizontal" string="Lead Assign" type="bar">
<field name="state"/>
<field name="nbr" operator="+"/>
<field group="True" name="user_id"/>
</graph>
</field>
</record>
<record id="view_report_crm_opportunity_assign_tree" model="ir.ui.view">
<field name="name">crm.lead.assign.report.tree</field>
@ -139,6 +152,13 @@
<field name="view_id" ref="view_report_crm_opportunity_assign_tree"/>
<field name="act_window_id" ref="action_report_crm_opportunity_assign"/>
</record>
<record model="ir.actions.act_window.view" id="action_report_crm_lead_assign_graph">
<field name="sequence" eval="2"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="view_report_crm_lead_assign_graph"/>
<field name="act_window_id" ref="action_report_crm_opportunity_assign"/>
</record>
<menuitem id="menu_report_crm_opportunities_assign_tree"
groups="base.group_extended"

View File

@ -0,0 +1,5 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_ crm_lead_report_assign"," crm.lead.report.assign","model_crm_lead_report_assign","base.group_sale_salesman",1,1,1,0
"access_ crm_lead_report_assign_all","crm.lead.report.assign.all","model_crm_lead_report_assign","base.group_user",1,0,0,0
"access_res_partner_grade","res.partner.grade","model_res_partner_grade","base.group_sale_salesman",1,1,1,0
"access_res_partner_grade_manager","res.partner.grade.manager","model_res_partner_grade","base.group_sale_manager",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_ crm_lead_report_assign crm.lead.report.assign model_crm_lead_report_assign base.group_sale_salesman 1 1 1 0
3 access_ crm_lead_report_assign_all crm.lead.report.assign.all model_crm_lead_report_assign base.group_user 1 0 0 0
4 access_res_partner_grade res.partner.grade model_res_partner_grade base.group_sale_salesman 1 1 1 0
5 access_res_partner_grade_manager res.partner.grade.manager model_res_partner_grade base.group_sale_manager 1 1 1 1

View File

@ -198,7 +198,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
to_write.update({'email_cc' : ', '.join(new_cc) })
case_pool.write(cr, uid, case.id, to_write, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
def get_lead_details(self, cr, uid, lead_id, context=None):
body = []

View File

@ -113,7 +113,7 @@ class make_delivery(osv.osv_memory):
'type': 'make_to_stock'
})
return {}
return {'type': 'ir.actions.act_window_close'}
make_delivery()

View File

@ -16,7 +16,7 @@
<record id="ir_rule_readpublicdirectories0" model="ir.rule">
<field name="model_id" ref="document.model_document_directory"/>
<field name="domain_force">['|','|',('group_ids','in',[g.id for g in user.groups_id]), ('user_id', '=', user.id), '&amp;', ('user_id', '=', False), ('group_ids','=',False), '|', ('company_id','=',False), ('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">['|','|',('group_ids','in',[g.id for g in user.groups_id]), ('user_id', '=', user.id), '&amp;', ('user_id', '=', False), ('group_ids','=',False), '|','|', ('company_id','=',False), ('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
<field name="name">Read public directories</field>
<field eval="0" name="global"/>
<field eval="[(6,0,[ref('base.group_user')])]" name="groups"/>
@ -28,7 +28,7 @@
<record id="ir_rule_documentmodifyowndirectories0" model="ir.rule">
<field name="model_id" ref="document.model_document_directory"/>
<field name="domain_force">[ '|', ('user_id', '=', user.id), '&amp;', ('group_ids','in',[g.id for g in user.groups_id]), ('user_id','=',False), '|', ('company_id','=',False), ('company_id','child_of',[user.company_id.id])]</field>
<field name="domain_force">[ '|', ('user_id', '=', user.id), '&amp;', ('group_ids','in',[g.id for g in user.groups_id]), ('user_id','=',False), '|','|', ('company_id','=',False), ('company_id','child_of',[user.company_id.id]),('company_id.child_ids','child_of',[user.company_id.id])]</field>
<field name="name">Document modify own directories</field>
<field eval="0" name="global"/>
<field eval="[(6,0,[ref('base.group_document_user')])]" name="groups"/>

View File

@ -25,6 +25,7 @@ import time
import netsvc
from tools.translate import _
import tools
import base64
LOGGER = netsvc.Logger()
@ -62,28 +63,40 @@ class email_template_mailbox(osv.osv):
return True
def send_this_mail(self, cr, uid, ids=None, context=None):
#previous method to send email (link with email account can be found at the revision 4172 and below
result = True
attachment_pool = self.pool.get('ir.attachment')
for id in (ids or []):
try:
account_obj = self.pool.get('email_template.account')
values = self.read(cr, uid, id, [], context)
payload = {}
attach_to_send = None
if values['attachments_ids']:
for attid in values['attachments_ids']:
attachment = attachment_pool.browse(cr, uid, attid, context)#,['datas_fname','datas'])
payload[attachment.datas_fname] = attachment.datas
result = account_obj.send_mail(cr, uid,
[values['account_id'][0]],
{'To':values.get('email_to') or u'',
'CC':values.get('email_cc') or u'',
'BCC':values.get('email_bcc') or u'',
'Reply-To':values.get('reply_to') or u''},
values['subject'] or u'',
{'text':values.get('body_text') or u'', 'html':values.get('body_html') or u''},
payload=payload,
message_id=values['message_id'],
context=context)
attach_to_send = self.pool.get('ir.attachment').read(cr, uid, values['attachments_ids'], ['datas_fname','datas', 'name'])
attach_to_send = map(lambda x: (x['datas_fname'] or x['name'], base64.decodestring(x['datas'])), attach_to_send)
if values.get('body_html'):
body = values.get('body_html')
subtype = "html"
else :
body = values.get('body_text')
subtype = "plain"
result = tools.email_send(
values.get('email_from') or u'',
[values.get('email_to')],
values['subject'] or u'',
body or u'',
reply_to=values.get('reply_to') or u'',
email_bcc=values.get('email_bcc') or u'',
email_cc=values.get('email_cc') or u'',
subtype=subtype,
attach=attach_to_send,
openobject_id=values['message_id']
)
if result == True:
account = account_obj.browse(cr, uid, values['account_id'][0], context=context)
if account.auto_delete:

View File

@ -30,7 +30,7 @@ class event_confirm(osv.osv_memory):
def confirm(self, cr, uid, ids, context=None):
self.pool.get('event.event').do_confirm(cr, uid, context.get('event_ids', []), context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
event_confirm()

View File

@ -63,7 +63,7 @@ class event_confirm_registration(osv.osv_memory):
registration_pool = self.pool.get('event.registration')
registration_ids = context.get('registration_ids', [])
registration_pool.do_open(cr, uid, registration_ids, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
event_confirm_registration()

View File

@ -76,7 +76,7 @@ class event_project(osv.osv_memory):
})
event_obj.write(cr, uid, [event.id], {'project_id': duplicate_project_id })
return {}
return {'type': 'ir.actions.act_window_close'}
event_project()

View File

@ -84,9 +84,11 @@ class email_server(osv.osv):
def check_model(self, cr, uid, ids, context = None):
if context is None:
context = {}
current_rec = self.read(cr, uid, ids, context)[0]
current_rec = self.read(cr, uid, ids, context)
if current_rec:
model = self.pool.get(current_rec.get('object_id')[1])
current_rec = current_rec[0]
model_name = self.pool.get('ir.model').browse(cr, uid, current_rec.get('object_id')[0]).model
model = self.pool.get(model_name)
if hasattr(model, 'message_new'):
return True
return False

View File

@ -160,7 +160,7 @@ class hr_sign_in_out(osv.osv_memory):
self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
except:
raise osv.except_osv(_('UserError'), _('A sign-in must be right after a sign-out !'))
return {} # To do: Return Success message
return {'type': 'ir.actions.act_window_close'} # To do: Return Success message
def sign_out(self, cr, uid, data, context=None):
emp_id = data['emp_id']
@ -172,7 +172,7 @@ class hr_sign_in_out(osv.osv_memory):
self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out')
except:
raise osv.except_osv(_('UserError'), _('A sign-out must be right after a sign-in !'))
return {} # To do: Return Success message
return {'type': 'ir.actions.act_window_close'} # To do: Return Success message
hr_sign_in_out()

View File

@ -137,7 +137,7 @@
<button name="case_reset" string="Reset to New" states="done,cancel" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Emails" groups="base.group_extended">
<page string="Communication &amp; History" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="Global CC" widget="char"/>
</group>

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<menuitem icon="terp-project" id="base.menu_main_pm" name="Project" sequence="10"/>
<menuitem id="base.menu_project_management_time_tracking" name="Time Tracking"
parent="base.menu_main_pm" sequence="3"/>
<record id="hr_timesheet_line_tree" model="ir.ui.view">
<field name="name">hr.analytic.timesheet.tree</field>
@ -97,8 +94,7 @@
<field name="help">Through Working Hours you can register your working hours by project every day.</field>
</record>
<menuitem id="menu_project_working_hours" parent="base.menu_project_management_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
<menuitem id="menu_hr_working_hours" parent="hr_attendance.menu_hr_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
<menuitem id="menu_hr_working_hours" parent="hr_attendance.menu_hr_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
<record id="hr_timesheet_employee_extd_form" model="ir.ui.view">
<field name="name">hr.timesheet.employee.extd_form</field>

View File

@ -93,7 +93,7 @@ class hr_so_project(osv.osv_memory):
emp_id = data.emp_id.id
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out', dt=data.date)
self._write(cr, uid, data, emp_id, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
def sign_out_result(self, cr, uid, ids, context=None):
emp_obj = self.pool.get('hr.employee')
@ -101,7 +101,7 @@ class hr_so_project(osv.osv_memory):
emp_id = data.emp_id.id
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data.date)
self._write(cr, uid, data, emp_id, context=context)
return {}
return {'type': 'ir.actions.act_window_close'}
hr_so_project()
@ -157,7 +157,7 @@ class hr_si_project(osv.osv_memory):
for data in self.browse(cr, uid, ids, context=context):
emp_id = data.emp_id.id
emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data.date or False)
return {}
return {'type': 'ir.actions.act_window_close'}
def default_get(self, cr, uid, fields_list, context=None):
res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)

View File

@ -52,7 +52,6 @@ class account_analytic_account(osv.osv):
account_to_invoice_map.setdefault(rec['account_id'], []).append(rec['invoice_id'])
for account in self.browse(cr, uid, ids, context=context):
invoiced = {}
invoice_ids = filter(None, list(set(account_to_invoice_map.get(account.id, []))))
for invoice in obj_invoice.browse(cr, uid, invoice_ids, context=context):
res.setdefault(account.id, 0.0)

Some files were not shown because too many files have changed in this diff Show More