diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 54e0af4ee26..fa150b291dc 100755 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -124,7 +124,6 @@ class account_analytic_line(osv.osv): result = round(amount, prec) if not flag: result *= -1 - return {'value': { 'amount': result, 'general_account_id': a, diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index a42d35c59ed..a2e641dc39c 100755 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -405,6 +405,27 @@ account_bank_statement() class account_bank_statement_line(osv.osv): + def onchange_partner_id(self, cr, uid, ids, partner_id, context=None): + obj_partner = self.pool.get('res.partner') + if context is None: + context = {} + if not partner_id: + return {} + part = obj_partner.browse(cr, uid, partner_id, context=context) + if not part.supplier and not part.customer: + type = 'general' + elif part.supplier and part.customer: + type = 'general' + else: + if part.supplier == True: + type = 'supplier' + if part.customer == True: + type = 'customer' + res_type = self.onchange_type(cr, uid, ids, partner_id=partner_id, type=type, context=context) + if res_type['value'] and res_type['value'].get('account_id', False): + return {'value': {'type': type, 'account_id': res_type['value']['account_id']}} + return {'value': {'type': type}} + def onchange_type(self, cr, uid, line_id, partner_id, type, context=None): res = {'value': {}} obj_partner = self.pool.get('res.partner') diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 2522e53b2a0..9b4af85164e 100755 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -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: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index bf17e607e24..fa1f9d28e87 100755 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -2,6 +2,7 @@ + diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b5b4e86bc5f..3a8c8feb669 100755 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -179,6 +179,7 @@ + @@ -565,7 +566,7 @@ - + @@ -574,12 +575,12 @@
+ + - - @@ -2633,7 +2634,7 @@ action = self.pool.get('res.config').next(cr, uid, [], context) - + @@ -2642,12 +2643,12 @@ action = self.pool.get('res.config').next(cr, uid, [], context) + + - - diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml index 673cdfab8e1..dd424e17ceb 100755 --- a/addons/account/board_account_view.xml +++ b/addons/account/board_account_view.xml @@ -27,6 +27,7 @@ tree,graph {'group_by':['user_type'], 'group_by_no_leaf':1} + [('year','=',time.strftime('%Y'))] Treasury diff --git a/addons/account/invoice.py b/addons/account/invoice.py index f094e1c5f3b..0eb1a2ed33b 100755 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -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 @@ -1009,15 +991,13 @@ class account_invoice(osv.osv): return True def action_cancel(self, cr, uid, ids, *args): + context = {} # TODO: Use context from arguments account_move_obj = self.pool.get('account.move') invoices = self.read(cr, uid, ids, ['move_id', 'payment_ids']) + move_ids = [] # ones that we will need to remove for i in invoices: if i['move_id']: - account_move_obj.button_cancel(cr, uid, [i['move_id'][0]]) - # delete the move this invoice was pointing to - # Note that the corresponding move_lines and move_reconciles - # will be automatically deleted too - account_move_obj.unlink(cr, uid, [i['move_id'][0]]) + move_ids.append(i['move_id'][0]) if i['payment_ids']: account_move_line_obj = self.pool.get('account.move.line') pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids']) @@ -1025,7 +1005,15 @@ class account_invoice(osv.osv): if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids: raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!')) + # First, set the invoices as cancelled and detach the move ids self.write(cr, uid, ids, {'state':'cancel', 'move_id':False}) + if move_ids: + # second, invalidate the move(s) + account_move_obj.button_cancel(cr, uid, move_ids, context=context) + # delete the move this invoice was pointing to + # Note that the corresponding move_lines and move_reconciles + # will be automatically deleted too + account_move_obj.unlink(cr, uid, move_ids, context=context) self._log_event(cr, uid, ids, -1.0, 'Cancel Invoice') return True diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py index e80cb290889..266b4a056d7 100755 --- a/addons/account/report/account_entries_report.py +++ b/addons/account/report/account_entries_report.py @@ -94,25 +94,21 @@ class account_entries_report(osv.osv): return super(account_entries_report, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order, context=context, count=count) - def read_group(self, cr, uid, domain, *args, **kwargs): - todel=[] + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): + if context is None: + context = {} fiscalyear_obj = self.pool.get('account.fiscalyear') period_obj = self.pool.get('account.period') - for arg in domain: - if arg[0] == 'period_id' and arg[2] == 'current_period': - current_period = period_obj.find(cr, uid)[0] - domain.append(['period_id','in',[current_period]]) - todel.append(arg) - break - elif arg[0] == 'period_id' and arg[2] == 'current_year': - current_year = fiscalyear_obj.find(cr, uid) - ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] - domain.append(['period_id','in',ids]) - todel.append(arg) - for a in [['period_id','in','current_year'], ['period_id','in','current_period']]: - if a in domain: - domain.remove(a) - return super(account_entries_report, self).read_group(cr, uid, domain, *args, **kwargs) + if context.get('period', False) == 'current_period': + current_period = period_obj.find(cr, uid)[0] + domain.append(['period_id','in',[current_period]]) + elif context.get('year', False) == 'current_year': + current_year = fiscalyear_obj.find(cr, uid) + ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids'] + domain.append(['period_id','in',ids]) + else: + domain = domain + return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby) def init(self, cr): tools.drop_view_if_exists(cr, 'account_entries_report') diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index d2d5883e947..baa9e15182b 100755 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -70,11 +70,11 @@ diff --git a/addons/account/report/common_report_header.py b/addons/account/report/common_report_header.py index 809cb38e879..48e26e839d3 100755 --- a/addons/account/report/common_report_header.py +++ b/addons/account/report/common_report_header.py @@ -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 diff --git a/addons/account_followup/report/account_followup_report.py b/addons/account_followup/report/account_followup_report.py index 878f44ced30..8d4b914ffa6 100755 --- a/addons/account_followup/report/account_followup_report.py +++ b/addons/account_followup/report/account_followup_report.py @@ -40,7 +40,6 @@ class account_followup_stat(osv.osv): 'company_id': fields.many2one('res.company', 'Company', readonly=True), 'blocked': fields.boolean('Blocked', readonly=True), 'period_id': fields.many2one('account.period', 'Period', readonly=True), - } _order = 'date_move' @@ -69,7 +68,7 @@ class account_followup_stat(osv.osv): cr.execute(""" create or replace view account_followup_stat as ( SELECT - l.id AS id, + l.partner_id as id, l.partner_id AS partner_id, min(l.date) AS date_move, max(l.date) AS date_move_last, diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index 7d296f74f76..5d9c2da860f 100755 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -219,8 +219,8 @@ class account_followup_print_all(osv.osv_memory): partners = [] dict_lines = {} for line in move_lines: - partners.append(line.name) - dict_lines[line.name.id] =line + partners.append(line.partner_id) + dict_lines[line.partner_id.id] =line for partner in partners: ids_lines = move_obj.search(cr,uid,[('partner_id','=',partner.id),('reconcile_id','=',False),('account_id.type','in',['receivable'])]) data_lines = move_obj.browse(cr, uid, ids_lines, context=context) @@ -275,8 +275,11 @@ class account_followup_print_all(osv.osv_memory): sub = tools.ustr(data['email_subject']) msg = '' if dest: - tools.email_send(src,dest,sub,body) - msg_sent += partner.name + '\n' + try: + tools.email_send(src, dest, sub, body) + msg_sent += partner.name + '\n' + except Exception, e: + raise osv.except_osv('Error !', e ) else: msg += partner.name + '\n' msg_unsent += msg @@ -301,7 +304,7 @@ class account_followup_print_all(osv.osv_memory): 'type': 'ir.actions.act_window', 'target': 'new', 'nodestroy': True - } + } def do_print(self, cr, uid, ids, context=None): if context is None: diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index fadef9a475f..5be5ed63cc1 100755 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -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 diff --git a/addons/account_voucher/test/sales_receipt.yml b/addons/account_voucher/test/sales_receipt.yml index a1793527f67..d3fd720ec6d 100755 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -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 - diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 3a3e996975f..e73354eb59a 100755 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -89,13 +89,13 @@ - + - + - + - + + - @@ -211,6 +211,7 @@ attrs="{'invisible':[('payment_option','!=','with_writeoff')]}" groups="analytic.group_analytic_accounting"/> + @@ -236,6 +237,8 @@ + + @@ -286,15 +289,15 @@ - + - + + + diff --git a/addons/membership/test/test_membership.yml b/addons/membership/test/test_membership.yml index 63c0082a60f..195fbd15b01 100755 --- a/addons/membership/test/test_membership.yml +++ b/addons/membership/test/test_membership.yml @@ -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".' - + diff --git a/addons/mrp/test/mrp_phantom_bom.yml b/addons/mrp/test/mrp_phantom_bom.yml index 6aa0d7cb17a..ac7e78637a4 100755 --- a/addons/mrp/test/mrp_phantom_bom.yml +++ b/addons/mrp/test/mrp_phantom_bom.yml @@ -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} - - + + diff --git a/addons/mrp/test/mrp_procurement.yml b/addons/mrp/test/mrp_procurement.yml index 47085904c35..568a5f0b0e8 100755 --- a/addons/mrp/test/mrp_procurement.yml +++ b/addons/mrp/test/mrp_procurement.yml @@ -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. diff --git a/addons/mrp/test/mrp_production_order.yml b/addons/mrp/test/mrp_production_order.yml index c32665f7258..6c1a2a4403e 100755 --- a/addons/mrp/test/mrp_production_order.yml +++ b/addons/mrp/test/mrp_production_order.yml @@ -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 _ diff --git a/addons/mrp_jit/test/mrp_jit.yml b/addons/mrp_jit/test/mrp_jit.yml index 9d811d8b3e6..922dc3611bd 100755 --- a/addons/mrp_jit/test/mrp_jit.yml +++ b/addons/mrp_jit/test/mrp_jit.yml @@ -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} - | diff --git a/addons/mrp_operations/test/mrp_operations.yml b/addons/mrp_operations/test/mrp_operations.yml index afa3fa55d74..4830da3a545 100755 --- a/addons/mrp_operations/test/mrp_operations.yml +++ b/addons/mrp_operations/test/mrp_operations.yml @@ -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!') diff --git a/addons/mrp_repair/test/test_mrp_repair.yml b/addons/mrp_repair/test/test_mrp_repair.yml index 3d9e85aa3ac..881ef449405 100755 --- a/addons/mrp_repair/test/test_mrp_repair.yml +++ b/addons/mrp_repair/test/test_mrp_repair.yml @@ -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" diff --git a/addons/mrp_subproduct/test/mrp_subproduct.yml b/addons/mrp_subproduct/test/mrp_subproduct.yml index 56c62b94d09..43bb6e7247e 100755 --- a/addons/mrp_subproduct/test/mrp_subproduct.yml +++ b/addons/mrp_subproduct/test/mrp_subproduct.yml @@ -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 diff --git a/addons/point_of_sale/point_of_sale_demo.xml b/addons/point_of_sale/point_of_sale_demo.xml index 03d04d83f70..38987b78cf5 100755 --- a/addons/point_of_sale/point_of_sale_demo.xml +++ b/addons/point_of_sale/point_of_sale_demo.xml @@ -26,7 +26,7 @@ / - 2010-10-07 + time.strftime('%Y-%m-%d') @@ -53,7 +53,7 @@ 2011-04-07 - 2010-10-07 16:53:11 + time.strftime('%Y-%m-%d %H:%M:%S') @@ -62,7 +62,7 @@ paid - 2010-10-07 + time.strftime('%Y-%m-%d') POS/019 tax_excluded @@ -76,7 +76,7 @@ - 2010-10-07 + time.strftime('%Y-%m-%d') @@ -87,7 +87,7 @@ Cash Journal - (test) - 2010-10-07 + time.strftime('%Y-%m-%d') @@ -98,18 +98,18 @@ POS/019 - 2010-10-07 16:53:46 + time.strftime('%Y-%m-%d %H:%M:%S') direct POS notes done out - 2010-10-07 16:53:46 - 2010-10-07 16:33:30 + time.strftime('%Y-%m-%d %H:%M:%S') + time.strftime('%Y-%m-%d %H:%M:%S') OUT/00019 none - 2010-10-07 16:53:46 + time.strftime('%Y-%m-%d %H:%M:%S') POS/019 @@ -123,12 +123,12 @@ done - 2010-10-07 16:33:30 - 2010-10-07 16:33:30 + time.strftime('%Y-%m-%d %H:%M:%S') + time.strftime('%Y-%m-%d %H:%M:%S') Stock move (POS 12) - 2010-10-07 16:53:46 + time.strftime('%Y-%m-%d %H:%M:%S') @@ -166,7 +166,7 @@ - 2010/09/15 + time.strftime('%Y-%m-%d') [PC3] Medium PC @@ -178,7 +178,7 @@ - 2010/09/15 + time.strftime('%Y-%m-%d') [PC2] Basic+ PC (assembly on order) @@ -190,7 +190,7 @@ - 2010/09/15 + time.strftime('%Y-%m-%d') [PC1] Basic PC diff --git a/addons/point_of_sale/test/point_of_sale_report.yml b/addons/point_of_sale/test/point_of_sale_report.yml index 1a77e8f30d4..323d227f7d2 100755 --- a/addons/point_of_sale/test/point_of_sale_report.yml +++ b/addons/point_of_sale/test/point_of_sale_report.yml @@ -89,11 +89,11 @@ !record {model: account.bank.statement, id: account_bank_statement_st0}: name: St.05/19 balance_end_real: 0.0 - date: '2010-05-19' + date: !eval time.strftime('%Y-%m-%d') journal_id: account_journal_cash0 line_ids: - name: statement - date: "2010-10-13" + date: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+5,datetime.now().day)" type: customer account_id: account_pos_account_sales amount: 100 diff --git a/addons/point_of_sale/test/point_of_sale_test.yml b/addons/point_of_sale/test/point_of_sale_test.yml index 347ea961c8f..7e463b1410a 100755 --- a/addons/point_of_sale/test/point_of_sale_test.yml +++ b/addons/point_of_sale/test/point_of_sale_test.yml @@ -289,8 +289,8 @@ - !record {model: pos.order, id: pos_order_pos0}: company_id: base.main_company - date_order: '2010-05-13 15:02:48' - date_validity: '2010-11-13' + date_order: !eval time.strftime('%Y-%m-%d %H:%M:%S') + date_validity: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)" lines: - company_id: base.main_company name: Order Line/01 @@ -336,7 +336,7 @@ !record {model: pos.make.payment, id: pos_make_payment_0}: amount: 1615.0 journal: 7 - payment_date: "2010-05-13" + payment_date: !eval time.strftime("%Y-%m-%d") payment_name: Payment product_id: product_product_hppaviliondesktoppcs0 pricelist_id: product.list0 @@ -398,7 +398,7 @@ !record {model: pos.make.payment, id: pos_make_payment_1}: amount: 680.0 journal: 7 - payment_date: "2010-05-13" + payment_date: !eval time.strftime("%Y-%m-%d") payment_name: Payment product_id: product_product_hppaviliondesktoppcs0 pricelist_id: product.list0 diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml index bca3bcbff41..f79c2a34224 100755 --- a/addons/project/test/test_project.yml +++ b/addons/project/test/test_project.yml @@ -10,7 +10,7 @@ Create task 'Technical Training' for this project - !record {model: project.task, id: project_task_technicaltraining0}: - date_start: '2010-05-31 11:48:38' + date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Technical Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 @@ -20,7 +20,7 @@ Create task 'Functional Training' for this project - !record {model: project.task, id: project_task_functionaltraining0}: - date_start: '2010-05-31 11:49:11' + date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Functional Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 @@ -136,7 +136,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-05-31 15:04:22' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on OpenERP modules, models and classes user_id: base.user_root @@ -151,7 +151,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-06-01 15:04:46' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on OpenERP xml views user_id: base.user_root @@ -166,7 +166,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-06-02 15:05:24' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on workflows user_id: base.user_root @@ -202,7 +202,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-05-31 15:08:40' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on reports and wizards user_id: base.user_root @@ -253,7 +253,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-05-31 16:55:27' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 5.0 name: Training on yml user_id: base.user_root diff --git a/addons/project_long_term/test/schedule_phase_tasks.yml b/addons/project_long_term/test/schedule_phase_tasks.yml index aa54fa1ac57..ddfdc47cc7c 100755 --- a/addons/project_long_term/test/schedule_phase_tasks.yml +++ b/addons/project_long_term/test/schedule_phase_tasks.yml @@ -15,7 +15,7 @@ Create phase 'Develop GUI' in Outlook - !record {model: project.phase, id: project_phase_phase0}: - date_start: '2010-06-02' + date_start: !eval time.strftime("%Y-%m-%d") duration: 200.0 name: Develop GUI in Outlook product_uom: product.uom_day diff --git a/addons/project_long_term/test/schedule_project_phases.yml b/addons/project_long_term/test/schedule_project_phases.yml index e06feaaa4ca..38260f4df8c 100755 --- a/addons/project_long_term/test/schedule_project_phases.yml +++ b/addons/project_long_term/test/schedule_project_phases.yml @@ -9,7 +9,7 @@ Create a project phase 'Defining Client's Basic Idea of Project' - !record {model: project.phase, id: project_phase_definingclientsbasicideaofproject0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 15.0 name: "Defining Client's Basic Idea of Project" product_uom: product.uom_day @@ -20,7 +20,7 @@ Create project phase 'Establishing Project Feasibility' - !record {model: project.phase, id: project_phase_establishingprojectfeasibility0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 30.0 name: Establishing Project Feasibility product_uom: product.uom_day @@ -30,7 +30,7 @@ Create project phase 'Preparation of Engineering Designs' - !record {model: project.phase, id: project_phase_preparationofengineeringdesigns0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 100.0 name: Preparation of Engineering Designs product_uom: product.uom_hour @@ -41,7 +41,7 @@ Create project phase 'Procurement of Works and Goods' - !record {model: project.phase, id: project_phase_procurementofworksandgoods0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 24.0 name: Procurement of Works and Goods product_uom: product.uom_hour @@ -52,7 +52,7 @@ Create project phase 'Project Construction' - !record {model: project.phase, id: project_phase_projectconstruction0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 4320.0 name: Project Construction product_uom: product.uom_hour @@ -63,7 +63,7 @@ Create project phase 'Project Completion' - !record {model: project.phase, id: project_phase_projectcompletion0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 240.0 name: Project Completion product_uom: product.uom_hour diff --git a/addons/project_long_term/test/schedule_project_tasks.yml b/addons/project_long_term/test/schedule_project_tasks.yml index 04a05437487..825b7c404d9 100755 --- a/addons/project_long_term/test/schedule_project_tasks.yml +++ b/addons/project_long_term/test/schedule_project_tasks.yml @@ -16,7 +16,7 @@ Create phase 'Develop GUI' in thunderbird - !record {model: project.phase, id: project_phase_phase1}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 200.0 name: Develop GUI in thunderbird product_uom: product.uom_day diff --git a/addons/project_mrp/test/project_task_procurement.yml b/addons/project_mrp/test/project_task_procurement.yml index a997f09fd04..caea7d70e0a 100755 --- a/addons/project_mrp/test/project_task_procurement.yml +++ b/addons/project_mrp/test/project_task_procurement.yml @@ -19,7 +19,7 @@ I create a sale order for product Partners Training which has type 'Service'. - !record {model: sale.order, id: sale_order_so0}: - date_order: '2010-05-21' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: SO006 order_policy: manual diff --git a/addons/project_planning/test/planning_states.yml b/addons/project_planning/test/planning_states.yml index 12dd38c8247..5d40a199280 100755 --- a/addons/project_planning/test/planning_states.yml +++ b/addons/project_planning/test/planning_states.yml @@ -3,8 +3,8 @@ - !record {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0}: business_days: 20 - date_from: '2010-06-01' - date_to: '2010-06-30' + date_from: !eval time.strftime('%Y-%m-%d') + date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+1,datetime.now().day)" name: Project Planning state: draft user_id: base.user_demo diff --git a/addons/project_retro_planning/test/deadline_change.yml b/addons/project_retro_planning/test/deadline_change.yml index 3e778916792..39dec6bf42a 100755 --- a/addons/project_retro_planning/test/deadline_change.yml +++ b/addons/project_retro_planning/test/deadline_change.yml @@ -10,9 +10,9 @@ Create task 'Plan all projects' - !record {model: project.task, id: project_task_planallprojects0}: - date_deadline: '2010-06-07' - date_end: '2010-06-04 14:00:00' - date_start: '2010-06-01 17:25:32' + date_deadline: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month,datetime.now().day+6)" + date_end: !eval "'%s-%s-%s %s:%s:%s' %(datetime.now().year,datetime.now().month,datetime.now().day+3,datetime.now().hour,datetime.now().minute,datetime.now().second)" + date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Plan all projects planned_hours: 24.0 project_id: project_project_retroplanning0 diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml index 7b69627a00a..86ad19c9943 100755 --- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml +++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml @@ -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 diff --git a/addons/purchase/test/procurement_buy.yml b/addons/purchase/test/procurement_buy.yml index 2afd6c2fb62..83eec43594b 100755 --- a/addons/purchase/test/procurement_buy.yml +++ b/addons/purchase/test/procurement_buy.yml @@ -1,9 +1,9 @@ - - In order to test the procurement with product type buy in OpenERP, I will create product + In order to test the procurement with product type buy in OpenERP, I will create product and then I will create procurement for this product. -- +- I create product. -- +- !record {model: product.product, id: product_product_cddrive0}: categ_id: product.product_category_3 cost_method: standard @@ -27,12 +27,12 @@ name: base.res_partner_asus min_qty: 2.0 qty: 5.0 -- +- I create procurement order. -- +- !record {model: procurement.order, id: procurement_order_testcase0}: company_id: base.main_company - date_planned: '2010-07-07 15:38:53' + date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S') location_id: stock.stock_location_stock name: Test Case priority: '1' @@ -43,13 +43,13 @@ product_uos: product.product_uom_unit product_uos_qty: 0.0 state: draft -- +- I confirm on procurement order. -- +- !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_testcase0} -- +- I run the scheduler. -- +- !function {model: procurement.order, name: run_scheduler}: - model: procurement.order search: "[]" @@ -66,19 +66,19 @@ !python {model: procurement.order}: | from tools.translate import _ proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0] - assert(proc_ids.state == 'running'), _('Exception') -- + assert(proc_ids.state == 'running'), _('Exception') +- I confirm and Approve the purchase order. -- +- !python {model: purchase.order}: | procurement_obj = self.pool.get('procurement.order') proc_ids = procurement_obj.browse(cr, uid, [ref('procurement_order_testcase0')])[0] import netsvc wf_service = netsvc.LocalService("workflow") - wf_service.trg_validate(uid, 'purchase.order',proc_ids.purchase_id.id,'purchase_confirm', cr) -- + wf_service.trg_validate(uid, 'purchase.order',proc_ids.purchase_id.id,'purchase_confirm', cr) +- I receive the order of the supplier ASUStek from the Incoming Shipments menu. -- +- !python {model: stock.picking }: | import time procurement_obj = self.pool.get('procurement.order') @@ -96,7 +96,7 @@ 'product_id': move.product_id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } + } self.do_partial(cr, uid, [picking.id], partial_datas) - I confirm the Reservation. @@ -111,4 +111,4 @@ !python {model: procurement.order}: | from tools.translate import _ proc_ids = self.browse(cr, uid, [ref('procurement_order_testcase0')])[0] - assert(proc_ids.state == 'done'), _('Order is not in done state') + assert(proc_ids.state == 'done'), _('Order is not in done state') diff --git a/addons/purchase/test/purchase_from_manual.yml b/addons/purchase/test/purchase_from_manual.yml index 6b95748bc4d..2739d74110e 100755 --- a/addons/purchase/test/purchase_from_manual.yml +++ b/addons/purchase/test/purchase_from_manual.yml @@ -28,11 +28,11 @@ - !record {model: purchase.order, id: purchase_order_po1}: company_id: base.main_company - date_order: '2010-05-11' + date_order: !eval time.strftime('%Y-%m-%d') invoice_method: manual location_id: stock.stock_location_stock order_line: - - date_planned: '2010-05-13' + - date_planned: !eval time.strftime('%Y-%m-%d') name: iPod price_unit: 100.0 product_id: 'product_product_ipod0' diff --git a/addons/purchase/test/purchase_from_order.yml b/addons/purchase/test/purchase_from_order.yml index ca089db7821..3acc68cb51b 100755 --- a/addons/purchase/test/purchase_from_order.yml +++ b/addons/purchase/test/purchase_from_order.yml @@ -23,16 +23,16 @@ weight_net: 0.0 - In order to test the purchase flow,I create a new record where "invoice_method" is From Order. -- +- I create purchase order for iPod. -- +- !record {model: purchase.order, id: purchase_order_po0}: company_id: base.main_company - date_order: '2010-05-11' + date_order: !eval time.strftime('%Y-%m-%d') invoice_method: order location_id: stock.stock_location_stock order_line: - - date_planned: '2010-05-13' + - date_planned: !eval time.strftime('%Y-%m-%d') name: iPod price_unit: 100.0 product_id: 'product_product_ipod0' @@ -42,20 +42,20 @@ partner_address_id: base.res_partner_address_7 partner_id: base.res_partner_4 pricelist_id: purchase.list0 -- +- Initially purchase order is in the draft state. - !assert {model: purchase.order, id: purchase_order_po0}: - - state == 'draft' + - state == 'draft' - I confirm the purchase order for iPod. - !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po0} -- +- I check that the order which was initially in the draft state has transit to confirm state. - !assert {model: purchase.order, id: purchase_order_po0}: - - state == 'approved' + - state == 'approved' - I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line. - @@ -76,7 +76,7 @@ I create invoice for products in the purchase order. - !python {model: purchase.order.line_invoice}: | - pur_obj=self.pool.get('purchase.order') + pur_obj=self.pool.get('purchase.order') ids = [] pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po0")) for line in pur_id1.order_line: @@ -104,7 +104,7 @@ I check that the order which was initially in the confirmed state has transit to approved state. - !assert {model: purchase.order, id: purchase_order_po0}: - - state == 'approved' + - state == 'approved' - I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved. - @@ -112,7 +112,7 @@ pur_id=self.browse(cr, uid, ref("purchase_order_po0")) assert(pur_id.date_approve) - - I check that an entry gets created in the pickings. + I check that an entry gets created in the pickings. - !python {model: purchase.order}: | pur_id=self.browse(cr, uid, ref("purchase_order_po0")) @@ -132,7 +132,7 @@ - I check that Traceability moves are created. - - I check that an invoice_ids field of Delivery&Invoices gets bind with the value. + I check that an invoice_ids field of Delivery&Invoices gets bind with the value. - !python {model: purchase.order}: | pur_id2=self.browse(cr, uid, ref("purchase_order_po0")) diff --git a/addons/purchase/test/purchase_from_picking.yml b/addons/purchase/test/purchase_from_picking.yml index 357d865b9c9..94239ba28c4 100755 --- a/addons/purchase/test/purchase_from_picking.yml +++ b/addons/purchase/test/purchase_from_picking.yml @@ -28,11 +28,11 @@ - !record {model: purchase.order, id: purchase_order_po2}: company_id: base.main_company - date_order: '2010-05-11' + date_order: !eval time.strftime('%Y-%m-%d') invoice_method: picking location_id: stock.stock_location_stock order_line: - - date_planned: '2010-05-13' + - date_planned: !eval time.strftime('%Y-%m-%d') name: iPod price_unit: 100.0 product_id: 'product_product_ipod0' @@ -132,10 +132,11 @@ Then I create an invoice from picking by clicking on "Create Invoice" wizard - !python {model: stock.invoice.onshipping}: | + import time pur_obj=self.pool.get('purchase.order') pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2")) pick_ids = [x.id for x in pur_id1.picking_ids] - id = self.create(cr, uid, {'invoice_date': '2010-05-11', 'journal_id': ref('account.expenses_journal')}, + id = self.create(cr, uid, {'invoice_date': time.strftime('%Y-%m-%d'), 'journal_id': ref('account.expenses_journal')}, {'active_ids': pick_ids}) self.create_invoice(cr, uid, [id], {"active_ids": pick_ids, "active_id": pick_ids[0]}) - diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index c61a83a9b39..fb5fa774fc3 100755 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -2,10 +2,10 @@ - In order to test the purchase requisition module, I will do a sale order -> purchase_requisition -> purchase flow and I will buy the required products at two different suppliers. -- +- I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, with the generation of purchase requisitions. -- +- !record {model: product.product, id: product_product_laptopacer0}: categ_id: product.product_category_3 cost_method: standard @@ -26,12 +26,12 @@ warranty: 0.0 weight: 0.0 weight_net: 0.0 - list_price: 100.0 -- + list_price: 100.0 +- Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0001. -- +- !record {model: sale.order, id: sale_order_testtender0}: - date_order: '2010-05-10' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: TEST/TENDER/0001 order_line: @@ -53,43 +53,43 @@ picking_policy: direct pricelist_id: product.list0 shop_id: sale.shop -- +- I confirm the sale order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender0} -- +- I launch the scheduler to compute all procurements, and specify all requisitions orders. -- +- !python {model: procurement.order.compute.all}: | proc_obj = self.pool.get('procurement.order') proc_obj._procure_confirm(cr,uid) - On the purchase requisition, I create a new purchase order for the supplier 'DistriPC' by clicking on - the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC . -- + the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC . +- !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: partner_address_id: base.res_partner_address_7 partner_id: base.res_partner_4 -- +- I create a new purchase order. -- +- !python {model: purchase.requisition.partner}: | req_obj = self.pool.get('purchase.requisition') ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER')]) self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang": 'en_US', "active_model": "purchase.requisition", "tz": False, "record_id": 1, "active_ids": ids, "active_id": ids[0], }) - + - - I check that I have two purchase orders on the purchase requisition. + I check that I have two purchase orders on the purchase requisition. - !python {model: purchase.order}: | - from tools.translate import _ + from tools.translate import _ order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) ids=len(order_ids) - assert(ids == 2), _('Purchase Order not Created') + assert(ids == 2), _('Purchase Order not Created') -- +- I set the purchase requisition as 'Not Exclusive'. - !python {model: purchase.requisition}: | @@ -98,49 +98,49 @@ - I change the quantities so that the purchase order for DistriPC includes 3 pieces and the purchase order for Asustek includes 2 pieces. -- +- !python {model: purchase.order}: | - line_obj=self.pool.get('purchase.order.line') - partner_obj=self.pool.get('res.partner') + line_obj=self.pool.get('purchase.order.line') + partner_obj=self.pool.get('res.partner') requistion_obj=self.pool.get('purchase.requisition') - requistion_ids =requistion_obj.search(cr, uid, [('origin','=','Laptop ACER')]) - partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] - partner_id2=partner_obj.search(cr,uid,[('name','=','Distrib PC')])[0] + requistion_ids =requistion_obj.search(cr, uid, [('origin','=','Laptop ACER')]) + partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] + partner_id2=partner_obj.search(cr,uid,[('name','=','Distrib PC')])[0] purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1),('requisition_id','in',requistion_ids)]) purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2),('requisition_id','in',requistion_ids)]) order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id line_obj.write(cr, uid, order_line1, {'product_qty':2}) - line_obj.write(cr, uid, order_line2, {'product_qty':3}) + line_obj.write(cr, uid, order_line2, {'product_qty':3}) - I confirm and validate both purchase orders. - !python {model: purchase.order}: | order_ids= self.search(cr, uid, []) import netsvc - wf_service = netsvc.LocalService("workflow") - for id in order_ids: - wf_service.trg_validate(uid, 'purchase.order',id,'purchase_confirm', cr) - wf_service.trg_validate(uid, 'purchase.order',id,'purchase_approve', cr) + wf_service = netsvc.LocalService("workflow") + for id in order_ids: + wf_service.trg_validate(uid, 'purchase.order',id,'purchase_confirm', cr) + wf_service.trg_validate(uid, 'purchase.order',id,'purchase_approve', cr) - I check that the delivery order of the customer is in state 'Waiting Goods'. - !python {model: stock.picking }: | - from tools.translate import _ + from tools.translate import _ picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) assert (pick.state =='confirmed'),_('Picking is not in confirm state.') - assert (pick.move_lines[0].state == 'waiting'), _('Stock Move is not Waiting state.') - + assert (pick.move_lines[0].state == 'waiting'), _('Stock Move is not Waiting state.') + - I receive the order of the supplier Asustek from the Incoming Products menu. - !python {model: stock.picking }: | import time - partner_obj=self.pool.get('res.partner') + partner_obj=self.pool.get('res.partner') order_obj=self.pool.get('purchase.order') - partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] + partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) @@ -154,14 +154,14 @@ 'product_id': move.product_id.id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } + } self.do_partial(cr, uid, picking_id,partial_datas) - I receive the order of the supplier DistriPC from the Incoming Shipments menu. -- +- !python {model: stock.picking }: | import time - partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] + partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) @@ -175,7 +175,7 @@ 'product_id': move.product_id.id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } + } self.do_partial(cr, uid, picking_id,partial_datas) - I check that the delivery order of the customer is in the state Available. diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index 7e798e59b35..1ab9bca9493 100755 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -3,7 +3,7 @@ purchase flow and I will buy the required products at two different suppliers. - I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, - with the generation of purchase requisitions. + with the generation of purchase requisitions. - !record {model: product.product, id: product_product_laptopacer1}: categ_id: product.product_category_3 @@ -17,16 +17,16 @@ - delay: 1 name: base.res_partner_asus qty: 5.0 - min_qty: 1.0 + min_qty: 1.0 supply_method: buy type: product uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit -- + uom_po_id: product.product_uom_unit +- Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0002 -- +- !record {model: sale.order, id: sale_order_testtender1}: - date_order: '2010-04-20' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: TEST/TENDER/0002 order_line: @@ -45,21 +45,21 @@ partner_shipping_id: base.res_partner_address_8 picking_policy: direct pricelist_id: product.list0 - shop_id: sale.shop -- + shop_id: sale.shop +- I confirm sale order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender1} -- +- I launch the scheduler to compute all procurements, and planify all requisitions orders. -- +- !python {model: procurement.order.compute.all}: | proc_obj = self.pool.get('procurement.order') proc_obj._procure_confirm(cr,uid) - I should find a purchase requisition with the origin 'TEST/TENDER/0002', that includes a request for 5 Laptop ACER, and a purchase order on the default supplier for this product. -- +- !python {model: purchase.requisition}: | requisition_ids =self.search(cr, uid, [('origin','=','Laptop ACER1')]) ids=len(requisition_ids) @@ -67,15 +67,15 @@ - On the purchase requisition, I create a new purchase order for the supplier 'DistriPC' by clicking on the button 'New Request for Quotation'. This opens a window to ask me the supplier and I set DistriPC . -- +- I Create purchase.requisition.partner . -- +- !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: partner_address_id: base.res_partner_address_7 partner_id: base.res_partner_4 -- +- I create a new purchase order for the supplier 'DistriPC'. -- +- !python {model: purchase.requisition.partner}: | req_obj = self.pool.get('purchase.requisition') ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) @@ -83,31 +83,31 @@ 'en_US', "active_model": "purchase.requisition", "tz": False, "record_id": 1, "active_ids": ids, "active_id": ids[0], }) - - I set the purchase requisition as 'Exclusive' -- + I set the purchase requisition as 'Exclusive' +- !python {model: purchase.requisition}: | ids =self.search(cr, uid, [('origin','=','Laptop ACER1')]) self.write(cr,uid,ids[0],{'exclusive': 'exclusive' }) - - I confirm and validate the Request for Quotation of ASUStek. + I confirm and validate the Request for Quotation of ASUStek. - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) + ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] import netsvc - wf_service = netsvc.LocalService("workflow") + wf_service = netsvc.LocalService("workflow") if purchase_id: wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_confirm', cr) - wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_approve', cr) + wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_approve', cr) - I check that Request for Quotation of DistriPC is cancelled. -- +- !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) + ids =req_obj.search(cr, uid, [('origin','=','Laptop ACER1')]) purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='cancel') diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 65991b798d8..3ed49f44b74 100755 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -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', diff --git a/addons/sale/test/advance_invoice.yml b/addons/sale/test/advance_invoice.yml index b4a985ec4e8..d582a7c3e37 100755 --- a/addons/sale/test/advance_invoice.yml +++ b/addons/sale/test/advance_invoice.yml @@ -1,9 +1,9 @@ - In order to test the Deposit wizard of sale module in the Open-ERP, I create a Sale Order for LG Viewty Smart for qty 100 having order_policy manual. -- +- !record {model: sale.order, id: sale_order_so5}: - date_order: '2010-07-17' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order order_line: - name: LG Viewty Smart @@ -26,14 +26,14 @@ shop_id: sale.shop - I use the Advance Payment wizard. -- +- !record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}: amount: 1000.0 product_id: product.product_product_pc3 qtty: 3.0 -- +- Then I click on the "Create Partial Invoice" button -- +- !python {model: sale.advance.payment.inv}: | self.create_invoices(cr, uid, [ref("sale_advance_payment_inv_0")], {"lang": 'en_US', "active_model": 'sale.order', "active_ids": [ref("sale_order_so5")], "tz": @@ -43,8 +43,8 @@ - !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so5")) - assert so.invoice_ids, "Invoices has not been generated for sale_order_so5" -- + assert so.invoice_ids, "Invoices has not been generated for sale_order_so5" +- I open the Invoice for the SO. - !python {model: account.invoice}: | @@ -91,18 +91,18 @@ assert(sale_id.invoiced == True), "Paid has not been set to true" - I confirm the Sale Order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_so5} - I click on "Create Invoice" button of Sales order to create the invoice. -- +- !workflow {model: sale.order, action: manual_invoice, ref: sale_order_so5} - I verify whether the invoice has been generated for SO - !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so5")) - assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so5" + assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so5" - I open the Invoice for the SO. - @@ -124,7 +124,7 @@ assert invoice_id, "Invoice is not in the open state" - I assign an analytic journal to the bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - diff --git a/addons/sale/test/invoice_on_ordered_qty.yml b/addons/sale/test/invoice_on_ordered_qty.yml index 96154f3cac8..785b2d8835e 100755 --- a/addons/sale/test/invoice_on_ordered_qty.yml +++ b/addons/sale/test/invoice_on_ordered_qty.yml @@ -1,10 +1,10 @@ - In order to test the Sale module in OpenERP, - I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice' and Invoice on 'Ordered quantities' + I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice' and Invoice on 'Ordered quantities' in order to create an invoice based on the ordered quantity - !record {model: sale.order, id: sale_order_so9}: - date_order: '2010-07-17' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO006 order_line: @@ -26,13 +26,13 @@ picking_policy: direct pricelist_id: product.list0 shop_id: sale.shop -- +- I confirm the Sale Order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_so9} - I verify that the picking has been generated for the sale order -- +- !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so9")) assert so.picking_ids,"Picking has not been generated for sale_order_so9" @@ -40,10 +40,10 @@ Then I confirm the picking - !record {model: stock.partial.picking, id: stock_partial_picking_0}: - date: '2010-07-17 17:52:09' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') - Then I done the picking -- +- !python {model: stock.picking }: | import time sale_order_obj = self.pool.get('sale.order') @@ -62,11 +62,11 @@ 'product_id': move.product_id.id, 'product_qty': '100', 'product_uom': move.product_uom.id, - } + } self.do_partial(cr, uid, [pick.id],partial_datas) - I click on Create Invoice button to create the invoice. -- +- !workflow {model: sale.order, action: manual_invoice, ref: sale_order_so9} - I verify whether the invoice has been generated for SO @@ -87,7 +87,7 @@ for inv_lines in inv_brw.invoice_line: qty1 = inv_lines.quantity assert qty1==qty, "Quantities are not same" -- +- I open the Invoice for the SO. - !python {model: account.invoice}: | @@ -100,7 +100,7 @@ wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) - Assign analytic journal into bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - @@ -116,7 +116,7 @@ ref('account.period_8'), ref('sale.account_journal_bankjournal0'), name='test') - - I verify the invoice are in paid state or not. + I verify the invoice are in paid state or not. - !python {model: account.invoice}: | sale_order_obj = self.pool.get('sale.order') diff --git a/addons/sale/test/invoice_on_shipped_qty.yml b/addons/sale/test/invoice_on_shipped_qty.yml index fb217302ce4..bf2795e0f5b 100755 --- a/addons/sale/test/invoice_on_shipped_qty.yml +++ b/addons/sale/test/invoice_on_shipped_qty.yml @@ -3,7 +3,7 @@ I create a Sale Order for Slider Mobile for 200 quantity having Shipping Policy 'Invoice from Picking' and Invoice on 'Shipped quantities' - !record {model: sale.order, id: sale_order_so6}: - date_order: '2010-07-17' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO006BIS order_line: @@ -25,13 +25,13 @@ picking_policy: direct pricelist_id: product.list0 shop_id: sale.shop -- +- I confirm the Sale Order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_so6} - I verify that the picking has been generated for the sale order -- +- !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so6")) assert so.picking_ids,"Picking has not been generated for sale_order_so6" @@ -39,10 +39,10 @@ Then I click on the "Product Sent" button of Outgoing Shipments - !record {model: stock.partial.picking, id: stock_partial_picking_0}: - date: '2010-07-17 17:52:09' -- + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') +- I change the quantity on the picking to 199, and confirm partially 100 PCE. -- +- !python {model: stock.picking }: | import time sale_order_obj = self.pool.get('sale.order') @@ -69,10 +69,11 @@ Then I click on 'Create Invoices' button - !python {model: stock.invoice.onshipping}: | - sale_obj = self.pool.get('sale.order') + import time + sale_obj = self.pool.get('sale.order') sale_id = sale_obj.browse(cr, uid, ref("sale_order_so6")) ids = [x.id for x in sale_id.picking_ids] - wiz_id = self.create(cr, uid, {'invoice_date': '2010-07-17', 'journal_id': ref('account.sales_journal')}, + wiz_id = self.create(cr, uid, {'invoice_date': time.strftime('%Y-%m-%d'), 'journal_id': ref('account.sales_journal')}, {'active_ids': ids}) self.create_invoice(cr, uid, [wiz_id], {"active_ids": ids, "active_id": ids[0]}) - @@ -98,7 +99,7 @@ for inv_lines in inv_brw.invoice_line: qty1=inv_lines.quantity assert (qty1 == qty), "Quantities are not the same" -- +- I open the Invoice for the SO. - !python {model: account.invoice}: | @@ -111,7 +112,7 @@ wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) - Assign analytic journal into bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - @@ -127,7 +128,7 @@ ref('account.period_8'), ref('sale.account_journal_bankjournal0'), name='test') - - I verify the invoice are in paid state or not. + I verify the invoice are in paid state or not. - !python {model: account.invoice}: | sale_order_obj = self.pool.get('sale.order') diff --git a/addons/sale/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml index 74fb95b19f7..c1535402f9b 100755 --- a/addons/sale/test/manual_order_policy.yml +++ b/addons/sale/test/manual_order_policy.yml @@ -3,7 +3,7 @@ I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice' - !record {model: sale.order, id: sale_order_so0}: - date_order: '2010-07-17' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO002 order_line: @@ -208,7 +208,7 @@ Then I click on the "Products Received" button of Incoming Shipments - !record {model: stock.partial.picking, id: stock_partial_picking_0}: - date: '2010-07-17 17:52:09' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') - I click on the "Validate" button - diff --git a/addons/sale/test/picking_order_policy.yml b/addons/sale/test/picking_order_policy.yml index de18c1c4426..4381c78f010 100755 --- a/addons/sale/test/picking_order_policy.yml +++ b/addons/sale/test/picking_order_policy.yml @@ -3,7 +3,7 @@ I create a Sale Order for Slider Mobile for qty 500 having Shipping Policy is 'Invoice from Picking' - !record {model: sale.order, id: sale_order_so7}: - date_order: '2010-07-15' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO007 order_line: @@ -31,7 +31,7 @@ !workflow {model: sale.order, action: order_confirm, ref: sale_order_so7} - I verify that picking has been generated for the sale order. -- +- !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so7")) assert so.picking_ids,"Picking has not been generated for sale_order_so7" @@ -62,10 +62,11 @@ Then I click on 'Create Invoices' button - !python {model: stock.invoice.onshipping}: | - sale_obj=self.pool.get('sale.order') + import time + sale_obj=self.pool.get('sale.order') sale_id=sale_obj.browse(cr, uid, ref("sale_order_so7")) ids = [x.id for x in sale_id.picking_ids] - wiz_id = self.create(cr, uid, {'invoice_date': '2010-07-15', 'journal_id': ref('account.sales_journal')}, + wiz_id = self.create(cr, uid, {'invoice_date': time.strftime('%Y-%m-%d'), 'journal_id': ref('account.sales_journal')}, {'active_ids': ids}) self.create_invoice(cr, uid, [wiz_id], {"active_ids": ids, "active_id": ids[0]}) - @@ -87,7 +88,7 @@ wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) - Assign analytic journal into bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - @@ -179,7 +180,7 @@ pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)]) for pur in pur_ids: wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr) -- +- I click on the "Approved by supplier" button to approve the purchase order - !python {model: sale.order}: | @@ -196,7 +197,7 @@ for pur in pur_ids: wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr) - - I verify that a picking related to purchase order has been generated. + I verify that a picking related to purchase order has been generated. - !python {model: sale.order}: | modules = self.pool.get('ir.module.module') @@ -208,11 +209,11 @@ pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)]) po = pur_obj.browse(cr, uid, pur_id)[0] assert(po.picking_ids),"Picking for purchase order has not been generated" -- +- Then I click on the "Products Received" button of Incoming Shipments - !record {model: stock.partial.picking, id: stock_partial_picking_0}: - date: '2010-07-15 17:52:09' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') - I click on the "Validate" button - @@ -276,8 +277,8 @@ 'product_id': move.product_id.id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } - self.do_partial(cr, uid, [pick.id],partial_datas) + } + self.do_partial(cr, uid, [pick.id],partial_datas) - I verify that delivery state is done - @@ -289,12 +290,12 @@ pick = self.browse(cr,uid,picking_id[0]) assert (pick.state) =='done', "Picking for SO is not in done state." - - I verify that a "Picked" has been set to true + I verify that a "Picked" has been set to true - !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so7")) assert (so.shipped == True), "Picked has not been set to True" -- +- I verify that a sale order is in done state - !python {model: sale.order}: | diff --git a/addons/sale/test/postpaid_order_policy.yml b/addons/sale/test/postpaid_order_policy.yml index bbd015d726b..330c6d17308 100755 --- a/addons/sale/test/postpaid_order_policy.yml +++ b/addons/sale/test/postpaid_order_policy.yml @@ -3,7 +3,7 @@ I create a Sale Order for Slider Mobile for qty 500 having Shipping Policy is 'Invoice on order after Delivery' - !record {model: sale.order, id: sale_order_so8}: - date_order: '2010-07-15' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO008 order_line: @@ -24,19 +24,19 @@ picking_policy: direct pricelist_id: product.list0 shop_id: sale.shop -- +- I confirm the Sale Order. -- - !workflow {model: sale.order, action: order_confirm, ref: sale_order_so8} +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_so8} - I verify that the picking has been generated for the sale order -- +- !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so8")) assert so.picking_ids,"Picking has not been generated for sale_order_so8" - Then I done the picking -- +- !python {model: stock.picking }: | import time sale_order_obj = self.pool.get('sale.order') @@ -55,7 +55,7 @@ 'product_id': move.product_id.id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } + } self.do_partial(cr, uid, [pick.id],partial_datas) - I verify that picking order is in done state. @@ -66,7 +66,7 @@ picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')]) if picking_id: pick = self.browse(cr,uid,picking_id[0]) - assert (pick.state == 'done'), "Picking for SO is not in done state." + assert (pick.state == 'done'), "Picking for SO is not in done state." - I verify that delivery order has been generated for sale order - @@ -96,8 +96,8 @@ 'product_id': move.product_id.id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } - self.do_partial(cr, uid, [pick.id],partial_datas) + } + self.do_partial(cr, uid, [pick.id],partial_datas) - I verify that delivery state is done - @@ -170,7 +170,7 @@ pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)]) for pur in pur_ids: wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr) -- +- I click on the "Approved by supplier" button to approve the purchase order - !python {model: sale.order}: | @@ -187,7 +187,7 @@ for pur in pur_ids: wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr) - - I verify that a picking related to purchase order has been generated. + I verify that a picking related to purchase order has been generated. - !python {model: sale.order}: | modules = self.pool.get('ir.module.module') @@ -199,11 +199,11 @@ pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)]) po = pur_obj.browse(cr, uid, pur_id)[0] assert(po.picking_ids),"Picking for purchase order has not been generated" -- +- Then I click on the "Products Received" button of Incoming Shipments - !record {model: stock.partial.picking, id: stock_partial_picking_0}: - date: '2010-07-15 17:52:09' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') - I click on the "Validate" button - @@ -239,7 +239,7 @@ ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ),('state', '=', 'done')]) assert ids, _('Picking is not in the done state!') - - I verify that a "Picked" has been set to true + I verify that a "Picked" has been set to true - !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so8")) @@ -250,20 +250,20 @@ !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so8")) assert so.invoice_ids, "Invoice has not been generated" -- +- I open the Invoice for the SO. -- +- !python {model: account.invoice}: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so8")) import netsvc - wf_service = netsvc.LocalService("workflow") + wf_service = netsvc.LocalService("workflow") invoice_ids = so.invoice_ids for invoice in invoice_ids: - wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) + wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) - Assign analytic journal into bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - @@ -279,7 +279,7 @@ ref('account.period_8'), ref('sale.account_journal_bankjournal0'), name='test') - - I verify the invoice are in paid state or not. + I verify the invoice are in paid state or not. - !python {model: account.invoice}: | modules = self.pool.get('ir.module.module') @@ -291,13 +291,13 @@ invoice_ids = so.invoice_ids for invoice in invoice_ids: assert (invoice.state) =='paid', "Invoice for SO is not in done state." -- +- I verify that Paid has been set to true. - !python {model: sale.order}: | sale_id=self.browse(cr, uid, ref("sale_order_so8")) assert(sale_id.invoiced == True), "Paid has not been set to true" -- +- I verify that sale order is in done state - !python {model: sale.order}: | diff --git a/addons/sale/test/prepaid_order_policy.yml b/addons/sale/test/prepaid_order_policy.yml index 5df007d1465..4bf132e5bee 100755 --- a/addons/sale/test/prepaid_order_policy.yml +++ b/addons/sale/test/prepaid_order_policy.yml @@ -1,8 +1,8 @@ -- +- I create a Sale Order for LG Viewty Smart for qty 500 having Shipping Policy is 'Payment Before Delivery' - !record {model: sale.order, id: sale_order_so1}: - date_order: '2010-07-20' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO001 order_line: @@ -55,7 +55,7 @@ wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr) - I assign an analytic journal to the Bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - @@ -71,7 +71,7 @@ ref('account.period_5'), ref('sale.account_journal_bankjournal0'), name='test002') - - I verify the invoice is in done state or not. + I verify the invoice is in done state or not. - !python {model: account.invoice}: | sale_order_obj = self.pool.get('sale.order') @@ -133,7 +133,7 @@ assert proc_ids, _('No Procurements!') - Then I click on the "Run Procurement" button -- +- !python {model: procurement.order}: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so1")) @@ -168,7 +168,7 @@ pur_obj=self.pool.get('purchase.order') pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)]) assert pur_id, _('Purchase order has not been generated') -- +- I click on the "Confirm" button to confirm the purchase order - !python {model: sale.order}: | @@ -184,7 +184,7 @@ pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)]) for pur in pur_ids: wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr) -- +- I click on the "Approved by supplier" button to approve the purchase order - !python {model: sale.order}: | @@ -199,9 +199,9 @@ wf_service = netsvc.LocalService("workflow") pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)]) for pur in pur_ids: - wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr) + wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr) - - I verify that a picking related to purchase order has been generated. + I verify that a picking related to purchase order has been generated. - !python {model: sale.order}: | modules = self.pool.get('ir.module.module') @@ -217,7 +217,7 @@ Then I click on the "Products Received" button of Incoming Shipments - !record {model: stock.partial.picking, id: stock_partial_picking_0}: - date: '2010-07-20 17:52:09' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') - I click on the "Validate" button - @@ -253,7 +253,7 @@ ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ),('state', '=', 'done')]) assert ids, _('Picking is not in the done state!') - - I verify that a "Picked" has been set to true + I verify that a "Picked" has been set to true - !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so1")) diff --git a/addons/sale/test/sale_procurement.yml b/addons/sale/test/sale_procurement.yml index f7753948339..923860ebfd3 100755 --- a/addons/sale/test/sale_procurement.yml +++ b/addons/sale/test/sale_procurement.yml @@ -25,7 +25,7 @@ uom_po_id: product.product_uom_kgm - I define Minimum stock rule for my stockable product Wood (qty between 10 and 15) -- +- !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}: company_id: base.main_company location_id: stock.stock_location_stock @@ -38,11 +38,11 @@ warehouse_id: stock.warehouse0 - Now I make a sale order for table. -- +- !record {model: sale.order, id: sale_order_so3}: amount_total: 5.0 amount_untaxed: 5.0 - date_order: '2010-04-30' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order order_line: - company_id: base.main_company @@ -65,7 +65,7 @@ shop_id: sale.shop - I confirm the order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_so3} - I check that procurement is generated. @@ -76,7 +76,7 @@ so = sale_order_obj.browse(cr, uid, ref("sale_order_so3")) proc_ids = self.search(cr, uid, [('origin','=',so.name)]) assert proc_ids, _('No Procurements!') -- +- I run the scheduler. - !function {model: procurement.order, name: run_scheduler}: diff --git a/addons/sale/test/so_make_invoice.yml b/addons/sale/test/so_make_invoice.yml index 053521208bf..727731b4745 100755 --- a/addons/sale/test/so_make_invoice.yml +++ b/addons/sale/test/so_make_invoice.yml @@ -5,7 +5,7 @@ I create a Sale Order for Slider Mobile for qty 100 having order_policy manual. - !record {model: sale.order, id: sale_order_so3}: - date_order: '2010-08-02' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO003 order_line: @@ -34,7 +34,7 @@ I create a Sale Order for products Slider Mobile and LG Viewty Smart for qty 100 having order_policy manual. - !record {model: sale.order, id: sale_order_so4}: - date_order: '2010-08-02' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO004 order_line: @@ -74,7 +74,7 @@ - !record {model: sale.make.invoice, id: sale_make_invoice_1}: grouped: 1 - invoice_date: '2010-08-02' + invoice_date: !eval time.strftime('%Y-%m-%d') - Then I click on the "Create Invoices" button of wizard - diff --git a/addons/sale/test/so_make_line_invoice.yml b/addons/sale/test/so_make_line_invoice.yml index d5e81c9e96c..14d405b0083 100755 --- a/addons/sale/test/so_make_line_invoice.yml +++ b/addons/sale/test/so_make_line_invoice.yml @@ -3,7 +3,7 @@ I create a Sale Order for two products LG Viewty Smart and Slider mobile for qty 100 having order_policy manual. - !record {model: sale.order, id: sale_order_so3}: - date_order: '2010-07-12' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO003 order_line: @@ -27,7 +27,7 @@ product_id: sale.product_product_lgviewtysmart0 product_uos_qty: 100.0 th_weight: 0.0 - type: make_to_order + type: make_to_order order_policy: manual partner_id: sale.res_partner_cleartrail0 partner_invoice_id: sale.res_partner_address_2 @@ -36,9 +36,9 @@ picking_policy: direct pricelist_id: product.list0 shop_id: sale.shop -- +- I confirm the Sale Order. -- +- !workflow {model: sale.order, action: order_confirm, ref: sale_order_so3} - I click on the "Make Invoice" button of sale order line @@ -47,11 +47,11 @@ {} - I click on the "Create Invoice" button of wizard -- +- !python {model: sale.order.line.make.invoice}: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so3")) - sol = so.order_line[0] + sol = so.order_line[0] self.make_invoices(cr, uid, [ref("sale_order_line_make_invoice_0")], {"lang": "en_US", "tz": False, "active_model": "sale.order.line", "active_ids": [sol.id], "search_default_uninvoiced": 1, "active_id": sol.id, @@ -61,7 +61,7 @@ - !python {model: sale.order}: | sale_id=self.browse(cr, uid, ref("sale_order_so3")) - sol = sale_id.order_line[0] + sol = sale_id.order_line[0] assert(sol.invoiced == True), "Invoiced has not been set to true" - I verify that an invoice for sale order line has been created. @@ -90,7 +90,7 @@ assert invoice_id, "Invoice is not in the open state" - I assign an analytic journal to the bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - @@ -106,7 +106,7 @@ ref('account.period_8'), ref('sale.account_journal_bankjournal0'), name='test') - - I verify that an invoice is in done state. + I verify that an invoice is in done state. - !python {model: account.invoice}: | sale_order_obj = self.pool.get('sale.order') @@ -123,14 +123,14 @@ I create an invoice for another sale order line. I click on the "Make Invoice" button of sale order line - !record {model: sale.order.line.make.invoice, id: sale_order_line_make_invoice_1}: - {} + {} - I click on the "Create Invoice" button of wizard - !python {model: sale.order.line.make.invoice}: | sale_order_obj = self.pool.get('sale.order') so = sale_order_obj.browse(cr, uid, ref("sale_order_so3")) - sol = so.order_line[1] + sol = so.order_line[1] self.make_invoices(cr, uid, [ref("sale_order_line_make_invoice_1")], {"lang": "en_US", "tz": False, "active_model": "sale.order.line", "active_ids": [sol.id], "search_default_uninvoiced": 1, "active_id": sol.id, @@ -146,7 +146,7 @@ - !python {model: sale.order}: | sale_id=self.browse(cr, uid, ref("sale_order_so3")) - sol = sale_id.order_line[1] + sol = sale_id.order_line[1] assert(sol.invoiced == True), "Invoiced has not been set to true" - I verify that "Paid" has been set to False. @@ -175,7 +175,7 @@ assert invoice_id, "Invoice is not in the open state" - Assign analytic journal into bank journal -- +- !record {model: account.journal, id: sale.account_journal_bankjournal0}: analytic_journal_id: account.cose_journal_sale - @@ -191,7 +191,7 @@ ref('account.period_8'), ref('sale.account_journal_bankjournal0'), name='test') - - I verify the invoice is in done state. + I verify the invoice is in done state. - !python {model: account.invoice}: | sale_order_obj = self.pool.get('sale.order') diff --git a/addons/sale_margin/test/sale_margin.yml b/addons/sale_margin/test/sale_margin.yml index c15ea3c2135..75eabce03b1 100755 --- a/addons/sale_margin/test/sale_margin.yml +++ b/addons/sale_margin/test/sale_margin.yml @@ -5,7 +5,7 @@ I place a sale order for product keyboard, quantity 50 - !record {model: sale.order, id: sale_order_so11}: - date_order: '2010-08-04' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO011 order_line: @@ -36,4 +36,4 @@ - !python {model: sale.order}: | so = self.browse(cr, uid, ref("sale_order_so11")) - assert so.margin, "No margin !" + assert so.margin, "No margin !" diff --git a/addons/sale_mrp/test/sale_mrp.yml b/addons/sale_mrp/test/sale_mrp.yml index 081b65e4611..739eea0d99d 100755 --- a/addons/sale_mrp/test/sale_mrp.yml +++ b/addons/sale_mrp/test/sale_mrp.yml @@ -5,9 +5,9 @@ - !record {model: product.category, id: product_category_allproductssellable0}: name: Mobile Products Sellable -- - I define product category Mobile Services. -- +- + I define product category Mobile Services. +- !record {model: product.category, id: product_category_services0}: name: Mobile Services - @@ -64,7 +64,7 @@ - !record {model: sale.order, id: sale_order_so0}: client_order_ref: ref1 - date_order: '2010-08-4' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: Test_SO001 order_line: diff --git a/addons/stock/test/stock_test.yml b/addons/stock/test/stock_test.yml index 696dd0900c6..762908e6b0c 100755 --- a/addons/stock/test/stock_test.yml +++ b/addons/stock/test/stock_test.yml @@ -2,56 +2,56 @@ - In order to test the stock module, I will create product, create physical inventory ,fill inventory lines from location,split inventory line into production lot - -- + +- I create Asset Account Type. -- +- !record {model: account.account.type, id: account_account_type_asset0}: close_method: balance code: asset name: Asset sign: 1 - -- + +- I create Income Account Type. -- +- !record {model: account.account.type, id: account_account_type_income0}: close_method: unreconciled code: income name: Income sign: 1 - - -- + + +- I create Expense Account Type. -- +- !record {model: account.account.type, id: account_account_type_expense0}: close_method: unreconciled code: expense name: Expense - sign: 1 -- + sign: 1 +- I create Cash Account Type. -- +- !record {model: account.account.type, id: account_account_type_cash0}: close_method: balance code: cash name: Cash sign: 1 - - -- + + +- I create Receivable Account Type. -- +- !record {model: account.account.type, id: account_account_type_receivable0}: close_method: balance code: receivable name: Receivable sign: 1 - - + I create Receivable Account . -- +- !record {model: account.account, id: account_account_receivable0}: code: '40000-stock-test' company_id: base.main_company @@ -61,9 +61,9 @@ parent_right: 2 type: receivable user_type: account_account_type_receivable0 -- +- I create Payable Account. -- +- !record {model: account.account, id: account_account_payable0}: code: '440000-stock-test' company_id: base.main_company @@ -72,10 +72,10 @@ parent_left: 3 parent_right: 4 type: payable - user_type: account_account_type_expense0 -- + user_type: account_account_type_expense0 +- I create Purchase Journal. -- +- !record {model: account.journal, id: account_journal_purchasejournal0}: code: pur company_id: base.main_company @@ -83,10 +83,10 @@ sequence_id: account.sequence_purchase_journal type: purchase view_id: account.account_journal_bank_view - -- + +- I create Sale Journal. -- +- !record {model: account.journal, id: account_journal_salejouran0}: code: sal company_id: base.main_company @@ -94,10 +94,10 @@ sequence_id: account.sequence_sale_journal type: sale view_id: account.account_journal_view - -- + +- I create Expense Account. -- +- !record {model: account.account, id: account_account_expenseaccount0}: code: Expe company_id: base.main_company @@ -107,9 +107,9 @@ parent_right: 6 type: consolidation user_type: account_account_type_asset0 -- +- I create Product Sale Account. -- +- !record {model: account.account, id: account_account_productsale0}: code: '001-stock-test' company_id: base.main_company @@ -117,11 +117,11 @@ name: Product Sale type: other user_type: stock.account_account_type_income0 - - -- + + +- I create Product Purchase Account. -- +- !record {model: account.account, id: account_account_productpurchase0}: code: '0002-stock-test' company_id: base.main_company @@ -129,64 +129,64 @@ name: Product Purchase type: other user_type: account_account_type_expense0 - -- + +- I create partner. -- +- !record {model: res.partner, id: res_partner_shawtrust0}: address: - - country_id: base.in + - country_id: base.in - street: St James House, Vicar Lane, Sheffield lang: en_US name: 'Shaw Trust ' property_account_payable: account_account_payable0 property_account_receivable: account_account_receivable0 -- +- I create partner. -- +- !record {model: res.partner, id: res_partner_diasorinltd0}: address: - country_id: base.in street: Ash House, Ash Road name: DiaSorin Ltd supplier: true - - + + - I create partner. -- +- !record {model: res.partner, id: res_partner_microlinktechnologies0}: address: - street: Kailash Vaibhav, Parksite name: Micro Link Technologies property_account_payable: account_account_payable0 - property_account_receivable: account_account_receivable0 - supplier: true - + property_account_receivable: account_account_receivable0 + supplier: true + - I create partner address. -- +- !record {model: res.partner.address, id: res_partner_address_0}: country_id: base.in partner_id: stock.res_partner_diasorinltd0 street: Ash House, Ash Road title: base.res_partner_title_miss - - -- + + +- I create product.category . -- +- !record {model: product.category, id: product_category_computer0}: name: Computer -- +- I create product HP Pavilion Desktop PCs . -- +- !record {model: product.product, id: product_product_hppaviliondesktoppcs0}: categ_id: stock.product_category_computer0 cost_method: standard mes_type: fixed - list_price: 1000.0 + list_price: 1000.0 name: HP Pavilion Desktop PCs procure_method: make_to_stock seller_ids: @@ -198,11 +198,11 @@ uom_id: product.product_uom_unit uom_po_id: product.product_uom_unit property_account_expense: account_account_productsale0 - property_account_income: account_account_productsale0 - -- + property_account_income: account_account_productsale0 + +- I create product HP CD writers. -- +- !record {model: product.product, id: product_product_hpcdwriters0}: categ_id: stock.product_category_computer0 cost_method: standard @@ -220,14 +220,14 @@ uom_po_id: product.product_uom_unit property_account_expense: account_account_productpurchase0 property_account_income: account_account_productsale0 - -- + +- I create Physical Inventory for the products. -- - !record {model: stock.inventory, id: stock_inventory_physicalinventoy0}: +- + !record {model: stock.inventory, id: stock_inventory_physicalinventoy0}: company_id: base.main_company - date: '2010-05-10 18:19:13' - date_done: '2010-05-10 18:19:59' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') + date_done: !eval time.strftime('%Y-%m-%d %H:%M:%S') inventory_line_id: - company_id: base.main_company location_id: stock.stock_location_stock @@ -241,40 +241,40 @@ product_uom: product.product_uom_unit name: Physical inventory state: draft - -- + +- I confirm the Inventory for HP CD writers. -- +- !python {model: stock.inventory}: | self.action_confirm(cr,uid,[ref('stock_inventory_physicalinventoy0')]) self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')]) -- +- I create stock.fill.inventory . -- +- !record {model: stock.fill.inventory, id: stock_fill_inventory_0}: location_id: stock.stock_location_stock - -- + +- I fill inventory for HP CD writers. -- +- !python {model: stock.fill.inventory}: | self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], {"lang": 'en_US', "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids": [ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), }) -- +- I create stock.move.split record. -- +- !record {model: stock.move.split, id: stock_move_split_0}: line_ids: - name: '00001-stock-test' - quantity: 5 + quantity: 5 product_id: stock.product_product_hpcdwriters0 - -- + +- I Split into production line. -- +- !python {model: stock.move.split}: | move_obj=self.pool.get('stock.move') product_obj=self.pool.get('product.product') @@ -284,52 +284,52 @@ "stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0] }) - - + In Order to test the picking I create picking with move lines. -- +- !record {model: stock.picking, id: stock_picking_0}: name: test_picking address_id: base.res_partner_address_4 company_id: base.main_company - date: '2010-05-11 15:18:52' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') invoice_state: none move_lines: - company_id: base.main_company - date: '2010-05-11 15:18:57' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') location_dest_id: stock.stock_location_customers location_id: stock.stock_location_stock name: HP CD writers product_id: product.product_product_pc1 product_qty: 3.0 product_uom: product.product_uom_unit - date: '2010-05-11 15:18:57' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') product_uos_qty: 3.0 move_type: direct type: internal - - -- + + +- I click on draft_force_assign on picking. -- +- !python {model: stock.picking}: | self.draft_force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model": "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display": "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id": ref("stock.menu_action_picking_tree6"), }) - - -- + + +- I click on force_assign on picking. -- +- !python {model: stock.picking}: | self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model": "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display": "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id": ref("stock.menu_action_picking_tree6"), }) - + - I confirm the picking. -- +- !python {model: stock.picking }: | import time pick=self.browse(cr,uid,ref('stock_picking_0')) @@ -343,5 +343,5 @@ 'product_id': move.product_id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } + } self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas) diff --git a/addons/stock_invoice_directly/test/stock_invoice_directly.yml b/addons/stock_invoice_directly/test/stock_invoice_directly.yml index b5ecb83caf2..6d70540b4d5 100755 --- a/addons/stock_invoice_directly/test/stock_invoice_directly.yml +++ b/addons/stock_invoice_directly/test/stock_invoice_directly.yml @@ -10,8 +10,8 @@ invoice_state: 2binvoiced move_lines: - company_id: base.main_company - date_expected: '2010-08-03 11:05:47' - date: '2010-08-03 11:05:47' + date_expected: !eval time.strftime('%Y-%m-%d %H:%M:%S') + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') location_id: stock.stock_location_stock product_id: product.product_product_pc1 product_qty: 3.0 @@ -37,19 +37,19 @@ 1, "tz": False, "active_model": "ir.ui.menu", "contact_display": "partner", "active_ids": [ref("stock.menu_action_picking_tree")], "active_id": ref("stock.menu_action_picking_tree"), }) -- +- I create a record for partial picking. -- +- !record {model: stock.partial.picking, id: stock_partial_picking_0}: - date: '2010-08-03 11:25:58' + date: !eval time.strftime('%Y-%m-%d %H:%M:%S') - I make picking order Done. -- +- !python {model: stock.partial.picking}: | pick_obj = self.pool.get('stock.picking') partial = self.browse(cr, uid, ref('stock_partial_picking_0'), context) partial_datas = { - 'delivery_date' : partial.date + 'delivery_date' : partial.date } for pick in pick_obj.browse(cr, uid, [ref('stock_picking_out0')]): for m in pick.move_lines: @@ -59,13 +59,13 @@ 'product_uom' : m.product_uom.id } pick_obj.do_partial(cr, uid, [ref('stock_picking_out0')], partial_datas, context=context) -- +- As the Invoice state of the picking order is To be invoiced. I create invoice for my outgoing picking order. -- +- !python {model: stock.invoice.onshipping}: | wiz_id = self.create(cr, uid, {'invoice_date': '2010-08-04', 'journal_id': ref('account.bank_journal')}, {'active_ids': [ref("stock_picking_out0")]}) - self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US", + self.create_invoice(cr, uid, [wiz_id], {"lang": "en_US", "search_default_available": 1, "tz": False, "active_model": "stock.picking", "contact_display": "partner", "active_ids": [ref("stock_picking_out0")], "active_id": ref("stock_picking_out0")}) - @@ -77,4 +77,4 @@ partner = picking[0].address_id.partner_id.id inv_ids = self.search(cr, uid, [('type','=','out_invoice'),('partner_id','=',partner)]) assert inv_ids, 'No Invoice is generated!' - + diff --git a/addons/stock_location/test/stock_location_pull_flow.yml b/addons/stock_location/test/stock_location_pull_flow.yml index f38cb7cdaa6..557162c725d 100755 --- a/addons/stock_location/test/stock_location_pull_flow.yml +++ b/addons/stock_location/test/stock_location_pull_flow.yml @@ -1,41 +1,41 @@ - - In order to test the product pulled flow , I create ,partner,product,procurement -- + In order to test the product pulled flow , I create ,partner,product,procurement +- I create a account type Asset. -- +- !record {model: account.account.type, id: account_account_type_asset0}: close_method: balance code: asset_test name: Asset For Tests sign: 1 -- +- I create a account type income. -- +- !record {model: account.account.type, id: account_account_type_income0}: close_method: unreconciled code: income_test name: Income For Tests sign: 1 -- +- I create a account type Expense. -- +- !record {model: account.account.type, id: account_account_type_expense0}: close_method: unreconciled code: expense_test name: Expense For Tests - sign: 1 -- + sign: 1 +- I create a account type Receivable. -- +- !record {model: account.account.type, id: account_account_type_receivable0}: close_method: balance code: receivable_test name: Receivable For Tests sign: 1 - - + I create a account Receivable. -- +- !record {model: account.account, id: account_account_receivable0}: code: 40000_test company_id: base.main_company @@ -43,19 +43,19 @@ name: Receivable For Tests type: receivable user_type: account_account_type_receivable0 -- +- I create a account Payable. -- +- !record {model: account.account, id: account_account_payable0}: code: 440000_test company_id: base.main_company currency_mode: current name: Payable For Tests type: payable - user_type: account_account_type_expense0 -- + user_type: account_account_type_expense0 +- I create a Purchase Journal. -- +- !record {model: account.journal, id: account_journal_purchasejournal0}: code: pur_test company_id: base.main_company @@ -63,10 +63,10 @@ sequence_id: account.sequence_purchase_journal type: purchase view_id: account.account_journal_bank_view - -- + +- I create a Sale Journal. -- +- !record {model: account.journal, id: account_journal_salejouran0}: code: sal_test company_id: base.main_company @@ -74,10 +74,10 @@ sequence_id: account.sequence_sale_journal type: sale view_id: account.account_journal_view - -- + +- I create an Expense Account -- +- !record {model: account.account, id: account_account_expenseaccount0}: code: Expe_test company_id: base.main_company @@ -85,9 +85,9 @@ name: Expense Account For Tests type: consolidation user_type: account_account_type_asset0 -- +- I create Product Sale account. -- +- !record {model: account.account, id: account_account_productsale0}: code: 001_test company_id: base.main_company @@ -96,9 +96,9 @@ type: other user_type: account_account_type_income0 -- +- I create Product Product Purchase. -- +- !record {model: account.account, id: account_account_productpurchase0}: code: 0002_test company_id: base.main_company @@ -106,9 +106,9 @@ name: Product Purchase For Tests type: other user_type: account_account_type_expense0 -- +- I create a Supplier. -- +- !record {model: res.partner, id: res_partner_shawtrust0}: address: - country_id: base.in @@ -116,16 +116,16 @@ lang: en_US name: 'Shaw Trust ' property_account_payable: account_account_payable0 - property_account_receivable: account_account_receivable0 -- + property_account_receivable: account_account_receivable0 +- I create a product category. -- +- !record {model: product.category, id: product_category_computer0}: name: Computer - I create a product and define the pulled flow condition for stock move. I set shipping type Sending Goods. and set Procurement type to move. -- +- !record {model: product.product, id: product_product_hpcdwriters0}: categ_id: product_category_computer0 cost_method: standard @@ -169,12 +169,12 @@ property_stock_procurement: stock.location_procurement property_stock_production: stock.location_production qty_available: 15 -- +- I create a procurement order. -- +- !record {model: procurement.order, id: procurement_order_test0}: company_id: base.main_company - date_planned: '2010-10-07 18:24:24' + date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S') location_id: stock.stock_location_shop0 name: Testing pulled flow priority: '1' @@ -184,21 +184,21 @@ product_uom: product.product_uom_unit product_uos: product.product_uom_unit product_uos_qty: 0.0 -- +- I confirm the procurement order. -- +- !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test0} -- +- I launch the scheduler to compute procurement. -- +- !python {model: procurement.order.compute.all}: | proc_obj = self.pool.get('procurement.order') proc_obj._procure_confirm(cr,uid) - - I check the state of procurement order is cancel and stock move is cancel. -- - !python {model: procurement.order }: | - from tools.translate import _ + I check the state of procurement order is cancel and stock move is cancel. +- + !python {model: procurement.order }: | + from tools.translate import _ procurement_ids=self.search(cr, uid, [('id', '=', ref('procurement_order_test0'))]) if procurement_ids: order=self.browse(cr,uid,procurement_ids)[0] @@ -206,14 +206,14 @@ - I check the new procurement order has been created . - - !python {model: procurement.order }: | - from tools.translate import _ + !python {model: procurement.order }: | + from tools.translate import _ procurement_ids=self.search(cr, uid, [('name','=','E001')]) assert len(procurement_ids), "Procurement order hasn't Created." - I check the Outgoing Picking is created for source location Shop 2 and destination shop1. - !python {model: stock.picking }: | - from tools.translate import _ + from tools.translate import _ picking_id = self.search(cr, uid, [('origin','=','Testing pulled flow:E001'),('type','=','out')]) assert len(picking_id), "Picking hasn't Created." diff --git a/addons/stock_location/test/stock_location_push_flow.yml b/addons/stock_location/test/stock_location_push_flow.yml index 1e974682b67..db2ae388317 100755 --- a/addons/stock_location/test/stock_location_push_flow.yml +++ b/addons/stock_location/test/stock_location_push_flow.yml @@ -3,36 +3,36 @@ Push flow specification indicates which location is chained with which location. - I create product category. -- +- !record {model: product.category, id: product_category_computer0}: name: Computer - + - I create Supplier. -- +- !record {model: res.partner, id: res_partner_microlinktechnologies0}: address: - street: Kailash Vaibhav, Parksite name: Micro Link Technologies property_account_payable: account_account_payable0 - property_account_receivable: account_account_receivable0 - supplier: true - + property_account_receivable: account_account_receivable0 + supplier: true + - I create Supplier address. -- +- !record {model: res.partner.address, id: res_partner_address_0}: country_id: base.in partner_id: res_partner_microlinktechnologies0 street: Ash House, Ash Road title: base.res_partner_title_miss - + - I create product and define the pushed flow . - I set the chain location Supplier to stock Input - Stock Input to Quality test and Quality test -Stock . -- + Stock Input to Quality test and Quality test -Stock . +- !record {model: product.product, id: product_product_hpcdwriters0}: categ_id: product_category_computer0 cost_method: standard @@ -62,13 +62,13 @@ property_stock_production: stock.location_production - In order to test pushed flow .I buy the product from Micro Link Technologies supplier. I create a Picking. -- +- !record {model: stock.picking , id: stock_picking_in0}: address_id: res_partner_address_0 company_id: base.main_company invoice_state: none move_lines: - - date_expected: '2010-10-08 15:36:53' + - date_expected: !eval time.strftime('%Y-%m-%d %H:%M:%S') location_dest_id: stock.stock_location_stock location_id: stock.stock_location_suppliers name: 'HP CD writers' @@ -79,7 +79,7 @@ name: Pushed Flow Test type: in - - I confirm picking. + I confirm picking. - !python {model: stock.picking }: | self.draft_force_assign(cr, uid, [ref("stock_picking_in0")], {"lang": "en_US", @@ -91,7 +91,7 @@ Stock/Input To Quality test and Quality test To Stock. - I check the move is in waiting state. -- +- !python {model: stock.picking }: | from tools.translate import _ picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')]) @@ -117,11 +117,11 @@ 'product_id': move.product_id.id, 'product_qty': move.product_qty, 'product_uom': move.product_uom.id, - } - self.do_partial(cr, uid, picking_id,partial_datas) + } + self.do_partial(cr, uid, picking_id,partial_datas) - I check the Outgoing Orders is automatically done. -- +- !python {model: stock.picking }: | from tools.translate import _ picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')]) diff --git a/addons/stock_no_autopicking/test/stock_no_autopicking.yml b/addons/stock_no_autopicking/test/stock_no_autopicking.yml index 34e20eeb6c4..f5e27220e62 100755 --- a/addons/stock_no_autopicking/test/stock_no_autopicking.yml +++ b/addons/stock_no_autopicking/test/stock_no_autopicking.yml @@ -1,5 +1,5 @@ - - In order to test the module with OpenERP, I will make products with No auto-picking + In order to test the module with OpenERP, I will make products with No auto-picking to allow an intermediate picking process to provide raw materials to production orders. - I create product category for measuring the liquid products. Say Litre. @@ -138,7 +138,7 @@ bom_id: mrp_bom_cupoftea0 routing_id: mrp_routing_productionrouting0 company_id: base.main_company - date_planned: '2010-08-03 15:12:32' + date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S') location_dest_id: stock.stock_location_stock location_src_id: stock.stock_location_stock name: MO/00002 diff --git a/addons/stock_planning/test/stock_planning.yml b/addons/stock_planning/test/stock_planning.yml index 23cfc43c821..beb4c654a3e 100755 --- a/addons/stock_planning/test/stock_planning.yml +++ b/addons/stock_planning/test/stock_planning.yml @@ -5,39 +5,39 @@ I create weekly stock periods for the month of July. - I create stock period for the first week of July. -- +- !record {model: stock.period, id: stock_period_01}: - date_start: '2010-07-01 00:00:00' - date_stop: '2010-07-06 23:59:00' - name: 2010, week 27 + date_start: !eval "'%s-07-01 00:00:00' %(datetime.now().year)" + date_stop: !eval "'%s-07-06 23:59:00' %(datetime.now().year)" + name: !eval "'%s, week 27' %(datetime.now().year)" - I create stock period for the second week of July. -- +- !record {model: stock.period, id: stock_period_02}: - date_start: '2010-07-07 00:00:00' - date_stop: '2010-07-12 23:59:00' - name: 2010, week 28 + date_start: !eval "'%s-07-07 00:00:00' %(datetime.now().year)" + date_stop: !eval "'%s-07-12 23:59:00' %(datetime.now().year)" + name: !eval "'%s, week 28' %(datetime.now().year)" - I create stock period for the third week of July. -- +- !record {model: stock.period, id: stock_period_03}: - date_start: '2010-07-15 00:00:00' - date_stop: '2010-07-20 23:59:00' - name: 2010, week 29 + date_start: !eval "'%s-07-15 00:00:00' %(datetime.now().year)" + date_stop: !eval "'%s-07-20 23:59:00' %(datetime.now().year)" + name: !eval "'%s, week 29' %(datetime.now().year)" - I create stock period for the fourth week of July. -- +- !record {model: stock.period, id: stock_period_04}: - date_start: '2010-07-22 00:00:00' - date_stop: '2010-07-27 23:59:00' - name: 2010, week 30 + date_start: !eval "'%s-07-22 00:00:00' %(datetime.now().year)" + date_stop: !eval "'%s-07-27 23:59:00' %(datetime.now().year)" + name: !eval "'%s, week 30' %(datetime.now().year)" - I create stock period for the fifth week of July. -- +- !record {model: stock.period, id: stock_period_05}: - date_start: '2010-07-29 00:00:00' - date_stop: '2010-07-31 23:59:00' - name: 2010, week 31 + date_start: !eval "'%s-07-29 00:00:00' %(datetime.now().year)" + date_stop: !eval "'%s-07-31 23:59:00' %(datetime.now().year)" + name: !eval "'%s, week 31' %(datetime.now().year)" - Now I create the forecast for this period for all PCs. - @@ -46,7 +46,7 @@ period_id: stock_period_03 product_categ_id: product.product_category_pc warehouse_id: stock.warehouse0 -- +- Performing an osv_memory action create_forecast on module stock.sale.forecast.createlines - !python {model: stock.sale.forecast.createlines}: | @@ -56,9 +56,9 @@ }) - I create a sale order for PC1-Basic PC and PC3-Medium PC. -- +- !record {model: sale.order, id: sale_order_so0}: - date_order: '2010-07-20' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: SO006 order_line: @@ -105,17 +105,17 @@ False, "search_default_create_uid": 1, "active_model": "ir.ui.menu", "department_id": False, "active_ids": [ref("stock_planning.menu_stock_sale_forecast_all")], "active_id": ref("stock_planning.menu_stock_sale_forecast_all"), }) -- +- I create Master procurement schedule for the third week of July. -- +- !record {model: stock.planning.createlines, id: stock_planning_createlines_0}: company_id: base.main_company period_id: stock_period_03 product_categ_id: product.product_category_pc warehouse_id: stock.warehouse0 -- +- Performing an osv_memory action create_planning on module stock.planning.createlines -- +- !python {model: stock.planning.createlines}: | self.create_planning(cr, uid, [ref("stock_planning_createlines_0")], {"lang": "en_US", "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("stock_planning.menu_stock_planning_createlines")], @@ -146,5 +146,5 @@ I check whether the procurement orders are created or not. - !python {model: procurement.order}: | - proc_ids = self.search(cr, uid, [('origin','=','MPS(admin) 2010, week 29'),('product_id','=',ref("product.product_product_pc1"))]) + proc_ids = self.search(cr, uid, [('origin','=','MPS(admin) 2011, week 29'),('product_id','=',ref("product.product_product_pc1"))]) assert proc_ids,'No Procurements!'