[MERGE] merge from trunk addons3
bzr revid: pso@tinyerp.com-20110106052708-4ywi0tgtjyre5qpi
This commit is contained in:
commit
a63eaf7d9a
|
@ -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:
|
||||
|
|
|
@ -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,10 @@ 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,
|
||||
'analytic_account_id': inv.analytic_id.id,
|
||||
#'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 +802,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 +813,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>
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
- |
|
||||
- |
|
||||
In Order to test the Membership in OpenERP, which allows us to manage all operations for managing memberships.
|
||||
- |
|
||||
I'm creating "Golden Membership" which has Membership fee 80 EURO and It's started from 1st June to 31st Dec.
|
||||
-
|
||||
-
|
||||
!record {model: product.product, id: product_product_membershipproduct0}:
|
||||
categ_id: product.cat1
|
||||
membership: 1
|
||||
membership_date_from: '2010-06-01'
|
||||
membership_date_to: '2010-12-31'
|
||||
membership_date_from: !eval datetime.today().strftime("%Y-%m-%d")
|
||||
membership_date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)"
|
||||
name: Golden Membership
|
||||
type: service
|
||||
list_price: 80.00
|
||||
|
||||
|
||||
- |
|
||||
"Mark Johnson" want to join "Golden Membership".
|
||||
- |
|
||||
I'm creating new member "Mark Johnson".
|
||||
-
|
||||
-
|
||||
!record {model: res.partner, id: res_partner_markjohnson0}:
|
||||
address:
|
||||
- city: paris
|
||||
|
@ -27,31 +27,31 @@
|
|||
zip: '75016'
|
||||
name: Mark Johnson
|
||||
- |
|
||||
I'm checking "Current Membership State" of "Mark Johnson". It is an "Non Member" or not.
|
||||
-
|
||||
I'm checking "Current Membership State" of "Mark Johnson". It is an "Non Member" or not.
|
||||
-
|
||||
!assert {model: res.partner, id: res_partner_markjohnson0}:
|
||||
- membership_state == 'none', 'Member should be has "Current Membership State" in "Non Member".'
|
||||
- |
|
||||
I'm doing to make membership invoice for "Mark Johnson" on joining "Golden Membership".
|
||||
-
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
self.create_membership_invoice(cr, uid, [ref("res_partner_markjohnson0")], product_id=ref("product_product_membershipproduct0"), datas={"amount":80.00})
|
||||
- |
|
||||
I'm checking "Current Membership State" of "Mark Johnson". It is an "Waiting Member" or not.
|
||||
-
|
||||
I'm checking "Current Membership State" of "Mark Johnson". It is an "Waiting Member" or not.
|
||||
-
|
||||
!assert {model: res.partner, id: res_partner_markjohnson0}:
|
||||
- membership_state == 'waiting', 'Member should be has "Current Membership State" in "Waiting Member".'
|
||||
- |
|
||||
I'm Opening that Invoice which is created for "Mark Johnson".
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
import netsvc
|
||||
import netsvc
|
||||
from tools.translate import _
|
||||
invoice_pool = self.pool.get('account.invoice')
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
membership_line_pool = self.pool.get('membership.membership_line')
|
||||
membership_pool = self.pool.get('product.product')
|
||||
|
||||
|
||||
membership_line_ids = membership_line_pool.search(cr, uid, [('membership_id','=',ref('product_product_membershipproduct0')),('partner','=',ref('res_partner_markjohnson0'))])
|
||||
membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids)
|
||||
assert membership_lines, _('Membership is not registrated.')
|
||||
|
@ -63,7 +63,7 @@
|
|||
-
|
||||
!assert {model: res.partner, id: res_partner_markjohnson0}:
|
||||
- membership_state == 'invoiced', 'Member should be has "Current Membership State" in "Invoiced Member".'
|
||||
|
||||
|
||||
- |
|
||||
I'm creating free member "Ms. Johnson" of "Golden Membership".
|
||||
-
|
||||
|
@ -80,19 +80,19 @@
|
|||
|
||||
- |
|
||||
I'm checking "Current membership state" of "Ms. Johnson". It is an "Free Member" or not.
|
||||
-
|
||||
-
|
||||
!assert {model: res.partner, id: res_partner_msjohnson0}:
|
||||
- membership_state == 'free', 'Member should be has "Current Membership State" in "Free Member".'
|
||||
|
||||
- |
|
||||
I'm set "Mark Johnson" as a associated member of "Ms. Johnson" and also set Non free member.
|
||||
-
|
||||
-
|
||||
!python {model: res.partner}: |
|
||||
self.write(cr, uid, [ref("res_partner_msjohnson0")], {'free_member': False, 'associate_member': ref("res_partner_markjohnson0")})
|
||||
|
||||
- |
|
||||
I'm checking "Current membership state" of "Ms. Johnson". It is an "Paid Member" or not.
|
||||
-
|
||||
-
|
||||
!assert {model: res.partner, id: res_partner_msjohnson0}:
|
||||
- membership_state == 'paid', 'Member should be has "Current Membership State" in "Paid Member".'
|
||||
|
||||
|
@ -102,8 +102,8 @@
|
|||
!record {model: product.product, id: product_product_membershipproduct1}:
|
||||
categ_id: product.cat1
|
||||
membership: 1
|
||||
membership_date_from: '2010-06-01'
|
||||
membership_date_to: '2010-12-31'
|
||||
membership_date_from: !eval datetime.today().strftime("%Y-%m-%d")
|
||||
membership_date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)"
|
||||
name: Silver Membership
|
||||
type: service
|
||||
list_price: 50.00
|
||||
|
@ -127,16 +127,16 @@
|
|||
membership_line_pool = self.pool.get('membership.membership_line')
|
||||
membership_pool = self.pool.get('product.product')
|
||||
invoice_refund_pool = self.pool.get('account.invoice.refund')
|
||||
|
||||
|
||||
membership_line_ids = membership_line_pool.search(cr, uid, [('membership_id','=',ref('product_product_membershipproduct0')),('partner','=',ref('res_partner_markjohnson0'))])
|
||||
membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids)
|
||||
assert membership_lines, _('Membership is not registrated.')
|
||||
membership_line = membership_lines[0]
|
||||
refund_id = invoice_refund_pool.create(cr, uid, {'description': 'Refund of Membership', 'filter_refund': 'refund'}, {'active_id': membership_line.account_invoice_id.id})
|
||||
invoice_refund_pool.invoice_refund(cr, uid, [refund_id], {'active_id': membership_line.account_invoice_id.id, 'active_ids': [membership_line.account_invoice_id.id]})
|
||||
invoice_refund_pool.invoice_refund(cr, uid, [refund_id], {'active_id': membership_line.account_invoice_id.id, 'active_ids': [membership_line.account_invoice_id.id]})
|
||||
- |
|
||||
I'm checking "Current membership state" of "Mark Johnson". It is an "Cancelled Member" or not.
|
||||
-
|
||||
!assert {model: res.partner, id: res_partner_markjohnson0}:
|
||||
- membership_state == 'canceled', 'Member should be has "Current Membership State" in "Cancelled Member".'
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-
|
||||
In order to test the mrp phantom bom type in OpenERP, I will create products
|
||||
In order to test the mrp phantom bom type in OpenERP, I will create products
|
||||
and then I will create Phantom bom structure for those products.
|
||||
-
|
||||
I create the products required to produce some orange juices with Oranges, Sugar and Water.
|
||||
|
@ -8,10 +8,10 @@
|
|||
category_id: product.product_uom_categ_kgm
|
||||
factor: 1.0
|
||||
name: Litre
|
||||
rounding: 0.01
|
||||
rounding: 0.01
|
||||
-
|
||||
I create record for product Orange Juice.
|
||||
-
|
||||
-
|
||||
!record {model: product.product, id: product_product_orangejuice0}:
|
||||
categ_id: product.cat1
|
||||
name: Orange Juice
|
||||
|
@ -25,7 +25,7 @@
|
|||
property_stock_production: stock.location_production
|
||||
-
|
||||
I create record for product Orange.
|
||||
-
|
||||
-
|
||||
!record {model: product.product, id: product_product_orange0}:
|
||||
categ_id: product.cat1
|
||||
name: Orange
|
||||
|
@ -44,7 +44,7 @@
|
|||
property_stock_production: stock.location_production
|
||||
-
|
||||
I create record for product Sugar.
|
||||
-
|
||||
-
|
||||
!record {model: product.product, id: product_product_sugar0}:
|
||||
categ_id: product.cat1
|
||||
name: Sugar
|
||||
|
@ -63,7 +63,7 @@
|
|||
property_stock_production: stock.location_production
|
||||
-
|
||||
I create record for product Water.
|
||||
-
|
||||
-
|
||||
!record {model: product.product, id: product_product_water0}:
|
||||
categ_id: product.cat1
|
||||
name: Water
|
||||
|
@ -82,7 +82,7 @@
|
|||
property_stock_production: stock.location_production
|
||||
-
|
||||
I define the BoM to produce an orange juice.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
|
||||
company_id: base.main_company
|
||||
name: Orange Juice
|
||||
|
@ -93,7 +93,7 @@
|
|||
type: phantom
|
||||
-
|
||||
I create bom lines for BoM for Orange Juice.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.bom, id: mrp_bom_orangejuice0}:
|
||||
bom_lines:
|
||||
- bom_id: mrp_bom_orangejuice0
|
||||
|
@ -122,7 +122,7 @@
|
|||
type: normal
|
||||
-
|
||||
I define Minimum stock rules for my stockable product "Orange".
|
||||
-
|
||||
-
|
||||
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
|
||||
company_id: base.main_company
|
||||
location_id: stock.stock_location_stock
|
||||
|
@ -136,7 +136,7 @@
|
|||
warehouse_id: stock.warehouse0
|
||||
-
|
||||
I define Minimum stock rules for my stockable product "Sugar".
|
||||
-
|
||||
-
|
||||
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op1}:
|
||||
company_id: base.main_company
|
||||
location_id: stock.stock_location_stock
|
||||
|
@ -149,27 +149,27 @@
|
|||
qty_multiple: 1
|
||||
warehouse_id: stock.warehouse0
|
||||
-
|
||||
I want to produce 100 litres of Orange juice. I am creating a manufacturing order for this.
|
||||
I want to see how much quantities of sub products I need, to produce the Orange juice.
|
||||
I want to produce 100 litres of Orange juice. I am creating a manufacturing order for this.
|
||||
I want to see how much quantities of sub products I need, to produce the Orange juice.
|
||||
-
|
||||
I compute the data. I get the bill of material of Orange juice and list of
|
||||
I compute the data. I get the bill of material of Orange juice and list of
|
||||
scheduled products according to my bom.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo0}:
|
||||
company_id: base.main_company
|
||||
date_planned: '2010-04-16 15:53:36'
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_output
|
||||
location_src_id: stock.stock_location_stock
|
||||
product_id: product_product_orangejuice0
|
||||
product_qty: 100.0
|
||||
product_uom: product_uom_litre0
|
||||
-
|
||||
-
|
||||
Creating an mrp.production record. Computing Bills of materials.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo0}:
|
||||
bom_id: mrp.mrp_bom_orangejuice0
|
||||
company_id: base.main_company
|
||||
date_planned: '2010-04-16 15:53:36'
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_output
|
||||
location_src_id: stock.stock_location_stock
|
||||
name: MO/00002
|
||||
|
@ -194,7 +194,7 @@
|
|||
product_uom: mrp.product_uom_litre0
|
||||
-
|
||||
I confirm the order.
|
||||
-
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo0}
|
||||
-
|
||||
I am checking Procurement orders. There are 3 orders generated for Oranges, Sugar and Water.
|
||||
|
@ -210,7 +210,7 @@
|
|||
- model: procurement.order
|
||||
search: "[]"
|
||||
-
|
||||
I am checking Internal picking. I see one picking for Orange juice and its
|
||||
I am checking Internal picking. I see one picking for Orange juice and its
|
||||
stock moves for Oranges, Sugar and Water made correctly.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
|
@ -218,7 +218,7 @@
|
|||
pick_ids = self.search(cr, uid, [('type','=','internal')])
|
||||
assert pick_ids, _('No Internal Pickings!')
|
||||
-
|
||||
According to minimum stock rules. I have 2 purchase orders for
|
||||
According to minimum stock rules. I have 2 purchase orders for
|
||||
Sugar with 6 Kg from Axelor and Orange 60 Kg from ASUStek.
|
||||
-
|
||||
I confirm the purchase order of Sugar and Orange.
|
||||
|
@ -244,7 +244,7 @@
|
|||
I create record for the incoming picking wizard.
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking0}:
|
||||
date: '2010-04-30 16:53:36'
|
||||
date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
-
|
||||
I make my pickings done.
|
||||
-
|
||||
|
@ -253,7 +253,7 @@
|
|||
picking_ids = pick_obj.search(cr, uid, [('type','=','in'),('state','=','assigned')])
|
||||
partial = self.browse(cr, uid, 1, context)
|
||||
partial_datas = {
|
||||
'delivery_date': partial.date
|
||||
'delivery_date': partial.date
|
||||
}
|
||||
for pick in pick_obj.browse(cr, uid, picking_ids):
|
||||
for m in pick.move_lines:
|
||||
|
@ -262,8 +262,8 @@
|
|||
'product_qty': m.product_qty,
|
||||
'product_uom': m.product_uom.id
|
||||
}
|
||||
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
|
||||
partial_datas['move%s'%(m.id)].update({
|
||||
'product_price': m.product_price,
|
||||
'product_currency': m.product_currency
|
||||
})
|
||||
|
@ -292,5 +292,5 @@
|
|||
I start the production order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -202,7 +202,7 @@
|
|||
I create record for partial picking.
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking0}:
|
||||
date: '2010-04-30 16:53:36'
|
||||
date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
-
|
||||
I make my picking done.
|
||||
|
@ -238,7 +238,7 @@
|
|||
I create record for partial picking.
|
||||
-
|
||||
!record {model: stock.partial.picking, id: stock_partial_picking0}:
|
||||
date: '2010-04-30 16:53:36'
|
||||
date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
-
|
||||
I make my picking done.
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
-
|
||||
In order to test the manufacturing order working with procurements I will use
|
||||
some products with different supply method and procurement method, also check
|
||||
some products with different supply method and procurement method, also check
|
||||
the bills of material for the products.
|
||||
-
|
||||
I am creating one manufacturing order.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo1}:
|
||||
company_id: base.main_company
|
||||
date_planned: '2010-05-06 14:55:52'
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_stock
|
||||
location_src_id: stock.stock_location_stock
|
||||
product_id: product.product_product_pc1
|
||||
|
@ -24,10 +24,10 @@
|
|||
})
|
||||
-
|
||||
I confirm the order.
|
||||
-
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1}
|
||||
-
|
||||
I am checking Procurement orders for components of PC1.
|
||||
I am checking Procurement orders for components of PC1.
|
||||
-
|
||||
!python {model: procurement.order}: |
|
||||
from tools.translate import _
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
-
|
||||
!record {model: procurement.order, id: mrp_production_mo0}:
|
||||
company_id: base.main_company
|
||||
date_planned: '2010-08-05 17:59:49'
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_id: stock.stock_location_stock
|
||||
name: PROC/TEST/0001
|
||||
product_id: product.product_product_pc2
|
||||
product_qty: 10.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 0.0
|
||||
-
|
||||
-
|
||||
|
|
||||
I confirm the procurement order PROC/TEST/0001.
|
||||
-
|
||||
-
|
||||
!workflow {model: procurement.order, action: button_confirm, ref: mrp_production_mo0}
|
||||
-
|
||||
|
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
and check its effects on Work orders.
|
||||
-
|
||||
I create a production order.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.production, id: mrp_production_mo0}:
|
||||
company_id: base.main_company
|
||||
date_planned: '2010-05-25 11:17:34'
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_stock
|
||||
location_src_id: stock.stock_location_stock
|
||||
name: MO/00002
|
||||
|
@ -71,13 +71,13 @@
|
|||
prod_order_ids = self.search(cr, uid, [('state','=','ready')])
|
||||
for po in prod_order_ids:
|
||||
wf_service.trg_validate(uid, 'mrp.production', po, 'button_produce', cr)
|
||||
-
|
||||
-
|
||||
I am creating a mrp.product.produce record
|
||||
-
|
||||
!record {model: mrp.product.produce, id: mrp_product_produce_0}:
|
||||
mode: consume_produce
|
||||
product_qty: 5.0
|
||||
-
|
||||
-
|
||||
I produce the product CPU_GEN.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
|
@ -106,17 +106,17 @@
|
|||
I check that both internal pickings are done.
|
||||
-
|
||||
!python {model: stock.picking}: |
|
||||
from tools.translate import _
|
||||
from tools.translate import _
|
||||
pick_ids = self.search(cr, uid, [('state','=','done'),('type','=','internal')])
|
||||
assert pick_ids, _('Internal pickings are not done!')
|
||||
-
|
||||
Now I start my first production order.
|
||||
-
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
|
||||
!workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo0}
|
||||
-
|
||||
I check that the related work order is in progress state.
|
||||
I check that the related work order is in progress state.
|
||||
-
|
||||
!python {model: mrp.production.workcenter.line}: |
|
||||
!python {model: mrp.production.workcenter.line}: |
|
||||
from tools.translate import _
|
||||
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','startworking')])
|
||||
assert order_id, _('Work order not started yet!')
|
||||
|
@ -126,7 +126,7 @@
|
|||
!record {model: mrp.product.produce, id: mrp_product_produce_0}:
|
||||
mode: consume_produce
|
||||
product_qty: 5.0
|
||||
-
|
||||
-
|
||||
I produce the product PC1.
|
||||
-
|
||||
!python {model: mrp.product.produce}: |
|
||||
|
@ -138,7 +138,7 @@
|
|||
-
|
||||
I check the related work order is done.
|
||||
-
|
||||
!python {model: mrp.production.workcenter.line}: |
|
||||
!python {model: mrp.production.workcenter.line}: |
|
||||
from tools.translate import _
|
||||
order_id = self.search(cr, uid, [('production_id','=', ref('mrp_production_mo0')),('state','=','done')])
|
||||
assert order_id, _('Work order not done yet!')
|
||||
assert order_id, _('Work order not done yet!')
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
- |
|
||||
Given that I have already stock move line created.
|
||||
-
|
||||
-
|
||||
!record {model: stock.move, id: stock_move_pcbasicpc0}:
|
||||
company_id: base.main_company
|
||||
date: '2010-06-24 20:10:28'
|
||||
date_expected: '2010-06-24 20:10:55'
|
||||
date: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
date_expected: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_stock
|
||||
location_id: stock.stock_location_stock
|
||||
name: '[PC1] Basic PC'
|
||||
|
@ -15,13 +15,13 @@
|
|||
product_qty: 1.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uos_qty: 1.0
|
||||
|
||||
|
||||
- |
|
||||
I start by creating new Repair order for "Basic Pc" product.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.repair, id: mrp_repair_rma0}:
|
||||
address_id: base.res_partner_address_1
|
||||
guarantee_limit: '2010-06-24'
|
||||
guarantee_limit: !eval datetime.today().strftime("%Y-%m-%d")
|
||||
invoice_method: 'after_repair'
|
||||
partner_invoice_id: base.res_partner_address_1
|
||||
location_dest_id: stock.stock_location_14
|
||||
|
@ -41,23 +41,23 @@
|
|||
type: add
|
||||
partner_id: base.res_partner_9
|
||||
product_id: product.product_product_pc1
|
||||
|
||||
|
||||
- |
|
||||
I check that Repair order is in "Draft" state.
|
||||
-
|
||||
-
|
||||
!assert {model: mrp.repair, id: mrp_repair_rma0}:
|
||||
- state == 'draft'
|
||||
|
||||
- |
|
||||
I confirm This Repair order.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0}
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_confirm, ref: mrp_repair_rma0}
|
||||
|
||||
- |
|
||||
I start the repairing process by click on "Start Repair" Button.
|
||||
-
|
||||
!workflow {model: mrp.repair, action: repair_ready, ref: mrp_repair_rma0}
|
||||
|
||||
|
||||
- |
|
||||
I check that state is "Under Repair".
|
||||
-
|
||||
|
@ -70,12 +70,12 @@
|
|||
- |
|
||||
I select invoiced after repair option in this "RMA00004" Repair order.
|
||||
so I create Invoice by click on "Make Invoice" wizard.
|
||||
-
|
||||
-
|
||||
!record {model: mrp.repair.make_invoice, id: mrp_repair_make_invoice_0}:
|
||||
group: 1
|
||||
- |
|
||||
I click on "Create Invoice" button of this wizard to make invoice.
|
||||
-
|
||||
-
|
||||
!python {model: mrp.repair.make_invoice}: |
|
||||
self.make_invoices(cr, uid, [ref("mrp_repair_make_invoice_0")], {"active_ids": [ref("mrp_repair.mrp_repair_rma0")]})
|
||||
- |
|
||||
|
@ -87,5 +87,5 @@
|
|||
repair_id = self.browse(cr, uid, [ref('mrp_repair_rma0')], context=context)[0]
|
||||
invoice_ids = inv_obj.search(cr, uid, [('partner_id', '=', repair_id.partner_id.id)])
|
||||
invoice_id = inv_obj.browse(cr, uid, invoice_ids)[0]
|
||||
|
||||
|
||||
assert repair_id.partner_id.id == invoice_id.partner_id.id, "No invoice existing for the same partner"
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
!record {model: mrp.production, id: mrp_production_mo0}:
|
||||
bom_id: mrp_bom_woodenchair0
|
||||
company_id: base.main_company
|
||||
date_planned: '2010-08-06 14:55:52'
|
||||
date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
location_dest_id: stock.stock_location_stock
|
||||
location_src_id: stock.stock_location_stock
|
||||
name: MO/00004
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-
|
||||
-
|
||||
Create a user 'HR Manager'
|
||||
-
|
||||
-
|
||||
!record {model: res.users, id: res_users_hrmanager0}:
|
||||
company_id: base.main_company
|
||||
context_lang: en_US
|
||||
|
@ -8,11 +8,11 @@
|
|||
name: HR Manager
|
||||
password: hr
|
||||
groups_id:
|
||||
- base.group_hr_manager
|
||||
|
||||
-
|
||||
- base.group_hr_manager
|
||||
|
||||
-
|
||||
Create a product with type service used to specify employees designation
|
||||
-
|
||||
-
|
||||
!record {model: product.product, id: product_product_hrmanger0}:
|
||||
categ_id: product.product_category_services
|
||||
cost_method: standard
|
||||
|
@ -29,15 +29,15 @@
|
|||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
|
||||
-
|
||||
-
|
||||
Create an analytic journal for employees timesheet
|
||||
-
|
||||
-
|
||||
!record {model: account.analytic.journal, id: account_analytic_journal_hrtimesheet0}:
|
||||
company_id: base.main_company
|
||||
name: HR Timesheet
|
||||
type: general
|
||||
|
||||
-
|
||||
-
|
||||
Create an employee 'HR Manager' for user 'HR Manager'
|
||||
-
|
||||
!record {model: hr.employee, id: hr_employee_hrmanager0}:
|
||||
|
@ -45,60 +45,60 @@
|
|||
user_id: res_users_hrmanager0
|
||||
product_id: product_product_hrmanger0
|
||||
journal_id: account_analytic_journal_hrtimesheet0
|
||||
|
||||
-
|
||||
|
||||
-
|
||||
Create a timesheet sheet for HR manager
|
||||
-
|
||||
-
|
||||
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0}:
|
||||
date_current: '2010-06-03'
|
||||
date_from: '2010-06-01'
|
||||
date_to: '2010-06-30'
|
||||
date_current: !eval time.strftime('%Y-%m-%d')
|
||||
date_from: !eval "'%s-%s-01' %(datetime.now().year, datetime.now().month)"
|
||||
date_to: !eval "'%s-%s-30' %(datetime.now().year, datetime.now().month)"
|
||||
name: Sheet for hr manager
|
||||
state: new
|
||||
user_id: res_users_hrmanager0
|
||||
employee_id : 'hr_employee_hrmanager0'
|
||||
|
||||
-
|
||||
-
|
||||
Create a project 'Timesheet Management'
|
||||
-
|
||||
-
|
||||
!record {model: project.project, id: project_project_timesheetmanagement0}:
|
||||
company_id: base.main_company
|
||||
name: Timesheet Management
|
||||
|
||||
|
||||
-
|
||||
|
||||
|
||||
-
|
||||
Create a task 'Get all timesheet records'
|
||||
-
|
||||
-
|
||||
!record {model: project.task, id: project_task_getalltimesheetrecords0}:
|
||||
date_start: '2010-06-03 14:54:55'
|
||||
date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
name: Get all timesheet records
|
||||
planned_hours: 20.0
|
||||
project_id: project_project_timesheetmanagement0
|
||||
remaining_hours: 20.0
|
||||
state: draft
|
||||
user_id: res_users_hrmanager0
|
||||
|
||||
-
|
||||
|
||||
-
|
||||
Open the task
|
||||
-
|
||||
-
|
||||
!python {model: project.task}: |
|
||||
self.do_open(cr, uid, [ref("project_task_getalltimesheetrecords0")], {"lang":
|
||||
"en_US", "active_ids": [ref("project_project_timesheetmanagement0")], "tz":
|
||||
False, "active_model": "project.project", "department_id": False, "project_id":
|
||||
False, "active_id": ref("project_project_timesheetmanagement0"), })
|
||||
|
||||
-
|
||||
Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager
|
||||
-
|
||||
-
|
||||
Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager
|
||||
-
|
||||
!record {model: project.task, id: project_task_getalltimesheetrecords0}:
|
||||
work_ids:
|
||||
- date: '2010-06-03 15:04:47'
|
||||
- date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
hours: 10.0
|
||||
name: Get work calendar of all employees
|
||||
name: Get work calendar of all employees
|
||||
user_id: res_users_hrmanager0
|
||||
|
||||
-
|
||||
Check for timesheet_ids in HR manager's timesheet
|
||||
-
|
||||
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0, string: After hr manager's work task, length of timesheet line of current timesheet must be greater then 1}:
|
||||
- len(timesheet_ids) > 0
|
||||
- len(timesheet_ids) > 0
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in New Issue