[MERGE] PSI branch for yaml for account and its related module

bzr revid: mra@mra-laptop-20100609035959-ceo8bfmocjb139fx
This commit is contained in:
Mustufa Rangwala 2010-06-09 09:29:59 +05:30
commit e4fd98d872
27 changed files with 879 additions and 217 deletions

View File

@ -124,6 +124,14 @@ module named account_voucherss
'test': [
'test/account_customer_invoice.yml',
'test/account_supplier_invoice.yml',
'test/account_change_currency.yml',
'test/chart_of_account.yml',
'test/account_period_close.yml',
'test/account_fiscalyear_close_state.yml',
'test/account_invoice_state.yml',
'test/account_use_model.yml',
'test/account_validate_account_move.yml',
# 'test/account_fiscalyear_close.yml',
],
'installable': True,
'active': False,

View File

@ -62,7 +62,7 @@ class account_payment_term(osv.osv):
elif line.value == 'balance':
amt = round(amount, prec)
if amt:
next_date = datetime.strptime(date_ref, '%y-%m-%d') + relativedelta(days=line.days)
next_date = datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days)
if line.days2 < 0:
next_date += relativedelta(day=line.days2)
if line.days2 > 0:

View File

@ -55,51 +55,3 @@ class account_analytic_cost_ledger_journal_report(osv.osv_memory):
account_analytic_cost_ledger_journal_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#import time
#import wizard
#
#_form = '''<?xml version="1.0"?>
#<form string="Select period">
# <separator string="Cost Legder for period" colspan="4"/>
# <field name="date1"/>
# <field name="date2"/>
# <separator string="and Journals" colspan="4"/>
# <field name="journal" colspan="4"/>
#</form>'''
#
#_fields = {
# 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
# 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
# 'journal': {'string':'Journals','type':'many2many', 'relation':'account.analytic.journal'},
#}
#
#
#class wizard_report(wizard.interface):
# states = {
# 'init': {
# 'actions': [],
# 'result': {
# 'type': 'form',
# 'arch': _form,
# 'fields': _fields,
# 'state': [
# ('end','Cancel'),
# ('report','Print')
# ]
# }
# },
# 'report': {
# 'actions': [],
# 'result': {
# 'type': 'print',
# 'report': 'account.analytic.account.quantity_cost_ledger',
# 'state': 'end'
# }
# },
# }
#
#wizard_report('account.analytic.account.quantity_cost_ledger.report')
#
## vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -32,26 +32,26 @@ class project_account_analytic_line(osv.osv_memory):
def action_open_window(self, cr, uid, ids, context={}):
mod_obj =self.pool.get('ir.model.data')
domain = []
for data in self.read(cr, uid, ids, context=context):
from_date = data['from_date']
to_date = data['to_date']
if from_date and to_date:
domain = [('date','>=',from_date), ('date','<=',to_date)]
elif from_date:
domain = [('date','>=',from_date)]
elif to_date:
domain = [('date','<=',to_date)]
result = mod_obj._get_id(cr, uid, 'account', 'view_account_analytic_line_filter')
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
return {
'name': _('Analytic Entries by line'),
'view_type': 'form',
"view_mode": 'tree,form',
'res_model': 'account.analytic.line',
'type': 'ir.actions.act_window',
'domain': domain,
'search_view_id': id['res_id'],
}
data = self.read(cr, uid, ids, [])[0]
from_date = data['from_date']
to_date = data['to_date']
if from_date and to_date:
domain = [('date','>=',from_date), ('date','<=',to_date)]
elif from_date:
domain = [('date','>=',from_date)]
elif to_date:
domain = [('date','<=',to_date)]
result = mod_obj._get_id(cr, uid, 'account', 'view_account_analytic_line_filter')
id = mod_obj.read(cr, uid, result, ['res_id'], context=context)
return {
'name': _('Analytic Entries by line'),
'view_type': 'form',
"view_mode": 'tree,form',
'res_model': 'account.analytic.line',
'type': 'ir.actions.act_window',
'domain': domain,
'search_view_id': id['res_id'],
}
project_account_analytic_line()

View File

@ -0,0 +1,84 @@
-
In order to test change currency wizard I create an invoice with currency "EUR" and change it to "USD" using the wizard
-
!record {model: account.invoice, id: account_invoice_currency}:
account_id: account.a_recv
address_contact_id: base.res_partner_address_3000
address_invoice_id: base.res_partner_address_3000
company_id: base.main_company
currency_id: base.EUR
invoice_line:
- account_id: account.a_sale
name: '[PC1] Basic PC'
price_unit: 450.0
quantity: 1.0
product_id: product.product_product_pc1
uos_id: product.product_uom_unit
journal_id: account.sales_journal
partner_id: base.res_partner_desertic_hispafuentes
reference_type: none
-
I check that Initially customer invoice is in the draft state
-
!assert {model: account.invoice, id: account_invoice_currency, string: Customer Invoice is in Draft state}:
- state == 'draft'
-
I change the state of invoice to proforma2 by clicking PRO-FORMA button
-
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_currency}
-
I check that now customer invoice is in the "proforma2" state
-
!assert {model: account.invoice, id: account_invoice_currency}:
- state == 'proforma2'
-
Now I select USD as new currency
-
!record {model: account.change.currency, id: account_change_currency_0}:
currency_id: base.USD
-
I clicked on Change Currency button to change the currency
-
!python {model: account.change.currency}: |
try:
self.view_init(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
})
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
})
except:
print "You can not change currency for Open Invoice !"
-
I can't change the currency of invoice when it is not in draft state so i change the state to cancel
-
!workflow {model: account.invoice, action: invoice_cancel, ref: account_invoice_currency}
-
I change the state to "Draft"
-
!python {model: account.invoice}: |
self.action_cancel_draft(cr, uid, [ref("account_invoice_currency")], {"lang": 'en_US',
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_invoice_tree1")],
"type": "out_invoice", "active_id": ref("account.menu_action_invoice_tree1"),
})
-
I change the currency.
-
!record {model: account.change.currency, id: account_change_currency_0}:
currency_id: base.USD
-
I clicked on Change Currency button to change the currency
-
!python {model: account.change.currency}: |
self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US',
"active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids":
[ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"),
})
-
I check that the currency is changed successfully
-
!assert {model: account.invoice, id: account_invoice_currency, string: Currency changed from EUR to USD}:
- currency_id.id == ref("base.USD")

View File

@ -1,9 +1,7 @@
-
In order to test account invoice i create a new customer invoice
In order to test account invoice I create a new customer invoice
-
Creating a account.invoice record
-
!record {model: account.invoice, id: account_invoice_0}:
!record {model: account.invoice, id: account_invoice_customer0}:
account_id: account.a_recv
address_contact_id: base.res_partner_address_zen
address_invoice_id: base.res_partner_address_zen
@ -21,36 +19,30 @@
partner_id: base.res_partner_3
reference_type: none
-
I check that Initially customer invoice is in the draft state
I check that Initially customer invoice is in the "Draft" state
-
!assert {model: account.invoice, id: account_invoice_0}:
!assert {model: account.invoice, id: account_invoice_customer0}:
- state == 'draft'
-
I change the state of invoice to proforma2 by clicking PRO-FORMA button
I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
-
Performing a workflow action invoice_proforma2 on module account.invoice
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0}
-
!workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_0}
I check that the invoice state is now "Proforma2"
-
I check that the invoice state is now proforma2
-
!assert {model: account.invoice, id: account_invoice_0}:
!assert {model: account.invoice, id: account_invoice_customer0}:
- state == 'proforma2'
-
I create invoice by clicking on Create button
-
Performing a workflow action invoice_open on module account.invoice
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0}
-
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0}
I check that the invoice state is "Open"
-
I check that the invoice state is now open
-
!assert {model: account.invoice, id: account_invoice_0}:
!assert {model: account.invoice, id: account_invoice_customer0}:
- state == 'open'
-
I make a partial payment of 1000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
I create a record for partial payment of 1000 EUR.
-
!record {model: account.invoice.pay, id: account_invoice_pay_first0}:
amount: 1000.0
@ -58,25 +50,21 @@
journal_id: account.sales_journal
name: First payment for [PC3] Medium PC to Distrib PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
I make partial payment by clicking on Partial Payment button
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_first0")], {"lang":
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
[ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
})
-
I check that the invoice state is still open
-
!assert {model: account.invoice, id: account_invoice_0}:
!assert {model: account.invoice, id: account_invoice_customer0}:
- state == 'open'
-
I make second partial payment of 6000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
I make second partial payment of 6000 EUR.
-
!record {model: account.invoice.pay, id: account_invoice_pay_second0}:
amount: 6000.0
@ -84,19 +72,17 @@
journal_id: account.sales_journal
name: Second payment for [PC3] Medium PC to Distrib PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
I make partial payment by clicking on Partial Payment button
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_second0")], {"lang":
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
[ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
})
-
I make final partial payment of 2000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
I make final partial payment of 2000 EUR
-
!record {model: account.invoice.pay, id: account_invoice_pay_final0}:
amount: 2000.0
@ -105,39 +91,39 @@
name: Final payment for [PC3] Medium PC to Distrib PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
I make partial payment by clicking on Partial Payment button
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_final0")], {"lang":
'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids":
[ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"),
[ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"),
})
-
I check that the invoice state is now Done
-
!assert {model: account.invoice, id: account_invoice_0}:
!assert {model: account.invoice, id: account_invoice_customer0}:
- state == 'paid'
-
I check that an payment entry gets created in the account.move.line
-
!python {model: account.invoice}: |
acc_id=self.browse(cr, uid, ref("account_invoice_0"))
acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
assert(acc_id.move_id)
#-
# I refund the invoice
#-
# Creating a account.invoice.refund record
#-
# !record {model: account.invoice.refund, id: account_invoice_refund_0}:
# description: Refund
#
#-
# Performing an osv_memory action invoice_refund on module account.invoice.refund
#-
# !python {model: account.invoice.refund}: |
# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")], "type": "out_invoice", "active_id": ref("account.account_invoice_0"), })
# return self.compute_refund(cr, uid, [ref("account_invoice_refund_0")], "refund" {"lang": 'en_US',"tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")], "type": "out_invoice", "active_id": ref("account.account_invoice_0"), })
-
I refund the invoice Using Credit Note
-
!record {model: account.invoice.refund, id: account_invoice_refund_0}:
description: Refund To China Export
period: account.period_5
-
I clicked on refund button
-
!python {model: account.invoice.refund}: |
self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account.account_invoice_customer0"), })
-
I checked that a new entry with state "Draft" created in account move line

View File

@ -0,0 +1,91 @@
-
In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear "Fiscal Year 2011" to which the entries will move
-
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
code: FY2011
company_id: base.main_company
date_start: '2011-01-01'
date_stop: '2011-12-31'
name: Fiscal Year 2011
-
I create a period "Jan2011" for the new fiscalyear
-
!record {model: account.period, id: account_period_jan11}:
company_id: base.main_company
date_start: '2011-01-01'
date_stop: '2011-12-31'
fiscalyear_id: account_fiscalyear_fiscalyear0
name: Jan2011
special: 1
-
I made modification in journal so it can move entries
-
!record {model: account.journal, id: account.sales_journal}:
centralisation: 1
-
I called the Generate Fiscalyear Opening Entries wizard
-
!record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}:
fy2_id: account_fiscalyear_fiscalyear0
fy_id: account.data_fiscalyear
journal_id: account.sales_journal
period_id: account_period_jan11
report_name: End of Fiscal Year Entry
sure: 1
-
I clicked on create Button
-
!python {model: account.fiscalyear.close}: |
self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US',
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")],
"tz": False, "active_id": ref("account.menu_wizard_fy_close"), })
-
I check the opening entries By using "Entries by Line wizard"
-
!record {model: account.move.journal, id: account_move_journal_0}:
journal_id: account.sales_journal
period_id: account_period_jan11
-
I clicked on Open Journal Button to check the entries
-
!python {model: account.move.journal}: |
self.action_open_window(cr, uid, [ref("account_move_journal_0")], {"lang": 'en_US',
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_move_journal_line_form")],
"tz": False, "active_id": ref("account.menu_action_move_journal_line_form"),
})
-
In order to test Cancel Opening Entries I cancelled the opening entries created for "Fiscal Year 2011"
-
!record {model: account.open.closed.fiscalyear, id: account_open_closed_fiscalyear_1}:
fyear_id: account.data_fiscalyear
-
I clicked on Open button
-
!python {model: account.open.closed.fiscalyear}: |
self.remove_entries(cr, uid, [ref("account_open_closed_fiscalyear_1")], {"lang":
'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_open_closed_fy")],
"tz": False, "active_id": ref("account.menu_wizard_open_closed_fy"), })
-
I check the opening entries By using "Entries by Line wizard"
-
!record {model: account.move.journal, id: account_move_journal_2}:
journal_id: account.sales_journal
period_id: account_period_jan11
-
I checked the Opening entries are cancelled successfully
-
!python {model: account.move.journal}: |
self.action_open_window(cr, uid, [ref("account_move_journal_2")], {"lang": 'en_US',
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_move_journal_line_form")],
"tz": False, "active_id": ref("account.menu_action_move_journal_line_form"),
})

View File

@ -0,0 +1,46 @@
-
In order to check the Close a Fiscal Year wizard in OpenERP I first create a Fiscalyear
-
!record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}:
code: FY2011
company_id: base.main_company
date_start: '2011-01-01'
date_stop: '2011-12-31'
name: Fiscal Year 2011
-
I create monthly Periods for this fiscalyear
-
!python {model: account.fiscalyear}: |
self.create_period(cr, uid, [ref("account_fiscalyear_fiscalyear0")], {"lang":
'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_account_fiscalyear_form")],
"tz": False, "active_id": ref("account.menu_action_account_fiscalyear_form"),
})
-
I check that the fiscalyear state is "Draft"
-
!assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Draft state}:
- state == 'draft'
-
I run the Close a Fiscalyear wizard to close this fiscalyear
-
!record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}:
fy_id: account_fiscalyear_fiscalyear0
sure: 1
-
I clicked on Close States Button to close fiscalyear
-
!python {model: account.fiscalyear.close.state}: |
self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US',
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")],
"tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), })
-
I check that the fiscalyear state is now "Done"
-
!assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Done state}:
- state == 'done'

View File

@ -0,0 +1,68 @@
-
In order to test Confirm Draft Invoice wizard I create an invoice and confirm it with this wizard
-
!record {model: account.invoice, id: account_invoice_state}:
account_id: account.a_recv
address_contact_id: base.res_partner_address_3000
address_invoice_id: base.res_partner_address_3000
company_id: base.main_company
currency_id: base.EUR
invoice_line:
- account_id: account.a_sale
name: '[PC1] Basic PC'
price_unit: 450.0
quantity: 1.0
product_id: product.product_product_pc1
uos_id: product.product_uom_unit
journal_id: account.bank_journal
partner_id: base.res_partner_desertic_hispafuentes
reference_type: none
-
I check that Initially customer invoice state is "Draft"
-
!assert {model: account.invoice, id: account_invoice_state}:
- state == 'draft'
-
I called the "Confirm Draft Invoices" wizard
-
!record {model: account.invoice.confirm, id: account_invoice_confirm_0}:
{}
-
I clicked on Confirm Invoices Button
-
!python {model: account.invoice.confirm}: |
self.invoice_confirm(cr, uid, [ref("account_invoice_confirm_0")], {"lang": 'en_US',
"tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_state")],
"type": "out_invoice", "active_id": ref("account_invoice_state"), })
-
I check that customer invoice state is "Open"
-
!assert {model: account.invoice, id: account_invoice_state}:
- state == 'open'
-
I Modified the journal record so it can cancel invoice
-
!record {model: account.journal, id: account.bank_journal}:
update_posted: 1
-
In order to check the "Cancel Selected Invoices" wizard in openerp I cancelled this open invoice using this wizard
-
!record {model: account.invoice.cancel, id: account_invoice_cancel_0}:
{}
-
I clicked on Cancel Invoices Button
-
!python {model: account.invoice.cancel}: |
self.invoice_cancel(cr, uid, [ref("account_invoice_cancel_0")], {"lang": 'en_US',
"tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_state")],
"type": "out_invoice", "active_id": ref("account_invoice_state"), })
-
I check that customer invoice is in the cancel state
-
!assert {model: account.invoice, id: account_invoice_state}:
- state == 'cancel'

View File

@ -0,0 +1,35 @@
-
In order to test close period wizard I create a period then close it and checked it's state
-
!record {model: account.period, id: account_period_jan0}:
company_id: base.main_company
date_start: '2010-01-01'
date_stop: '2010-01-31'
fiscalyear_id: account.data_fiscalyear
name: Jan-2010
special: 1
-
I check that the period state is "Draft"
-
!assert {model: account.period, id: account_period_jan0, string: Period is in Draft state}:
- state == 'draft'
-
I use "Close a Period" wizard to close period Jan-2010
-
!record {model: account.period.close, id: account_period_close_0}:
sure: 1
-
I clicked on Close Period Button to close Period
-
!python {model: account.period.close}: |
self.data_save(cr, uid, [ref("account_period_close_0")], {"lang": 'en_US', "active_model":
"account.period", "active_ids": [ref("account_period_jan0")], "tz": False, "active_id":
ref("account_period_jan0"), })
-
I check that the period state is "Done"
-
!assert {model: account.period, id: account_period_jan0, string: Period is in Done state}:
- state == 'done'

View File

@ -1,9 +1,7 @@
-
In order to test account invoice i create a new supplier invoice
In order to test account invoice I create a new supplier invoice
-
Creating a account.invoice record
-
!record {model: account.invoice, id: account_invoice_1}:
!record {model: account.invoice, id: account_invoice_supplier0}:
account_id: account.a_pay
address_contact_id: base.res_partner_address_3000
address_invoice_id: base.res_partner_address_3000
@ -22,25 +20,21 @@
reference_type: none
type: in_invoice
-
I check that Initially supplier invoice is in the draft state
I check that Initially supplier invoice state is "Draft"
-
!assert {model: account.invoice, id: account_invoice_1}:
!assert {model: account.invoice, id: account_invoice_supplier0}:
- state == 'draft'
-
I change the state of invoice to open by clicking Validate button
-
Performing a workflow action invoice_open on module account.invoice
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier0}
-
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_1}
I check that the invoice state is now "Open"
-
I check that the invoice state is now open
-
!assert {model: account.invoice, id: account_invoice_1}:
!assert {model: account.invoice, id: account_invoice_supplier0}:
- state == 'open'
-
I make a partial payment of 2000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
I make a partial payment of 2000 EUR
-
!record {model: account.invoice.pay, id: account_invoice_pay_firstpaymenttoaxelorforbasicpc0}:
amount: 2000.0
@ -48,24 +42,21 @@
journal_id: account.sales_journal
name: First Payment to Axelor for Basic PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
I make partial payment by clicking on Partial Payment button
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_firstpaymenttoaxelorforbasicpc0")],
{"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id":
ref("account_invoice_1"), })
25, "active_ids": [ref("account_invoice_supplier0")], "type": "in_invoice", "active_id":
ref("account_invoice_supplier0"), })
-
I check that the invoice state is still open
I check that the invoice state is still "Open"
-
!assert {model: account.invoice, id: account_invoice_1}:
!assert {model: account.invoice, id: account_invoice_supplier0}:
- state == 'open'
-
I make final partial payment of 1000 by clicking on Pay Invoice button
-
Creating a account.invoice.pay record
I make final partial payment of 1000 EUR
-
!record {model: account.invoice.pay, id: account_invoice_pay_finalpaymenttoaxelorforbasicpc0}:
amount: 1000.0
@ -73,45 +64,23 @@
journal_id: account.sales_journal
name: Final Payment to Axelor for Basic PC
period_id: account.period_5
-
Performing an osv_memory action pay_and_reconcile on module account.invoice.pay
I make partial payment by clicking on Partial Payment button
-
!python {model: account.invoice.pay}: |
self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_finalpaymenttoaxelorforbasicpc0")],
{"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id":
25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id":
ref("account_invoice_1"), })
25, "active_ids": [ref("account_invoice_supplier0")], "type": "in_invoice", "active_id":
ref("account_invoice_supplier0"), })
-
I check that the invoice state is now Done
I check that the invoice state is now "Done"
-
!assert {model: account.invoice, id: account_invoice_1}:
!assert {model: account.invoice, id: account_invoice_supplier0}:
- state == 'paid'
-
I check that an payment entry gets created in the account.move.line
I check that an payment entry gets created in the account move line
-
!python {model: account.invoice}: |
acc_id=self.browse(cr, uid, ref("account_invoice_1"))
acc_id=self.browse(cr, uid, ref("account_invoice_supplier0"))
assert(acc_id.move_id)
#-
# I refund the invoice
#-
# Creating a account.invoice.refund record
#-
# !record {model: account.invoice.refund, id: account_invoice_refund_0}:
# date: '2010-06-22'
# description: 'Refund By Axelor '
#
#
#-
# Performing an osv_memory action invoice_refund on module account.invoice.refund
#-
# !python {model: account.invoice.refund}: |
# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US',
# "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_1")],
# "type": "in_invoice", "active_id": ref("account_invoice_1"), })

View File

@ -0,0 +1,44 @@
-
In order to test account use models wizard in OpenERP I create an account model record
-
!record {model: account.model, id: account_model_mymodelonyears0}:
journal_id: account.expenses_journal
lines_id:
- account_id: account.a_recv
credit: 0.0
debit: 0.0
name: test1
sequence: 0.0
date: today
quantity: 0.0
name: My Model on %(year)s
-
I create an account use model record
-
!record {model: account.use.model, id: account_use_model_0}:
{}
-
I create entries.
-
!python {model: account.use.model}: |
self.create_entries(cr, uid, [ref("account_use_model_0")], {"lang": 'en_US', "active_model":
"account.model", "active_ids": [ref("account_model_mymodelonyears0")], "tz":
False, "active_id": ref("account_model_mymodelonyears0"), })
-
I create an account use model record
-
!record {model: account.use.model, id: account_use_model_1}:
{}
-
I checked that Moves are created successfully
-
!python {model: account.use.model}: |
self.open_moves(cr, uid, [ref("account_use_model_1")], {"lang": 'en_US', "move_ids":
[], "tz": False, "active_model": "account.model", "active_ids": [ref("account_model_mymodelonyears0")],
"active_id": ref("account_model_mymodelonyears0"), })

View File

@ -0,0 +1,60 @@
-
In order to test Validate Ledger Postings wizard in OpenERP I created a account move
-
!record {model: account.move, id: account_move_0}:
date: '2010-06-07'
journal_id: account.bank_journal
line_id:
- account_id: account.cash
amount_currency: 0.0
credit: 2000.0
date: '2010-06-07'
debit: 0.0
journal_id: account.bank_journal
name: Basic Computer
partner_id: base.res_partner_desertic_hispafuentes
period_id: account.period_6
ref: '2010010'
tax_amount: 0.0
- journal_id: account.bank_journal
period_id: account.period_6
ref: '2010010'
tax_amount: 0.0
account_id: account.a_recv
amount_currency: 0.0
credit: 0.0
date: '2010-06-07'
debit: 2000.0
name: Basic Computer
partner_id: base.res_partner_desertic_hispafuentes
quantity: 0.0
name: /
period_id: account.period_6
ref: '2010010'
state: draft
-
I check that Initially account move state is "Draft"
-
!assert {model: account.move, id: account_move_0}:
- state == 'draft'
-
I validate this account move by using Validate Ledger Postings
-
!record {model: validate.account.move, id: validate_account_move_0}:
journal_id: account.bank_journal
period_id: account.period_6
-
I clicked on validate Button
-
!python {model: validate.account.move}: |
self.validate_move(cr, uid, [ref("validate_account_move_0")], {"lang": "en_US",
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_validate_account_moves")],
"tz": False, "active_id": ref("account.menu_validate_account_moves"), })
-
I check that the invoice state is now "Posted"
-
!assert {model: account.move, id: account_move_0}:
- state == 'posted'

View File

@ -0,0 +1,75 @@
-
In order to check the Chart of Accounts wizard I run the wizard with target move set as all
-
!record {model: account.chart, id: account_chart_0}:
target_move: all
-
I clicked on Open chart Button to open the chart
-
!python {model: account.chart}: |
self.account_chart_open_window(cr, uid, [ref("account_chart_0")], {"lang": 'en_US',
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_account_tree2")],
"tz": False, "active_id": ref("account.menu_action_account_tree2"), })
-
I create chart of account with target move set as posted
-
!record {model: account.chart, id: account_chart_0}:
target_move: posted
-
I clicked on Open chart Button to open the chart
-
!python {model: account.chart}: |
self.account_chart_open_window(cr, uid, [ref("account_chart_0")], {"lang": 'en_US',
"active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_account_tree2")],
"tz": False, "active_id": ref("account.menu_action_account_tree2"), })
-
In order to test Account Move Line Wizard I check the move line entries using this wizard
-
!record {model: account.move.line.select, id: account_move_line_select_0}:
{}
-
I clicked on Button to open the account move lines
-
!python {model: account.move.line.select}: |
self.open_window(cr, uid, [ref("account_move_line_select_0")], {"lang": 'en_US',
"state": "all", "tz": False, "active_model": "account.account", "active_ids":
[ref("account.a_recv")], "fiscalyear": 1, "active_id": ref("account.a_recv"),
})
-
In order to test the Analytic Charts of Account wizard I will generate chart
-
!record {model: account.analytic.chart, id: account_analytic_chart_0}:
from_date: '2010-01-01'
to_date: '2010-06-30'
-
I clicked on Open chart Button to open the charts
-
!python {model: account.analytic.chart}: |
self.analytic_account_chart_open_window(cr, uid, [ref("account_analytic_chart_0")],
{"lang": 'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_analytic_account_tree2")],
"tz": False, "active_id": ref("account.menu_action_analytic_account_tree2"),
})
-
In order to test Account Journal Select wizard I open journal entries using this wizard
-
!record {model: account.journal.select, id: account_journal_select_0}:
{}
-
I clicked on Open Journal Button to open the entries
-
!python {model: account.journal.select}: |
self.action_open_window(cr, uid, [ref("account_journal_select_0")], {"lang":
'en_US', "active_model": "account.journal.period", "active_ids": [ref("account.a_recv")],
"tz": False, "active_id": ref("account.a_recv"), })
-
I check that the entries open successfully

View File

@ -40,7 +40,7 @@
<menuitem
icon="STOCK_EXECUTE"
name="Automatic reconciliation"
name="Automatic Reconciliation"
action="action_account_automatic_reconcile"
id="menu_automatic_reconcile"
parent="periodical_processing_reconciliation"/>

View File

@ -37,11 +37,11 @@ class account_invoice_confirm(osv.osv_memory):
context = {}
pool_obj = pooler.get_pool(cr.dbname)
data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context)
for record in data_inv:
if record['state'] not in ('draft','proforma','proforma2'):
raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!"))
wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr)
wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_open', cr)
return {}
account_invoice_confirm()
@ -61,7 +61,7 @@ class account_invoice_cancel(osv.osv_memory):
wf_service = netsvc.LocalService('workflow')
pool_obj = pooler.get_pool(cr.dbname)
data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context)
for record in data_inv:
if record['state'] in ('cancel','paid'):
raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!"))

View File

@ -43,7 +43,7 @@ class account_move_line_select(osv.osv_memory):
else:
fiscalyear_ids = [context['fiscalyear']]
fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
# fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids)
period_ids = []

View File

@ -7,15 +7,17 @@
<field name="model">account.use.model</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create Entries From Models">
<group colspan="4" >
<field name="model"/>
</group>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-execute" string="Create Entries" name="create_entries" type="object"/>
</group>
</form>
<form string="Create Entries From Models">
<group height="240" width="510">
<separator string="This wizard will create entries from Models" colspan="4"/>
<field name="model"/>
<separator colspan="4"/>
<group colspan="4" col="2">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-execute" string="Create Entries" name="create_entries" type="object"/>
</group>
</group>
</form>
</field>
</record>
@ -47,14 +49,13 @@
<field name="model">account.use.model</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Use Model">
<group colspan="4" col="6">
<label string = "Entry Lines Created." colspan="2"/>
<newline/>
<button icon="gtk-ok" special="cancel" string="Ok"/>
<button icon="gtk-execute" string="Open" name="open_moves" type="object" default_focus='1'/>
</group>
</form>
<form string="Use Model">
<group height="80" width="260">
<separator string = "Entry Lines Created." colspan="4"/>
<button icon="gtk-ok" special="cancel" string="Ok"/>
<button icon="gtk-execute" string="Open" name="open_moves" type="object" default_focus='1'/>
</group>
</form>
</field>
</record>
@ -63,14 +64,13 @@
<field name="model">account.use.model</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Use Model">
<group colspan="4" col="6">
<label string = "Are you sure you want to create entries?" colspan="2"/>
<newline/>
<button icon="gtk-ok" special="cancel" string="Cancel"/>
<button icon="gtk-execute" string="Ok" name="create_entries" type="object" default_focus='1'/>
</group>
</form>
<form string="Use Model">
<group height="90" width="310">
<separator string = "Are you sure you want to create entries?" colspan="4"/>
<button icon="gtk-ok" special="cancel" string="Cancel"/>
<button icon="gtk-execute" string="Ok" name="create_entries" type="object" default_focus='1'/>
</group>
</form>
</field>
</record>

View File

@ -97,6 +97,8 @@ class account_analytic_plan_instance(osv.osv):
}
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
if context.get('journal_id', False):
journal = self.pool.get('account.journal').browse(cr, user, [context['journal_id']], context=context)[0]
analytic_journal = journal.analytic_journal_id and journal.analytic_journal_id.id or False

View File

@ -1,5 +1,5 @@
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
@ -14,7 +14,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
@ -22,11 +22,11 @@
"version" : "1.2",
"author" : "Tiny, Veritos",
"website" : "http://tinyerp.com - http://veritos.nl",
"description" : """This module will support the Anglo-Saxons accounting methodology by
changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries
and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales.
Anglo-Saxons accounting does take the cost when sales invoice is created, Continental accounting will take the cost at he moment the goods are shipped.
This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account
"description" : """This module will support the Anglo-Saxons accounting methodology by
changing the accounting logic with stock transactions. The difference between the Anglo-Saxon accounting countries
and the Rhine or also called Continental accounting countries is the moment of taking the Cost of Goods Sold versus Cost of Sales.
Anglo-Saxons accounting does take the cost when sales invoice is created, Continental accounting will take the cost at the moment the goods are shipped.
This module will add this functionality by using a interim account, to store the value of shipped goods and will contra book this interim account
when the invoice is created to transfer this amount to the debtor or creditor account.
Secondly, price differences between actual purchase price and fixed product standard price are booked on a seperate account""",
"depends" : ["product", "account", "sale", "purchase", "stock"],

View File

@ -62,6 +62,10 @@ Three reports are available:
'wizard/account_budget_crossovered_report_view.xml',
],
'demo_xml': ['crossovered_budget_demo.xml'],
'test':[
# 'test/account_budget_spread.yml',
'test/account_budget.yml',
],
'installable': True,
'active': False,
'certificate': '0043819694157',

View File

@ -0,0 +1,71 @@
-
In order to check account budget module in OpenERP I created a budget with few budget position
-
Creating a crossovered.budget record
-
!record {model: crossovered.budget, id: crossovered_budget_budget0}:
code: B2011
date_from: '2011-01-01'
date_to: '2011-12-31'
name: Budget 2011
state: draft
-
I created two different budget lines
-
Modifying a crossovered.budget record
-
!record {model: crossovered.budget, id: crossovered_budget_budget0}:
crossovered_budget_line:
- analytic_account_id: account.analytic_consultancy
date_from: '2011-01-01'
date_to: '2011-12-31'
general_budget_id: account_budget.account_budget_post_purchase0
planned_amount: 10000.0
- analytic_account_id: account.analytic_super_product_trainings
date_from: '2011-09-01'
date_to: '2011-09-30'
general_budget_id: account_budget.account_budget_post_sales0
planned_amount: 400000.0
-
I check that Initially Budget is in "draft" state
-
!assert {model: crossovered.budget, id: crossovered_budget_budget0}:
- state == 'draft'
-
I pressed the confirm button to confirm the Budget
-
Performing a workflow action confirm on module crossovered.budget
-
!workflow {model: crossovered.budget, action: confirm, ref: crossovered_budget_budget0}
-
I check that budget is in "Confirmed" state
-
!assert {model: crossovered.budget, id: crossovered_budget_budget0}:
- state == 'confirm'
-
I pressed the validate button to validate the Budget
-
Performing a workflow action validate on module crossovered.budget
-
!workflow {model: crossovered.budget, action: validate, ref: crossovered_budget_budget0}
-
I check that budget is in "Validated" state
-
!assert {model: crossovered.budget, id: crossovered_budget_budget0}:
- state == 'validate'
-
I pressed the done button to done the Budget
-
Performing a workflow action done on module crossovered.budget
-
!workflow {model: crossovered.budget, action: done, ref: crossovered_budget_budget0}
-
I check that budget is in "done" state
-
!assert {model: crossovered.budget, id: crossovered_budget_budget0}:
- state == 'done'

View File

@ -0,0 +1,19 @@
-
In order to test Spread Wizard of account module I spread record with amount=1000
-
Creating a account.budget.spread record
-
!record {model: account.budget.spread, id: account_budget_spread_0}:
amount: 1000.0
fiscalyear: account.data_fiscalyear
-
Performing an osv_memory action check_spread on module account.budget.spread
-
!python {model: account.budget.spread}: |
self.check_spread(cr, uid, [ref("account_budget_spread_0")], {"lang": 'en_US',
"active_model": "account.budget.post", "active_ids": [ref("account_budget.account_budget_post_sales0")],
"tz": False, "active_id": ref("account_budget.account_budget_post_sales0"),
})

View File

@ -10,6 +10,7 @@
<form string="Select Dates Period">
<field name="fiscalyear"/>
<field name="amount"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<label string ="" colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>

View File

@ -33,10 +33,12 @@ codawiz_form = """<?xml version="1.0"?>
<separator colspan="4" string="Select your bank journal :" />
<field name="journal_id" colspan="1" domain="[('type','=','cash')]" />
<newline />
<field name="def_payable" /> <field name="def_receivable" />
<field name="def_payable" />
<newline />
<field name="def_receivable" />
<newline />
<field name="awaiting_account" />
<separator string="Clic on 'New' to select your file :" colspan="4"/>
<separator string="Click on 'New' to select your file :" colspan="4"/>
<field name="coda"/>
</form>
"""
@ -122,7 +124,7 @@ def _coda_parsing(self, cr, uid, data, context):
bank_statement['date'] = str2date(line[5:11])
bank_statement['journal_id']=data['form']['journal_id']
period_id = pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d"))),('date_stop','>=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d")))])
bank_statement['period_id'] = period_id[0]
# bank_statement['period_id'] = period_id and period_id[0] or False
bank_statement['state']='draft'
elif line[0] == '1':
# old balance data
@ -219,7 +221,7 @@ def _coda_parsing(self, cr, uid, data, context):
bk_st_id = pool.get('account.bank.statement').create(cr,uid,{
'journal_id': statement['journal_id'],
'date':time.strftime('%Y-%m-%d',time.strptime(statement['date'],"%y/%m/%d")),
'period_id':statement['period_id'],
# 'period_id':statement['period_id'],
'balance_start': statement["balance_start"],
'balance_end_real': statement["balance_end_real"],
'state': 'draft',
@ -254,7 +256,7 @@ def _coda_parsing(self, cr, uid, data, context):
std_log += "\nStatement : %s , Date : %s, Starting Balance : %.2f , Ending Balance : %.2f \n"\
%(statement['name'], statement['date'], float(statement["balance_start"]), float(statement["balance_end_real"]))
bkst_list.append(bk_st_id)
except osv.except_osv, e:
cr.rollback()
nb_err+=1

View File

@ -46,9 +46,9 @@
'payment_sequence.xml',
'account_invoice_view.xml',
'payment_report.xml',
],
'demo_xml': [],
'test': ['test/account_payment.yml'],
'installable': True,
'active': False,
'certificate': '0061703998541',

View File

@ -0,0 +1,145 @@
-
In order to test account_payment in OpenERP I create a new record Type
-
-
Creating a payment.type record
-
!record {model: payment.type, id: payment_type_t0}:
code: T0
name: TestType
-
I created a new Bank Record
-
Creating a res.partner.bank record
-
!record {model: res.partner.bank, id: res_partner_bank_0}:
acc_number: '0001'
partner_id: base.res_partner_9
sequence: 0.0
state: bank
-
I created a new Payment Mode
-
Creating a payment.mode record
-
!record {model: payment.mode, id: payment_mode_m0}:
bank_id: res_partner_bank_0
journal: account.bank_journal
name: TestMode
type: payment_type_t0
-
I created a Supplier Invoice
-
Creating a account.invoice record
-
!record {model: account.invoice, id: account_invoice_payment}:
account_id: account.a_pay
address_contact_id: base.res_partner_address_tang
address_invoice_id: base.res_partner_address_tang
check_total: 300.0
company_id: base.main_company
currency_id: base.EUR
invoice_line:
- account_id: account.a_expense
name: '[PC1] Basic PC'
price_unit: 300.0
product_id: product.product_product_pc1
quantity: 1.0
uos_id: product.product_uom_unit
journal_id: account.expenses_journal
partner_id: base.res_partner_asus
reference_type: none
type: in_invoice
-
I make the supplier invoice in Open state
-
Performing a workflow action invoice_open on module account.invoice
-
!workflow {model: account.invoice, action: invoice_open, ref: account_invoice_payment}
-
I create a new payment order
-
Creating a payment.order record
-
!record {model: payment.order, id: payment_order_0}:
date_prefered: due
mode: payment_mode_m0
reference: 2010/006
user_id: base.user_root
-
Creating a payment.order.create record
-
!record {model: payment.order.create, id: payment_order_create_0}:
duedate: '2010-06-04'
-
I searched the entries using "Payment Create Order" wizard
-
Performing an osv_memory action search_entries on module payment.order.create
-
!python {model: payment.order.create}: |
self.search_entries(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US",
"active_model": "payment.order", "active_ids": [ref("payment_order_0")],
"tz": False, "active_id": ref("payment_order_0"), })
-
I check that Initially Payment order is in "draft" state
-
!assert {model: payment.order, id: payment_order_0}:
- state == 'draft'
-
I pressed the confirm payment button to confirm the payment
-
Performing a workflow action open on module payment.order
-
!workflow {model: payment.order, action: open, ref: payment_order_0}
-
I check that Payment order is in "Confirmed" state
-
!assert {model: payment.order, id: payment_order_0}:
- state == 'open'
-
I paid the payment using "Make Payments" Button
-
Creating a account.payment.make.payment record
-
!record {model: account.payment.make.payment, id: account_payment_make_payment_0}:
{}
-
Performing an osv_memory action launch_wizard on module account.payment.make.payment
-
!python {model: account.payment.make.payment}: |
self.launch_wizard(cr, uid, [ref("account_payment_make_payment_0")], {"lang":
"en_US", "active_model": "payment.order", "active_ids": [ref("payment_order_0")], "tz":
False, "active_id": ref("payment_order_0"), })
-
I check that Payment order is in "Done" state
-
!assert {model: payment.order, id: payment_order_0}:
- state == 'done'