[MERGE] with trunk-addons1
bzr revid: tfr@openerp.com-20110106122239-t89mgfk1xogbhpg0
This commit is contained in:
commit
56678d7d13
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
-
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -208,6 +208,10 @@ class account_analytic_account(osv.osv):
|
|||
args=[]
|
||||
if context is None:
|
||||
context={}
|
||||
if context.get('current_model') == 'project.project':
|
||||
cr.execute("select analytic_account_id from project_project")
|
||||
project_ids = [x[0] for x in cr.fetchall()]
|
||||
return self.name_get(cr, uid, project_ids, context=context)
|
||||
account = self.search(cr, uid, [('code', '=', name)]+args, limit=limit, context=context)
|
||||
if not account:
|
||||
account = self.search(cr, uid, [('name', 'ilike', '%%%s%%' % name)]+args, limit=limit, context=context)
|
||||
|
|
|
@ -125,6 +125,7 @@ Create dashboard for CRM that includes:
|
|||
'test/test_crm_meeting.yml',
|
||||
'test/test_crm_opportunity.yml',
|
||||
'test/test_crm_phonecall.yml',
|
||||
'test/test_crm_recurrent_meeting.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
-
|
||||
In order to test recurrent meetings in OpenERP, I create meetings with different recurrency.
|
||||
-
|
||||
I create a customer meeting record with daily recurrency.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_pricelistdiscussion0}:
|
||||
categ_id: crm.categ_meet1
|
||||
count: 0.0
|
||||
date: '2011-01-05 00:00:00'
|
||||
date_deadline: '2011-01-05 01:00:00'
|
||||
day: 0.0
|
||||
duration: 1.0
|
||||
end_date: '2011-01-12'
|
||||
end_type: end_date
|
||||
name: Pricelist Discussion
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule: FREQ=DAILY;INTERVAL=1;UNTIL=20110112T235959Z
|
||||
rrule_type: daily
|
||||
sequence: 0.0
|
||||
-
|
||||
I create another meeting record with weekly recurrency.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_changesindesigning0}:
|
||||
categ_id: crm.categ_meet2
|
||||
count: 15
|
||||
date: '2011-01-22 11:05:05'
|
||||
date_deadline: '2011-01-22 16:05:05'
|
||||
day: 0.0
|
||||
duration: 5.0
|
||||
email_from: info@opensides.be
|
||||
end_type: count
|
||||
fr: true
|
||||
mo: true
|
||||
name: Changes in Designing
|
||||
partner_address_id: base.res_partner_address_1
|
||||
partner_id: base.res_partner_9
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule: FREQ=WEEKLY;BYDAY=FR,TU,TH,WE,MO;INTERVAL=1;COUNT=15
|
||||
rrule_type: weekly
|
||||
section_id: crm.section_sales_department
|
||||
sequence: 0.0
|
||||
th: true
|
||||
tu: true
|
||||
user_id: base.user_demo
|
||||
we: true
|
||||
-
|
||||
I create a meeting record with monthly recurrency.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_reviewneeds0}:
|
||||
categ_id: crm.categ_meet3
|
||||
count: 0.0
|
||||
date: '2011-01-20 10:02:02'
|
||||
date_deadline: '2011-01-20 16:02:02'
|
||||
day: 15
|
||||
duration: 6.0
|
||||
end_date: '2011-05-31'
|
||||
end_type: end_date
|
||||
name: Review needs
|
||||
partner_address_id: base.res_partner_address_15
|
||||
partner_id: base.res_partner_11
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule: FREQ=MONTHLY;INTERVAL=1;UNTIL=20110531T235959Z;BYMONTHDAY=15
|
||||
rrule_type: monthly
|
||||
section_id: crm.section_sales_department
|
||||
sequence: 0.0
|
||||
user_id: base.user_demo
|
||||
-
|
||||
I create a record for daily scrum meeting.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_scrummeeting0}:
|
||||
categ_id: crm.categ_meet2
|
||||
count: 0.0
|
||||
date: '2011-01-06 00:00:00'
|
||||
date_deadline: '2011-01-06 01:00:00'
|
||||
day: 0.0
|
||||
duration: 1.0
|
||||
name: Scrum meeting
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule: FREQ=DAILY;INTERVAL=1
|
||||
rrule_type: daily
|
||||
sequence: 0.0
|
||||
-
|
||||
I create a meeting record for yearly recurrency.
|
||||
-
|
||||
!record {model: crm.meeting, id: crm_meeting_updatethedata0}:
|
||||
categ_id: crm.categ_meet2
|
||||
count: 0.0
|
||||
date: '2011-01-18 13:12:49'
|
||||
date_deadline: '2011-01-19 02:30:49'
|
||||
day: 0.0
|
||||
duration: 13.300000000000001
|
||||
end_date: '2015-01-06'
|
||||
end_type: end_date
|
||||
name: Update the data
|
||||
partner_address_id: base.res_partner_address_7
|
||||
partner_id: base.res_partner_4
|
||||
recurrency: true
|
||||
recurrent_uid: 0.0
|
||||
rrule: FREQ=YEARLY;INTERVAL=1;UNTIL=20150106T235959Z
|
||||
rrule_type: yearly
|
||||
section_id: crm.section_sales_department
|
||||
sequence: 0.0
|
|
@ -108,7 +108,7 @@
|
|||
<field name="extension"/>
|
||||
<field name="include_name"/>
|
||||
<separator string="PDF Report" colspan="4"/>
|
||||
<field name="report_id" domain="[ ('type','=','ressource'),('model_id','=',parent.ressource_type_id)]"/>
|
||||
<field name="report_id" domain="[('model_id','=',parent.ressource_type_id)]"/>
|
||||
</form>
|
||||
<tree string="Contents">
|
||||
<field name="sequence" string="Seq."/>
|
||||
|
|
|
@ -63,34 +63,19 @@ 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
|
||||
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)
|
||||
#work around to uniformize send email while waiting for a merge of fetchmail, email_template, mailgate
|
||||
#using tools.send_email instead
|
||||
#No need to use email account
|
||||
#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)
|
||||
|
||||
if values.get('body_html'):
|
||||
body = values.get('body_html')
|
||||
subtype = "html"
|
||||
|
|
|
@ -459,7 +459,7 @@ msgstr "Date planifiée"
|
|||
#. module: mrp
|
||||
#: report:mrp.production.order:0
|
||||
msgid "Bill Of Material"
|
||||
msgstr "Nomenclature des Matériaux"
|
||||
msgstr "Nomenclature"
|
||||
|
||||
#. module: mrp
|
||||
#: help:mrp.routing,location_id:0
|
||||
|
@ -480,7 +480,7 @@ msgstr "Variation de la valeur de stock"
|
|||
#. module: mrp
|
||||
#: model:ir.actions.act_window,name:mrp.action2
|
||||
msgid "Bill of Materials Structure"
|
||||
msgstr "Structure de la nomenclature"
|
||||
msgstr "Structure des nomenclatures"
|
||||
|
||||
#. module: mrp
|
||||
#: model:process.node,note:mrp.process_node_serviceproduct0
|
||||
|
@ -577,7 +577,7 @@ msgstr "Valeur du stock"
|
|||
#. module: mrp
|
||||
#: model:ir.actions.act_window,name:mrp.action_product_bom_structure
|
||||
msgid "Product BoM Structure"
|
||||
msgstr "Structure de la Nomenclature des Produits"
|
||||
msgstr "Structure des nomenclatures"
|
||||
|
||||
#. module: mrp
|
||||
#: view:mrp.production:0
|
||||
|
@ -2228,7 +2228,7 @@ msgstr "Sélectionner quantité"
|
|||
#: model:ir.ui.menu,name:mrp.menu_mrp_bom_form_action
|
||||
#: field:product.product,bom_ids:0
|
||||
msgid "Bill of Materials"
|
||||
msgstr "Nomenclature"
|
||||
msgstr "Nomenclatures"
|
||||
|
||||
#. module: mrp
|
||||
#: help:mrp.routing.workcenter,routing_id:0
|
||||
|
|
|
@ -30,6 +30,8 @@ from report.misc import choice_colors
|
|||
import random
|
||||
import StringIO
|
||||
|
||||
from pychart import *
|
||||
|
||||
|
||||
theme.use_color = 1
|
||||
random.seed(0)
|
||||
|
|
|
@ -129,7 +129,6 @@ class project(osv.osv):
|
|||
'priority': fields.integer('Sequence', help="Gives the sequence order when displaying a list of task"),
|
||||
'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'parent_id': fields.many2one('project.project', 'Parent Project'),
|
||||
'tasks': fields.one2many('project.task', 'project_id', "Project tasks"),
|
||||
'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.",
|
||||
store = {
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
|
||||
<!--
|
||||
Resource: project.project
|
||||
|
||||
-->
|
||||
<record id="all_projects_account" model="account.analytic.account">
|
||||
<field name="name">Projects</field>
|
||||
<field name="code">3</field>
|
||||
</record>
|
||||
|
||||
<function eval="('default',False,'parent_id', [('project.project', False)], all_projects_account, True, False, False, False, True)" id="parent_project_default_set" model="ir.values" name="set"/>
|
||||
-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -241,10 +241,10 @@
|
|||
</record>
|
||||
|
||||
<!-- Projects -->
|
||||
<record id="all_projects_account" model="project.project">
|
||||
<!-- <record id="all_projects_account" model="project.project">
|
||||
<field name="name">Projects</field>
|
||||
<field name="code">3</field>
|
||||
</record>
|
||||
</record> -->
|
||||
|
||||
<record id="project_project_9" model="project.project">
|
||||
<field name="warn_manager">1</field>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<form string="Project">
|
||||
<group colspan="6" col="6">
|
||||
<field name="name" string="Project Name" select="1"/>
|
||||
<field name="parent_id" domain="[('id','!=',active_id)]"/>
|
||||
<field name="parent_id" string="Parent Project" domain="[('id','!=',active_id)]" context="{'current_model': 'project.project'}"/>
|
||||
<field name="user_id" string="Project Manager" select="1" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
|
||||
<field name="date_start" string="Start Date" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
|
||||
<field name="date" string="End Date" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
|
||||
|
@ -143,7 +143,7 @@
|
|||
<field name="name" string="Project Name"/>
|
||||
<field name="user_id" string="Project Manager"/>
|
||||
<field name="partner_id" string="Partner"/>
|
||||
<field name="parent_id" invisible="1"/>
|
||||
<field name="parent_id" string="Parent Project" invisible="1"/>
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="total_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
|
|
|
@ -154,6 +154,8 @@
|
|||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="user_id"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_end" />
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="project_id" invisible="1"/>
|
||||
<field name="total_hours" sum='Total Hours'/>
|
||||
|
@ -172,6 +174,7 @@
|
|||
<group colspan="2" col="2">
|
||||
<separator string="Dates" colspan="2"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_end" />
|
||||
<field name="date_deadline"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
|
|
|
@ -260,7 +260,7 @@ class sale_order(osv.osv):
|
|||
'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on', help="The sale order will automatically create the invoice proposition (draft invoice). Ordered and delivered quantities may not be the same. You have to choose if you want your invoice based on ordered or shipped quantities. If the product is a service, shipped quantities means hours spent on the associated tasks.", required=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
'payment_term': fields.many2one('account.payment.term', 'Payment Term'),
|
||||
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
|
||||
'company_id': fields.related('shop_id','company_id',type='many2one',relation='res.company',string='Company',store=True)
|
||||
'company_id': fields.related('shop_id','company_id',type='many2one',relation='res.company',string='Company',store=True,readonly=True)
|
||||
}
|
||||
_defaults = {
|
||||
'picking_policy': 'direct',
|
||||
|
|
|
@ -2806,11 +2806,15 @@ msgstr "Nom de révision"
|
|||
|
||||
#. module: stock
|
||||
#: model:ir.model,name:stock.model_stock_warehouse
|
||||
#: model:ir.ui.menu,name:stock.menu_stock_root
|
||||
#: view:stock.warehouse:0
|
||||
msgid "Warehouse"
|
||||
msgstr "Entrepôt"
|
||||
|
||||
#. module: stock
|
||||
#: model:ir.ui.menu,name:stock.menu_stock_root
|
||||
msgid "Warehouse"
|
||||
msgstr "Stocks"
|
||||
|
||||
#. module: stock
|
||||
#: view:stock.location.product:0
|
||||
msgid ""
|
||||
|
|
Loading…
Reference in New Issue