Atik Agewan(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-account-voucher-yml-aag into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-voucher-yml-aag/+merge/86354
Hello,
account_voucher: Improvements in ymls to increase Coverage.
Thanks,
Atik
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-account-voucher-yml-aag/+merge/86354
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-account-voucher-yml-aag.
=== modified file 'account/demo/account_invoice_demo.xml'
--- account/demo/account_invoice_demo.xml 2011-08-06 00:21:04 +0000
+++ account/demo/account_invoice_demo.xml 2011-12-20 09:33:25 +0000
@@ -46,5 +46,125 @@
<field name="partner_id" ref="base.res_partner_maxtor"/>
<field name="name">[RCK200] Rack 200cm</field>
</record>
+ <record id="account_invoice_0" model="account.invoice">
+ <field name="payment_term" ref="account.account_payment_term_net"/>
+ <field name="journal_id" ref="account.sales_journal"/>
+ <field name="currency_id" ref="base.EUR"/>
+ <field name="address_invoice_id" ref="base.res_partner_address_1"/>
+ <field name="user_id" ref="base.user_admin"/>
+ <field name="address_contact_id" ref="base.res_partner_address_1"/>
+ <field name="reference_type">none</field>
+ <field name="company_id" ref="base.main_company"/>
+ <field eval="100.66" name="amount_tax"/>
+ <field name="state">draft</field>
+ <field name="type">out_invoice</field>
+ <field name="account_id" ref="account.a_recv"/>
+ <field eval="0" name="reconciled"/>
+ <field name="date_invoice">2011-10-07</field>
+ <field eval="1385.3" name="amount_untaxed"/>
+ <field eval="1385.3" name="amount_total"/>
+ <field name="partner_id" ref="base.res_partner_9"/>
+ </record>
+ <record id="account_tax_test0" model="account.tax">
+ <field eval="1" name="sequence"/>
+ <field eval="1.0" name="base_sign"/>
+ <field eval="0" name="child_depend"/>
+ <field eval="0" name="include_base_amount"/>
+ <field name="applicable_type">true</field>
+ <field name="company_id" ref="base.main_company"/>
+ <field name="type">percent</field>
+ <field eval="1.0" name="ref_base_sign"/>
+ <field name="description">test_tax</field>
+ <field name="type_tax_use">all</field>
+ <field eval="1" name="active"/>
+ <field eval="1.0" name="ref_tax_sign"/>
+ <field name="name">test purpose</field>
+ <field eval="0.2" name="amount"/>
+ <field eval="1.0" name="tax_sign"/>
+ <field eval="0" name="price_include"/>
+ </record>
+ <record id="account_invoice_line_hddhddseagategb0" model="account.invoice.line">
+ <field name="uos_id" ref="product.product_uom_unit"/>
+ <field name="account_id" ref="account.a_sale"/>
+ <field name="invoice_id" ref="account_invoice_0"/>
+ <field eval="50.33" name="price_unit"/>
+ <field eval="503.3" name="price_subtotal"/>
+ <field name="company_id" ref="base.main_company"/>
+ <field eval="[(6,0,[ref('account_tax_test0')])]" name="invoice_line_tax_id"/>
+ <field name="product_id" ref="product.product_product_hdd1"/>
+ <field eval="10.0" name="quantity"/>
+ <field name="partner_id" ref="base.res_partner_desertic_hispafuentes"/>
+ <field name="name">[HDD1] HDD Seagate 7200.8 80GB</field>
+ </record>
+ <record id="account_invoice_line_emplemployee0" model="account.invoice.line">
+ <field name="uos_id" ref="product.uom_hour"/>
+ <field name="account_id" ref="account.a_sale"/>
+ <field name="invoice_id" ref="account_invoice_0"/>
+ <field eval="200.0" name="price_unit"/>
+ <field eval="882.0" name="price_subtotal"/>
+ <field eval="2.0" name="discount"/>
+ <field name="company_id" ref="base.main_company"/>
+ <field eval="[(6,0,[])]" name="invoice_line_tax_id"/>
+ <field name="product_id" ref="product.product_product_employee0"/>
+ <field eval="4.5" name="quantity"/>
+ <field name="partner_id" ref="base.res_partner_desertic_hispafuentes"/>
+ <field name="name">[EMPL] Employee</field>
+ </record>
+ <record id="account_bank_statement_0" model="account.bank.statement">
+ <field name="user_id" ref="base.user_admin"/>
+ <field name="name">/</field>
+ <field name="state">draft</field>
+ <field eval="0.0" name="balance_end"/>
+ <field eval="0.0" name="balance_start"/>
+ <field name="company_id" ref="base.main_company"/>
+ <field name="journal_id" ref="account.bank_journal"/>
+ <field name="period_id" ref="account.period_10"/>
+ <field name="date">2011-10-07</field>
+ </record>
+ <record id="account_bank_statement_line_a0" model="account.bank.statement.line">
+ <field name="statement_id" ref="account_bank_statement_0"/>
+ <field eval="1" name="sequence"/>
+ <field name="type">general</field>
+ <field name="partner_id" ref="base.res_partner_6"/>
+ <field name="company_id" ref="base.main_company"/>
+ <field name="account_id" ref="account.a_recv"/>
+ <field eval="[(6,0,[])]" name="move_ids"/>
+ <field eval="1000.0" name="amount"/>
+ <field name="date">2011-10-07</field>
+ <field name="name">a</field>
+ </record>
+
+ <!-- Cash statement Demo -->
+
+ <record id="account_bank_statement_2" model="account.bank.statement">
+ <field name="user_id" ref="base.user_admin"/>
+ <field name="name">/</field>
+ <field name="state">draft</field>
+ <field name="journal_id" ref="account.cash_journal"/>
+ <field name="period_id" ref="account.period_10"/>
+ <field eval="0.0" name="balance_end"/>
+ <field eval="0.0" name="balance_end_cash"/>
+ <field name="company_id" ref="base.main_company"/>
+ </record>
+
+ <record id="account_bank_statement_line_2" model="account.bank.statement.line">
+ <field name="statement_id" ref="account_bank_statement_2"/>
+ <field eval="1" name="sequence"/>
+ <field name="type">general</field>
+ <field name="partner_id" ref="base.res_partner_6"/>
+ <field name="company_id" ref="base.main_company"/>
+ <field name="account_id" ref="account.a_recv"/>
+ <field eval="[(6,0,[])]" name="move_ids"/>
+ <field eval="1000.0" name="amount"/>
+ <field name="name">cash line</field>
+ </record>
+
+ <record id="account_cashbox_line_cash_end" model="account.cashbox.line">
+ <field eval="500" name="pieces"/>
+ <field eval="2" name="number"/>
+ <field eval="1000" name="subtotal"/>
+ <field name="ending_id" ref="account_bank_statement_2"/>
+ </record>
+
</data>
</openerp>
=== modified file 'account/test/account_bank_statement.yml'
--- account/test/account_bank_statement.yml 2011-11-14 23:23:11 +0000
+++ account/test/account_bank_statement.yml 2011-12-20 09:33:25 +0000
@@ -9,14 +9,6 @@
'journal_type': 'bank', 'period_id': time.strftime('%m'), 'active_ids': [ref('menu_bank_statement_tree')], 'active_id': ref('menu_bank_statement_tree')})
assert journal, _('Journal has not been selected')
-
- I create a bank statement with Opening and Closing balance 0.
--
- !record {model: account.bank.statement, id: account_bank_statement_0}:
- balance_end_real: 0.0
- balance_start: 0.0
- date: !eval time.strftime('%Y-%m-%d')
- journal_id: account.bank_journal
--
I create bank statement line
-
!python {model: account.bank.statement.line}: |
@@ -25,7 +17,7 @@
'account_id': partner['value']['account_id'],
'amount': 1000.0,
'partner_id': ref('base.res_partner_4'),
- 'statement_id': ref('account_bank_statement_0'),
+ 'statement_id': ref('account.account_bank_statement_0'),
'name': 'EXT001'
}
vals.update(partner.get('value',{}))
@@ -35,23 +27,22 @@
I compute bank statement using Compute button
-
!python {model: account.bank.statement}: |
- self.button_dummy(cr, uid, [ref("account_bank_statement_0")])
+ self.button_dummy(cr, uid, [ref("account.account_bank_statement_0")])
-
I modify the bank statement and set the Closing Balance.
-
- !record {model: account.bank.statement, id: account_bank_statement_0}:
- balance_end_real: 1000.0
-
+ !python {model: account.bank.statement}: |
+ self.write(cr, uid, [ref('account.account_bank_statement_0')], {'balance_end_real': 2000})
-
I confirm the bank statement using Confirm button
-
!python {model: account.bank.statement}: |
- self.button_confirm_bank(cr, uid, [ref("account_bank_statement_0")])
+ self.button_confirm_bank(cr, uid, [ref("account.account_bank_statement_0")])
-
I check that bank statement state is now "Closed"
-
- !assert {model: account.bank.statement, id: account_bank_statement_0}:
+ !assert {model: account.bank.statement, id: account.account_bank_statement_0}:
- state == 'confirm'
-
@@ -59,7 +50,7 @@
-
!python {model: account.bank.statement}: |
move_line_obj = self.pool.get('account.move.line')
- bank_data = self.browse(cr, uid, ref("account_bank_statement_0"))
+ bank_data = self.browse(cr, uid, ref("account.account_bank_statement_0"))
assert bank_data.move_line_ids, "Move lines not created for bank statement"
for line in bank_data.move_line_ids:
assert line.move_id.state == 'posted', "Move state is not posted"
@@ -68,6 +59,6 @@
-
!python {model: account.bank.statement}: |
try:
- self.button_cancel(cr, uid, [ref("account_bank_statement_0")])
+ self.button_cancel(cr, uid, [ref("account.account_bank_statement_0")])
except Exception, e:
assert e[0]=='UserError', 'Another exception has been raised!'
=== modified file 'account/test/account_cash_statement.yml'
--- account/test/account_cash_statement.yml 2011-01-14 00:11:01 +0000
+++ account/test/account_cash_statement.yml 2011-12-20 09:33:25 +0000
@@ -1,82 +1,35 @@
-
- In order to test Cash statement I create a Cash statement and confirm it and check it's move created
--
- !record {model: account.bank.statement, id: account_bank_statement_1}:
- date: !eval time.strftime('%Y-%m-%d')
- journal_id: account.cash_journal
- name: /
- period_id: account.period_10
- user_id: base.user_root
- starting_details_ids:
- - pieces: 10.0
- number: 2
- subtotal: 20.0
- - pieces: 100.0
- number: 1
- subtotal: 100.0
- balance_start: 120.0
- balance_end: 120.0
--
- I check that Initially bank statement is in the "Draft" state
--
- !assert {model: account.bank.statement, id: account_bank_statement_1}:
+ In order to test Cash statement,I check that Initially bank statement is in the "Draft" state.
+-
+ !assert {model: account.bank.statement, id: account_bank_statement_2}:
- state == 'draft'
-
-
- I clicked on Open CashBox button to open the cashbox
+ I clicked on Open CashBox button to open the cashbox.
-
!python {model: account.bank.statement}: |
- self.button_open(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
-
--
- I check that now bank statement is in the "Open" state
--
- !assert {model: account.bank.statement, id: account_bank_statement_1}:
+ self.button_open(cr, uid, [ref("account_bank_statement_2")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_2")], "active_id": ref("account_bank_statement_2"), })
+-
+ I check that now bank statement is in the "Open" state.
+-
+ !assert {model: account.bank.statement, id: account_bank_statement_2}:
- state == 'open'
-
--
- I enter values in Closing balance before close the cashbox
--
- !record {model: account.bank.statement, id: account_bank_statement_1}:
- line_ids:
- - account_id: account.a_recv
- amount: 1000.0
- date: !eval time.strftime('%Y-%m-%d')
- name: test
- partner_id: base.res_partner_4
- sequence: 0.0
- type: general
- balance_end: 1120.0
- ending_details_ids:
- - pieces: 10.0
- number: 2
- subtotal: 20.0
- - pieces: 100.0
- number: 1
- subtotal: 100.0
- - pieces: 500.0
- number: 2
- subtotal: 1000.0
- balance_end_cash: 1120.0
-
--
- I clicked on Close CashBox button to close the cashbox
+-
+ I clicked on Close CashBox button to close the cashbox.
-
!python {model: account.bank.statement}: |
- self.button_confirm_cash(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), })
-
--
- I check that bank statement state is now "Closed"
--
- !assert {model: account.bank.statement, id: account_bank_statement_1}:
+ aa = self.browse(cr, uid, ref("account_bank_statement_2"))
+ self.button_confirm_cash(cr, uid, [ref("account_bank_statement_2")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_2")], "active_id": ref("account_bank_statement_2"), })
+-
+ I check that bank statement state is now "Closed".
+-
+ !assert {model: account.bank.statement, id: account_bank_statement_2}:
- state == 'confirm'
-
-
- I check that move lines created for bank statement and move state is Posted
+ I check that move lines created for bank statement and move state is Posted.
-
!python {model: account.bank.statement}: |
move_line_obj = self.pool.get('account.move.line')
- bank_data = self.browse(cr, uid, ref("account_bank_statement_1"))
+ bank_data = self.browse(cr, uid, ref("account_bank_statement_2"))
assert bank_data.move_line_ids, "Move lines not created for bank statement"
for line in bank_data.move_line_ids:
assert line.move_id.state == 'posted', "Move state is not posted"
=== modified file 'account_voucher/__openerp__.py'
--- account_voucher/__openerp__.py 2011-12-08 22:25:43 +0000
+++ account_voucher/__openerp__.py 2011-12-20 09:33:25 +0000
@@ -38,7 +38,9 @@
"depends" : ["account"],
"init_xml" : [],
- "demo_xml" : [],
+ "demo_xml" : [
+ "demo/account_voucher_demo.xml",
+ ],
"update_xml" : [
"security/ir.model.access.csv",
@@ -56,9 +58,12 @@
"security/account_voucher_security.xml"
],
"test" : [
- "test/account_voucher.yml",
- "test/sales_receipt.yml",
- "test/sales_payment.yml",
+ "test/draft2post_receipt.yml",
+ "test/open2post_voucher.yml",
+ "test/post2cancel_voucher.yml",
+ "test/draft2valid_bank_statement.yml",
+ "test/valid2cancel_bank_statement.yml",
+ "account_voucher_demo.yml",
"test/account_voucher_report.yml",
"test/case1_usd_usd.yml",
"test/case2_usd_eur_debtor_in_eur.yml",
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2011-12-20 09:12:23 +0000
+++ account_voucher/account_voucher.py 2011-12-20 09:33:25 +0000
@@ -394,7 +394,8 @@
return {
'value':res
}
-
+
+ #DEAD CODE : This Function is not used now
def onchange_term_id(self, cr, uid, ids, term_id, amount):
term_pool = self.pool.get('account.payment.term')
terms = False
=== added file 'account_voucher/account_voucher_demo.yml'
--- account_voucher/account_voucher_demo.yml 1970-01-01 00:00:00 +0000
+++ account_voucher/account_voucher_demo.yml 2011-12-20 09:33:25 +0000
@@ -0,0 +1,12 @@
+
+-
+ !record {model: account.voucher, id: account_voucher_1}:
+ partner_id: base.res_partner_9
+ amount: 1485.96
+ date: 2011-10-07
+ journal_id: account.bank_journal
+ company_id: base.main_company
+ line_ids:
+ - account_id: account.a_recv
+ amount: 1485.96
+
\ No newline at end of file
=== added directory 'account_voucher/demo'
=== added file 'account_voucher/demo/account_voucher_demo.xml'
--- account_voucher/demo/account_voucher_demo.xml 1970-01-01 00:00:00 +0000
+++ account_voucher/demo/account_voucher_demo.xml 2011-12-20 09:33:25 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+<openerp>
+ <data noupdate="1">
+ <record id="account_voucher_0" model="account.voucher">
+ <field name="comment">Write-Off</field>
+ <field name="company_id" ref="base.main_company"/>
+ <field name="partner_id" ref="base.res_partner_seagate"/>
+ <field name="currency_id" ref="base.EUR"/>
+ <field name="pay_now">pay_later</field>
+ <field name="state">draft</field>
+ <field eval="0" name="pre_line"/>
+ <field name="type">sale</field>
+ <field name="payment_option">without_writeoff</field>
+ <field name="account_id" ref="account.a_recv"/>
+ <field name="period_id" ref="account.period_9"/>
+ <field name="date">2011-11-08</field>
+ <field name="journal_id" ref="account.sales_journal"/>
+ <field eval="30000.0" name="amount"/>
+ </record>
+ <record id="account_voucher_line_0" model="account.voucher.line">
+ <field name="account_id" ref="account.a_sale"/>
+ <field name="company_id" ref="base.main_company"/>
+ <field name="voucher_id" ref="account_voucher_0"/>
+ <field eval="30000.0" name="amount"/>
+ <field name="type">cr</field>
+ </record>
+ </data>
+</openerp>
\ No newline at end of file
=== removed file 'account_voucher/test/account_voucher.yml'
--- account_voucher/test/account_voucher.yml 2011-11-22 16:55:37 +0000
+++ account_voucher/test/account_voucher.yml 1970-01-01 00:00:00 +0000
@@ -1,85 +0,0 @@
--
- In order to check account voucher module in OpenERP I create a customer voucher
--
- !record {model: account.voucher, id: account_voucher_voucherforaxelor0}:
- account_id: account.cash
- amount: 1000.0
- company_id: base.main_company
- journal_id: account.bank_journal
- name: Voucher for Axelor
- narration: Basic Pc
- line_cr_ids:
- - account_id: account.a_recv
- amount: 1000.0
- name: Voucher for Axelor
- partner_id: base.res_partner_desertic_hispafuentes
- period_id: account.period_6
- reference: none
-
--
- I check that Initially customer voucher is in the "Draft" state
--
- !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
- - state == 'draft'
--
- I compute the voucher to calculate the taxes by clicking Compute button
--
- !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0}
-
--
- I create voucher by clicking on Create button
--
- !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucherforaxelor0}
--
- I clicked on Validate Button
--
- !assert {model: account.voucher, id: account_voucher_voucherforaxelor0}:
- - state == 'posted'
-
--
- I check that Moves get created for this voucher
--
- !python {model: account.voucher}: |
- acc_id=self.browse(cr, uid, ref("account_voucher_voucherforaxelor0"))
- assert(acc_id.move_id)
-
-
--
- Now I create a Vendor Voucher
--
- !record {model: account.voucher, id: account_voucher_voucheraxelor0, view: False}:
- account_id: account.cash
- amount: 1000.0
- company_id: base.main_company
- currency_id: base.EUR
- journal_id: account.bank_journal
- name: Voucher Axelor
- narration: Basic PC
- line_dr_ids:
- - account_id: account.cash
- amount: 1000.0
- name: Voucher Axelor
- partner_id: base.res_partner_desertic_hispafuentes
- period_id: account.period_6
- reference: none
-
--
- I check that Initially vendor voucher is in the "Draft" state
--
- !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
- - state == 'draft'
--
- I create voucher by clicking on Create button
--
- !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_voucheraxelor0}
--
- I check that the voucher state is "posted"
--
- !assert {model: account.voucher, id: account_voucher_voucheraxelor0}:
- - state == 'posted'
--
- I check that moves get created for this voucher
--
- !python {model: account.voucher}: |
- acc_id=self.browse(cr, uid, ref("account_voucher_voucheraxelor0"))
- assert(acc_id.move_id)
=== modified file 'account_voucher/test/account_voucher_report.yml'
--- account_voucher/test/account_voucher_report.yml 2011-11-30 10:11:10 +0000
+++ account_voucher/test/account_voucher_report.yml 2011-12-20 09:33:25 +0000
@@ -1,24 +1,17 @@
-
- Demo for Account Voucher
+ In order to test the PDF reports defined on a account_voucher, we will print account voucher Report
-
- !record {model: account.voucher, id: account_voucher_voucheraxelor0again}:
- account_id: account.cash
- company_id: base.main_company
- journal_id: account.bank_journal
- name: Voucher Axelor
- narration: Basic PC
- amount: 1000.0
- line_ids:
- - account_id: account.cash
- amount: 1000.0
- name: Voucher Axelor
- period_id: account.period_6
+ !python {model: account.voucher}: |
+ import netsvc, tools, os
+ (data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher.account_voucher_0")], {}, {})
+ if tools.config['test_report_directory']:
+ file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on a account_voucher, we will print account voucher Report
-
!python {model: account.voucher}: |
import netsvc, tools, os
- (data, format) = netsvc.LocalService('report.voucher.cash_receipt.drcr').create(cr, uid, [ref("account_voucher_voucheraxelor0again")], {}, {})
+ (data, format) = netsvc.LocalService('report.voucher.print').create(cr, uid, [ref("account_voucher.account_voucher_0")], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'account_voucher-report.'+format), 'wb+').write(data)
=== renamed file 'account_voucher/test/sales_receipt.yml' => 'account_voucher/test/draft2post_receipt.yml'
--- account_voucher/test/sales_receipt.yml 2011-11-22 16:55:37 +0000
+++ account_voucher/test/draft2post_receipt.yml 2011-12-20 09:33:25 +0000
@@ -1,34 +1,12 @@
--
- Creating a Voucher Receipt for partner Seagate with amount 30000.0
--
- !record {model: account.voucher, id: account_voucher_seagate_0}:
- account_id: account.a_recv
- amount: 30000.0
- company_id: base.main_company
- journal_id: account.sales_journal
- line_cr_ids:
- - account_id: account.a_sale
- amount: 30000.0
- type: cr
- partner_id: base.res_partner_seagate
- period_id: account.period_9
- type: sale
-
--
- I check that the voucher state is Draft
--
- !assert {model: account.voucher, id: account_voucher_seagate_0}:
- - state == 'draft'
-
--
- I click on post button to post the voucher
--
- !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher_seagate_0}
-
--
- Check that the voucher state is Posted
--
- !assert {model: account.voucher, id: account_voucher_seagate_0}:
+-
+ I Perfomr a action to post the voucher
+-
+ !workflow {model: account.voucher, action: proforma_voucher, ref: account_voucher.account_voucher_0}
+
+-
+ I check that the voucher state is "Posted"
+-
+ !assert {model: account.voucher, id: account_voucher.account_voucher_0}:
- state == 'posted'
-
@@ -36,13 +14,13 @@
-
!python {model: account.voucher}: |
reconciled = False
- for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
+ for l in self.browse(cr, uid, [ref("account_voucher.account_voucher_0")])[0].move_ids:
if l.reconcile_id:
reconciled = True
break
assert (not reconciled), "Found reconciled move lines, should not be"
-
- I create and post a voucher payment of amount 30000.0 for the partner Seagate
+ I make a payment for the receipt
-
!python {model: account.voucher}: |
import netsvc
@@ -73,7 +51,7 @@
-
!python {model: account.voucher}: |
reconciled = False
- for l in self.browse(cr, uid, [ref("account_voucher_seagate_0")])[0].move_ids:
+ for l in self.browse(cr, uid, [ref("account_voucher.account_voucher_0")])[0].move_ids:
if l.reconcile_id:
reconciled = True
break
=== added file 'account_voucher/test/draft2valid_bank_statement.yml'
--- account_voucher/test/draft2valid_bank_statement.yml 1970-01-01 00:00:00 +0000
+++ account_voucher/test/draft2valid_bank_statement.yml 2011-12-20 09:33:25 +0000
@@ -0,0 +1,55 @@
+-
+ In order to test the process of bank statement
+-
+ In order to make entries in bank statement line I import customer invoice
+-
+ !python {model: account.statement.from.invoice.lines}: |
+ invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.account_invoice_0"))
+ move_line = invoice.move_id.line_id[0]
+ import_invoice_id = self.create(cr, uid, {'line_ids': [(6,0,[move_line.id])]})
+ self.populate_statement(cr, uid, [import_invoice_id], {"lang": "en_US", "tz": False, "statement_id": ref("account.account_bank_statement_0"), "active_model": "account.bank.statement", "journal_type": "bank", "active_ids": [ref("account.account_bank_statement_0")], "active_id": ref("account.account_bank_statement_0")})
+
+-
+ I check that invoice is import successfully in bank statement line
+-
+ !python {model: account.bank.statement}: |
+ bank = self.browse(cr, uid, ref("account.account_bank_statement_0"))
+ assert bank.line_ids, "bank statement line is not created"
+
+-
+ I modify the bank statement and set the Closing Balance.
+-
+ !python {model: account.bank.statement}: |
+ self.write(cr, uid, [ref('account.account_bank_statement_0')], {'balance_end_real': 2485.96})
+
+-
+ I perform action to confirm the bank statement.
+-
+ !python {model: account.bank.statement}: |
+ self.button_confirm_bank(cr, uid, [ref("account.account_bank_statement_0")])
+-
+ I check that bank statement state is now "Closed"
+-
+ !assert {model: account.bank.statement, id: account.account_bank_statement_0}:
+ - state == 'confirm'
+
+-
+ I check that move lines created for bank statement and move state is Posted
+-
+ !python {model: account.bank.statement}: |
+ bank = self.browse(cr, uid, ref("account.account_bank_statement_0"))
+ move_line = bank.move_line_ids[0]
+ bank_line = bank.line_ids[0]
+ move_line1 = bank.move_line_ids[2]
+ bank_line1 = bank.line_ids[1]
+
+
+ assert bank.move_line_ids, "Move lines not created for bank statement"
+ assert move_line.state == 'valid', "Move state is not valid"
+ assert move_line.move_id.state == 'draft', "Move state is not draft"
+ assert move_line.journal_id == bank.journal_id, "journal is not same created"
+ assert move_line.statement_id.name == bank.name, "bank sequence number is not same created"
+ assert move_line.account_id == bank_line.account_id, "account is not same created"
+ assert (move_line.partner_id == bank_line1.partner_id and move_line1.partner_id == bank_line.partner_id), "partner is not same created"
+ assert (move_line.credit + move_line1.debit) == bank.balance_end_real, "proper amount is not credit in bank account"
+ assert move_line1.account_id == bank.journal_id.default_credit_account_id, " account is not same created"
=== renamed file 'account_voucher/test/sales_payment.yml' => 'account_voucher/test/open2post_voucher.yml'
--- account_voucher/test/sales_payment.yml 2011-01-14 00:11:01 +0000
+++ account_voucher/test/open2post_voucher.yml 2011-12-20 09:33:25 +0000
@@ -1,70 +1,94 @@
-
- Create an invoice for the partner Seagate with amount 450.0
--
- !record {model: account.invoice, id: account_invoice_0}:
- account_id: account.a_recv
- address_contact_id: base.res_partner_address_7
- address_invoice_id: base.res_partner_address_7
- 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_seagate
-
--
- I check that the customer invoice is in draft state
--
- !assert {model: account.invoice, id: account_invoice_0}:
- - state == 'draft'
-
--
- I make the invoice in Open state
--
- !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0}
-
--
- I check that a payment entry gets created in the account.move.line
+ I perform action to change the state of invoice to "open"
+-
+ !workflow {model: account.invoice, action: invoice_open, ref: account.account_invoice_0}
+-
+ I check that the invoice state is "open"
+-
+ !assert {model: account.invoice, id: account.account_invoice_0}:
+ - state == 'open'
+-
+ In order to payment invoice I Perform a action to paymnet a invoice
-
!python {model: account.invoice}: |
- acc_id=self.browse(cr, uid, ref("account_invoice_0"))
- assert(acc_id.move_id)
+ self.invoice_pay_customer(cr, uid, [ref('account.account_invoice_0')], {"lang": 'en_US', "tz": False, "journal_type": "sale", "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 will create and post an account voucher of amount 450.0 for the partner Seagate.
+ I make a payment for the customer invoice
-
!python {model: account.voucher}: |
import netsvc
vals = {}
+ invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.account_invoice_0"))
journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
- res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt', date=False)
+ res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_9"), journal_id, 0.0, 1, ttype='receipt', date=False)
vals = {
'account_id': ref('account.cash'),
- 'amount': 450.0,
+ 'amount': invoice.amount_total,
'company_id': ref('base.main_company'),
'currency_id': ref('base.EUR'),
'journal_id': ref('account.bank_journal'),
- 'partner_id': ref('base.res_partner_seagate'),
- 'period_id': ref('account.period_8'),
+ 'partner_id': ref('base.res_partner_9'),
'type': 'receipt',
}
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
- res['value']['line_cr_ids'][0]['amount'] = 450.0
+ res['value']['line_cr_ids'][0]['amount'] = invoice.amount_total
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
id = self.create(cr, uid, vals)
- voucher_id = self.browse(cr, uid, id)
- assert (voucher_id.state=='draft'), "Voucher is not in draft state"
+ voucher = self.browse(cr, uid, id)
+ assert (voucher.state=='draft'), "Voucher is not in draft state"
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'account.voucher', voucher_id.id, 'proforma_voucher', cr)
-
--
- Finally i will Confirm the state of the invoice is paid
--
- !assert {model: account.invoice, id: account_invoice_0}:
+ wf_service.trg_validate(uid, 'account.voucher', voucher.id, 'proforma_voucher', cr)
+
+-
+ I check a payment is created with proper data in voucher
+-
+ !python {model: account.voucher}: |
+ invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.account_invoice_0"))
+ voucher_id = self.search(cr, uid, [('partner_id', '=', invoice.partner_id.id), ('journal_id', '=', ref('account.bank_journal')), ('amount', '=', invoice.amount_total)])
+ voucher = self.browse(cr, uid, voucher_id)[0]
+ assert (voucher.state=='posted'), "Voucher is not in posted state"
+ assert (invoice.move_id.line_id[0].debit == voucher.move_ids[0].credit), "payment amount is propely created with account"
+ assert (voucher.move_ids[0].credit == voucher.amount), "proper amount is not credited"
+ assert (voucher.number == voucher.move_ids[0].move_id.name), "referance number is not created"
+ assert voucher.period_id, "period is not created"
+ assert (voucher.journal_id.default_credit_account_id == voucher.move_ids[1].account_id), "account is not same created"
+
+-
+ I check that the payment amount is created with proper data in customer invoice
+-
+ !python {model: account.invoice}: |
+ invoice = self.browse(cr, uid, ref("account.account_invoice_0"))
+ payment_line = invoice.payment_ids[0]
+ assert payment_line, "payment line not created for paid invoice"
+ assert payment_line.state == 'valid', "payment move line state is not valid"
+ assert payment_line.debit == 0.0 and payment_line.credit == invoice.amount_total, "proper amount is not debit to payment account "
+ assert invoice.partner_id.credit == invoice.residual, "proper amount is not credit in partner account"
+ assert payment_line.reconcile_id, "reconcile is not created for paid invoice"
+-
+ I check that the reconcile is true
+-
+ !assert {model: account.invoice, id: account.account_invoice_0}:
+ - reconciled == True
+-
+ I check that the invoice state is "paid"
+-
+ !assert {model: account.invoice, id: account.account_invoice_0}:
- state == 'paid'
+-
+ I check that the residual amount is fully paid
+-
+ !assert {model: account.invoice, id: account.account_invoice_0}:
+ - residual == 0.0
+-
+ I check that the payment is created with proper data in customer invoice
+-
+ !python {model: account.invoice}: |
+ invoice = self.browse(cr, uid, ref("account.account_invoice_0"))
+ payment_line = invoice.payment_ids[0]
+ assert payment_line, "payment line not created for paid invoice"
+ assert payment_line.state == 'valid', "payment move line state is not valid"
+ assert payment_line.debit == 0.0 and payment_line.credit == invoice.amount_total, "proper amount is not debit to payment account "
+ assert invoice.partner_id.credit == invoice.residual, "proper amount is not credit in partner account"
+ assert payment_line.reconcile_id, "reconcile is not created for paid invoice"
\ No newline at end of file
=== added file 'account_voucher/test/post2cancel_voucher.yml'
--- account_voucher/test/post2cancel_voucher.yml 1970-01-01 00:00:00 +0000
+++ account_voucher/test/post2cancel_voucher.yml 2011-12-20 09:33:25 +0000
@@ -0,0 +1,28 @@
+-
+ In order to test the cancel process of the voucher
+-
+ I Modified the journal record so it can cancel invoice
+-
+ !record {model: account.journal, id: account.bank_journal}:
+ update_posted: 1
+
+-
+ I perform action to change the state of voucher to "cancel"
+-
+ !python {model: account.voucher}: |
+ import netsvc
+ invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.account_invoice_0"))
+ voucher_id = self.search(cr, uid, [('partner_id', '=', invoice.partner_id.id), ('journal_id', '=', ref('account.bank_journal')), ('amount', '=', invoice.amount_total)])
+ voucher = self.browse(cr, uid, voucher_id)[0]
+ self.cancel_voucher(cr, uid, [voucher.id])
+ assert voucher.state, "state is not in cancel state"
+ assert not voucher.move_ids, "move line created on cancel voucher"
+
+-
+ I check that after a cancel a invoice is set with proper data
+-
+ !python {model: account.invoice}: |
+ invoice = self.browse(cr, uid, ref("account.account_invoice_0"))
+ assert invoice.partner_id.credit == invoice.residual, "proper amount is not set in partner account"
+ assert invoice.reconciled == False, "reconcile is not false"
+ assert not invoice.payment_ids, "payment line created for paid invoice"
\ No newline at end of file
=== added file 'account_voucher/test/valid2cancel_bank_statement.yml'
--- account_voucher/test/valid2cancel_bank_statement.yml 1970-01-01 00:00:00 +0000
+++ account_voucher/test/valid2cancel_bank_statement.yml 2011-12-20 09:33:25 +0000
@@ -0,0 +1,10 @@
+-
+ In order to test the process of bank statement
+-
+ I perform action to cancel the bank statement.
+-
+ !python {model: account.bank.statement}: |
+ try:
+ self.button_cancel(cr, uid, [ref("account.account_bank_statement_0")])
+ except Exception, e:
+ assert e[0]=='UserError', 'Another exception has been raised!'
\ No newline at end of file
=== modified file 'account_voucher/wizard/account_statement_from_invoice.py'
--- account_voucher/wizard/account_statement_from_invoice.py 2011-12-09 07:19:27 +0000
+++ account_voucher/wizard/account_statement_from_invoice.py 2011-12-20 09:33:25 +0000
@@ -119,6 +119,7 @@
account_statement_from_invoice_lines()
+# TODO:Remove this wizard is not used in this module
class account_statement_from_invoice(osv.osv_memory):
"""
Generate Entries by Statement from Invoices
=== modified file 'account_voucher/wizard/account_statement_from_invoice_view.xml'
--- account_voucher/wizard/account_statement_from_invoice_view.xml 2011-01-14 00:11:01 +0000
+++ account_voucher/wizard/account_statement_from_invoice_view.xml 2011-12-20 09:33:25 +0000
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
+ <!-- TODO:Remove this wizard is not used in this module -->
<record id="view_account_statement_from_invoice" model="ir.ui.view">
<field name="name">account.statement.from.invoice.form</field>
<field name="model">account.statement.from.invoice</field>
=== modified file 'account_voucher/wizard/account_voucher_unreconcile.py'
--- account_voucher/wizard/account_voucher_unreconcile.py 2011-01-14 00:11:01 +0000
+++ account_voucher/wizard/account_voucher_unreconcile.py 2011-12-20 09:33:25 +0000
@@ -22,6 +22,7 @@
from osv import osv
from osv import fields
+ # TODO:Remove this wizard is not used in this module
class account_voucher_unreconcile(osv.osv_memory):
_name = "account.voucher.unreconcile"
_description = "Account voucher unreconcile"
=== modified file 'account_voucher/wizard/account_voucher_unreconcile_view.xml'
--- account_voucher/wizard/account_voucher_unreconcile_view.xml 2011-01-14 00:11:01 +0000
+++ account_voucher/wizard/account_voucher_unreconcile_view.xml 2011-12-20 09:33:25 +0000
@@ -2,6 +2,7 @@
<openerp>
<data>
+ <!-- TODO:Remove this wizard is not used in this module -->
<record id="view_account_voucher_unreconcile" model="ir.ui.view">
<field name="name">Account voucher unreconcile</field>
<field name="model">account.voucher.unreconcile</field>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp