From 6c7405a0cd0110a5a7bea92ad774cc4ab4e75475 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 15 Nov 2011 12:05:30 +0530 Subject: [PATCH 01/19] [IMP]account_payment: improve a account_payment with using a demo data and test a more case and reneame a file and fix the problem of populate_statement wizard bzr revid: mma@tinyerp.com-20111115063530-qxdbl15skf34h413 --- addons/account_payment/__openerp__.py | 2 +- .../account_payment/test/account_payment.yml | 118 ------------------ .../test/process/draft2done_payment_order.yml | 91 ++++++++++++++ .../account_payment_populate_statement.py | 2 +- 4 files changed, 93 insertions(+), 120 deletions(-) delete mode 100644 addons/account_payment/test/account_payment.yml create mode 100644 addons/account_payment/test/process/draft2done_payment_order.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index 1912dfa5198..e41552f7aa5 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -51,7 +51,7 @@ This module provides : ], 'demo_xml': ['account_payment_demo.xml'], 'test': [ - 'test/account_payment.yml', + 'test/process/draft2done_payment_order.yml', 'test/account_payment_report.yml' ], 'installable': True, diff --git a/addons/account_payment/test/account_payment.yml b/addons/account_payment/test/account_payment.yml deleted file mode 100644 index 13c5b5b20a4..00000000000 --- a/addons/account_payment/test/account_payment.yml +++ /dev/null @@ -1,118 +0,0 @@ -- - In order to test account_payment in OpenERP I created a new Bank Record -- - Creating a res.partner.bank record -- - !record {model: res.partner.bank, id: res_partner_bank_0}: - acc_number: '126-2013269-08' - partner_id: base.res_partner_9 - sequence: 0.0 - state: bank - bank: base.res_bank_1 -- - 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 - -- - 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: !eval "'%s/006' %(datetime.now().year)" - user_id: base.user_root - - -- - Creating a payment.order.create record -- - !record {model: payment.order.create, id: payment_order_create_0}: - duedate: !eval time.strftime('%Y-%m-%d') - -- - 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' - - diff --git a/addons/account_payment/test/process/draft2done_payment_order.yml b/addons/account_payment/test/process/draft2done_payment_order.yml new file mode 100644 index 00000000000..ec4cbe3f61b --- /dev/null +++ b/addons/account_payment/test/process/draft2done_payment_order.yml @@ -0,0 +1,91 @@ + +- + In order to test the process of supplier invoice I enter the amount for a total of invoice +- + !python {model: account.invoice}: | + self.write(cr, uid, [ref('account.demo_invoice_0')], {'check_total': 14}) +- + In order to test account move line of journal I check that there is no move attached to the invoice at draft +- + !python {model: account.invoice}: | + invoice = self.browse(cr, uid, ref("account.demo_invoice_0")) + assert (not invoice.move_id), "Move wrongly created at draft" +- + I perform action to change the state of invoice to "open" +- + !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} +- + I check that the invoice state is now "Open" +- + !assert {model: account.invoice, id: account.demo_invoice_0}: + - state == 'open' + +- + In order to test the process of payment order and payment line +- + I create a record for payment order +- + !record {model: payment.order.create, id: payment_order_create_0}: + duedate: !eval time.strftime('%Y-%m-%d') + +- + I perform a action to search the entries for create a order +- + 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("account_payment.payment_order_1")], + "tz": False, "active_id": ref("account_payment.payment_order_1"), }) + +- + In order to make entries in payment line I create a entries +- + !python {model: payment.order.create}: | + invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) + move_line = invoice.move_id.line_id[0] + self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]}) + self.create_payment(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US", + "active_model": "payment.order", "active_ids": [ref("account_payment.payment_order_1")], + "tz": False, "active_id": ref("account_payment.payment_order_1"), }) + +- + I check a payment line is created with proper data +- + !python {model: payment.order}: | + invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) + payment = self.browse(cr, uid, ref("account_payment.payment_order_1")) + payment_line = payment.line_ids[0] + + assert payment_line.move_line_id, "move line is not created in payment line" + assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created" + assert invoice.partner_id == payment_line.partner_id, "partner is not same created" + assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created" + assert invoice.amount_total == payment_line.amount, "payment amount is not same created" + +- + I perform action to change the state of payment order to "confirmed" +- + !workflow {model: payment.order, action: open, ref: account_payment.payment_order_1} +- + I check that Payment order is now "Confirmed" +- + !assert {model: payment.order, id: account_payment.payment_order_1}: + - state == 'open' +- + I perform action to change the state of payment order to "done" +- + !python {model: payment.order}: | + self.set_done(cr, uid, [ref("account_payment.payment_order_1")]) +- + I check that Payment order is now "done" +- + !assert {model: payment.order, id: account_payment.payment_order_1}: + - state == 'done' + +- + I check a payment order is done with proper data +- + !python {model: payment.order}: | + payment = self.browse(cr, uid, ref("account_payment.payment_order_1")) + assert payment.date_done, "date is not created after done payment order" \ No newline at end of file diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 1ef6339d2f3..16d8dc5a7e4 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -76,7 +76,7 @@ class account_payment_populate_statement(osv.osv_memory): statement.currency.id, line.amount_currency, context=ctx) context.update({'move_line_ids': [line.move_line_id.id]}) - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), voucher_currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context) + result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context) if line.move_line_id: voucher_res = { From d62a1ba6e9a13db1fe055cd5391ebe324d411d2e Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 15 Nov 2011 12:16:39 +0530 Subject: [PATCH 02/19] [IMP]account_payment: added a new file for draft2cancel payment order bzr revid: mma@tinyerp.com-20111115064639-jzfeac0fd3zytmin --- addons/account_payment/__openerp__.py | 1 + .../process/draft2cancel_payment_order.yml | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 addons/account_payment/test/process/draft2cancel_payment_order.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index e41552f7aa5..1105a540d0d 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -51,6 +51,7 @@ This module provides : ], 'demo_xml': ['account_payment_demo.xml'], 'test': [ + 'test/process/draft2cancel_payment_order.yml', 'test/process/draft2done_payment_order.yml', 'test/account_payment_report.yml' ], diff --git a/addons/account_payment/test/process/draft2cancel_payment_order.yml b/addons/account_payment/test/process/draft2cancel_payment_order.yml new file mode 100644 index 00000000000..4c9bbdb4283 --- /dev/null +++ b/addons/account_payment/test/process/draft2cancel_payment_order.yml @@ -0,0 +1,21 @@ +- + In order to test the process of payment order +- + I perform action to change the state of payment order to "confirmed" +- + !workflow {model: payment.order, action: open, ref: account_payment.payment_order_1} +- + I check that Payment order is now "Confirmed" +- + !assert {model: payment.order, id: account_payment.payment_order_1}: + - state == 'open' +- + In order to no payment line so I perform action to change the state of payment order to "cancel" +- + !python {model: payment.order}: | + self.set_to_draft(cr, uid, [ref("account_payment.payment_order_1")]) +- + I check that Payment order is now "draft" +- + !assert {model: payment.order, id: account_payment.payment_order_1}: + - state == 'draft' \ No newline at end of file From 82bfb280272436a14b07ecd140c31734f2c21922 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 15 Nov 2011 14:19:34 +0530 Subject: [PATCH 03/19] [IMP]account_payment: added a new file for draft2valid bank statement with import payment line bzr revid: mma@tinyerp.com-20111115084934-tdacwbjcc13ng56g --- addons/account_payment/__openerp__.py | 1 + .../process/draft2valid_bank_statement.yml | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 addons/account_payment/test/process/draft2valid_bank_statement.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index 1105a540d0d..0efeb90769d 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -53,6 +53,7 @@ This module provides : 'test': [ 'test/process/draft2cancel_payment_order.yml', 'test/process/draft2done_payment_order.yml', + 'test/process/draft2valid_bank_statement.yml', 'test/account_payment_report.yml' ], 'installable': True, diff --git a/addons/account_payment/test/process/draft2valid_bank_statement.yml b/addons/account_payment/test/process/draft2valid_bank_statement.yml new file mode 100644 index 00000000000..dc2470cf6f8 --- /dev/null +++ b/addons/account_payment/test/process/draft2valid_bank_statement.yml @@ -0,0 +1,68 @@ +- + In order to test the process of bank statement +- + I create a record for bank statement +- + !record {model: account.bank.statement, id: account_bank_statement_1}: + balance_end_real: 0.0 + balance_start: 0.0 + date: !eval time.strftime('%Y-%m-%d') + journal_id: account.bank_journal + name: / + period_id: account.period_10 + +- + In order to make entries in bank statement line I import payment order lines +- + !python {model: account.payment.populate.statement}: | + payment = self.pool.get('payment.order').browse(cr, uid, ref("account_payment.payment_order_1")) + payment_line = payment.line_ids[0] + import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]}) + self.populate_statement(cr, uid, [import_payment_id], {"lang": "en_US", "tz": False, "statement_id": ref("account_bank_statement_1"), "active_model": "account.bank.statement", "journal_type": "cash", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1")}) + +- + I check that payment line is import successfully in bank statement line +- + !python {model: account.bank.statement}: | + bank = self.browse(cr, uid, ref("account_bank_statement_1")) + assert bank.line_ids, "bank statement line is not created" + +- + I modify the bank statement and set the Closing Balance. +- + !record {model: account.bank.statement, id: account_bank_statement_1}: + balance_end_real: -14.0 + +- + I perform action to confirm the bank statement. +- + !python {model: account.bank.statement}: | + self.button_confirm_bank(cr, uid, [ref("account_bank_statement_1")]) +- + I check that bank statement state is now "Closed" +- + !assert {model: account.bank.statement, id: account_bank_statement_1}: + - state == 'confirm' +- + I check that move lines created for bank statement +- + !python {model: account.bank.statement}: | + bank = self.browse(cr, uid, ref("account_bank_statement_1")) + move_line = bank.move_line_ids[0] + + assert bank.move_line_ids, "Move lines not created for bank statement" + assert move_line.state == 'valid', "Move state is not valid" +- + I check that the payment is created with proper data in supplier invoice +- + !python {model: account.invoice}: | + invoice = self.browse(cr, uid, ref("account.demo_invoice_0")) + payment_line = invoice.payment_ids[0] + + assert invoice.state == 'paid', "invoice state is not paid" + assert invoice.reconciled == True, "invoice reconcile is not True" + assert invoice.residual == 0.0, "invoice residua amount is not filly paid" + assert payment_line, "payment line not created for paid invoice" + assert payment_line.debit == invoice.amount_total and payment_line.credit == 0.0, "proper amount is not debit to payment account " + assert payment_line.reconcile_id, "reconcile is not created for paid invoice" + \ No newline at end of file From c01f177771ce44f39bfdd93dc168e40a38f9170c Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 15 Nov 2011 16:01:23 +0530 Subject: [PATCH 04/19] [IMP]account_payment: added a new file for test tha onchange ,copy and filed_view_get bzr revid: mma@tinyerp.com-20111115103123-gnhn1zyjcqy8fg36 --- addons/account_payment/__openerp__.py | 1 + .../test/ui/payment_order_form.yml | 34 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 addons/account_payment/test/ui/payment_order_form.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index 0efeb90769d..5529e7cc0e5 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -54,6 +54,7 @@ This module provides : 'test/process/draft2cancel_payment_order.yml', 'test/process/draft2done_payment_order.yml', 'test/process/draft2valid_bank_statement.yml', + 'test/ui/payment_order_form.yml', 'test/account_payment_report.yml' ], 'installable': True, diff --git a/addons/account_payment/test/ui/payment_order_form.yml b/addons/account_payment/test/ui/payment_order_form.yml new file mode 100644 index 00000000000..fbe5e4dfb6b --- /dev/null +++ b/addons/account_payment/test/ui/payment_order_form.yml @@ -0,0 +1,34 @@ +- + In order to test the features of payment mode form +- + I call a onchange event to change the company of payment mode +- + !python {model: payment.mode}: | + self.onchange_company_id(cr, uid, [ref("account_payment.payment_mode_1")], ref("base.main_company")) + +- + I call a onchange event to change the company and partner of payment line +- + !python {model: payment.line}: | + payment = self.pool.get('payment.order').browse(cr, uid, ref("account_payment.payment_order_1")) + payment_line = payment.line_ids[0] + + self.onchange_amount(cr, uid, [payment_line.id], 14, ref("base.EUR"), ref("base.EUR")) + self.onchange_partner(cr, uid, [payment_line.id], ref("base.res_partner_maxtor"), 1) + +- + I view the payment entries record +- + !python {model: account.payment.populate.statement}: | + self.fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False) +- + I view the payment entries record +- + !python {model: payment.order.create}: | + self.fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False) + +- + I copy the payment order record +- + !python {model: payment.mode}: | + self.copy(cr, uid, (ref("account_payment.payment_order_1"))) From a3417cd70750927b726bb9a0ab71787d852ec8f3 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 15 Nov 2011 17:25:43 +0530 Subject: [PATCH 05/19] [IMP]account_payment: highlight a file and code which is not used and put a nolabel and seperoter on many2many filed bzr revid: mma@tinyerp.com-20111115115543-uskt6i3dyabj7im5 --- addons/account_payment/__openerp__.py | 2 +- addons/account_payment/account_payment.py | 4 +++- .../test/{ => process}/account_payment_report.yml | 0 .../wizard/account_payment_create_order_view.xml | 3 ++- addons/account_payment/wizard/account_payment_pay.py | 2 +- addons/account_payment/wizard/account_payment_pay_view.xml | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) rename addons/account_payment/test/{ => process}/account_payment_report.yml (100%) diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index 5529e7cc0e5..d5d8aa915ec 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -55,7 +55,7 @@ This module provides : 'test/process/draft2done_payment_order.yml', 'test/process/draft2valid_bank_statement.yml', 'test/ui/payment_order_form.yml', - 'test/account_payment_report.yml' + 'test/process/account_payment_report.yml' ], 'installable': True, 'active': False, diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index 9858d536d17..d5c04fee07c 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -68,6 +68,7 @@ class payment_order(osv.osv): _rec_name = 'reference' _order = 'id desc' +#TODO:REMOVE this function is not used def get_wizard(self, type): logger = netsvc.Logger() logger.notifyChannel("warning", netsvc.LOG_WARNING, @@ -174,7 +175,7 @@ payment_order() class payment_line(osv.osv): _name = 'payment.line' - _description = 'Payment Line' + _description = 'Payment Line' def translate(self, orig): return { @@ -235,6 +236,7 @@ class payment_line(osv.osv): break return result + #TODO:REMOVE this function is not used def select_by_name(self, cr, uid, ids, name, args, context=None): if not ids: return {} partner_obj = self.pool.get('res.partner') diff --git a/addons/account_payment/test/account_payment_report.yml b/addons/account_payment/test/process/account_payment_report.yml similarity index 100% rename from addons/account_payment/test/account_payment_report.yml rename to addons/account_payment/test/process/account_payment_report.yml diff --git a/addons/account_payment/wizard/account_payment_create_order_view.xml b/addons/account_payment/wizard/account_payment_create_order_view.xml index c454a84bffd..538d32efe80 100644 --- a/addons/account_payment/wizard/account_payment_create_order_view.xml +++ b/addons/account_payment/wizard/account_payment_create_order_view.xml @@ -27,7 +27,8 @@
- + + diff --git a/addons/account_payment/wizard/account_payment_pay.py b/addons/account_payment/wizard/account_payment_pay.py index ca9311b1f88..922da187612 100644 --- a/addons/account_payment/wizard/account_payment_pay.py +++ b/addons/account_payment/wizard/account_payment_pay.py @@ -20,7 +20,7 @@ ############################################################################## from osv import osv - +#TODO:REMOVE this wizard is not used class account_payment_make_payment(osv.osv_memory): _name = "account.payment.make.payment" _description = "Account make payment" diff --git a/addons/account_payment/wizard/account_payment_pay_view.xml b/addons/account_payment/wizard/account_payment_pay_view.xml index 3d732aea6e2..a8835e0da8f 100644 --- a/addons/account_payment/wizard/account_payment_pay_view.xml +++ b/addons/account_payment/wizard/account_payment_pay_view.xml @@ -1,7 +1,7 @@ - + account.payment.make.payment.form account.payment.make.payment From 8a59a9acef4812cc95e7c1ecc7d8121d8b27c768 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 17 Nov 2011 16:57:10 +0530 Subject: [PATCH 06/19] [IMP]account_payment: some improvement in teg line bzr revid: mma@tinyerp.com-20111117112710-egyuyxor9imofi40 --- .../test/process/draft2cancel_payment_order.yml | 2 +- .../test/process/draft2done_payment_order.yml | 10 ++++------ .../test/process/draft2valid_bank_statement.yml | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/account_payment/test/process/draft2cancel_payment_order.yml b/addons/account_payment/test/process/draft2cancel_payment_order.yml index 4c9bbdb4283..9b544ab7ca0 100644 --- a/addons/account_payment/test/process/draft2cancel_payment_order.yml +++ b/addons/account_payment/test/process/draft2cancel_payment_order.yml @@ -10,7 +10,7 @@ !assert {model: payment.order, id: account_payment.payment_order_1}: - state == 'open' - - In order to no payment line so I perform action to change the state of payment order to "cancel" + In order to not payment line so I perform action to change the state of payment order to "cancel" - !python {model: payment.order}: | self.set_to_draft(cr, uid, [ref("account_payment.payment_order_1")]) diff --git a/addons/account_payment/test/process/draft2done_payment_order.yml b/addons/account_payment/test/process/draft2done_payment_order.yml index ec4cbe3f61b..f0b0426d7bd 100644 --- a/addons/account_payment/test/process/draft2done_payment_order.yml +++ b/addons/account_payment/test/process/draft2done_payment_order.yml @@ -1,11 +1,11 @@ - - In order to test the process of supplier invoice I enter the amount for a total of invoice + In order to test the process of supplier invoice, I enter the amount for a total of invoice - !python {model: account.invoice}: | self.write(cr, uid, [ref('account.demo_invoice_0')], {'check_total': 14}) - - In order to test account move line of journal I check that there is no move attached to the invoice at draft + In order to test account move line of journal, I check that there is no move attached to the invoice at draft - !python {model: account.invoice}: | invoice = self.browse(cr, uid, ref("account.demo_invoice_0")) @@ -29,9 +29,7 @@ duedate: !eval time.strftime('%Y-%m-%d') - - I perform a action to search the entries for create a order -- - Performing an osv_memory action search_entries on module payment.order.create + I perform a action to search the entries for create a payment line - !python {model: payment.order.create}: | self.search_entries(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US", @@ -39,7 +37,7 @@ "tz": False, "active_id": ref("account_payment.payment_order_1"), }) - - In order to make entries in payment line I create a entries + In order to make entries in payment line, I create a entries - !python {model: payment.order.create}: | invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) diff --git a/addons/account_payment/test/process/draft2valid_bank_statement.yml b/addons/account_payment/test/process/draft2valid_bank_statement.yml index dc2470cf6f8..710a63a1540 100644 --- a/addons/account_payment/test/process/draft2valid_bank_statement.yml +++ b/addons/account_payment/test/process/draft2valid_bank_statement.yml @@ -12,7 +12,7 @@ period_id: account.period_10 - - In order to make entries in bank statement line I import payment order lines + In order to make entries in bank statement line, I import payment order lines - !python {model: account.payment.populate.statement}: | payment = self.pool.get('payment.order').browse(cr, uid, ref("account_payment.payment_order_1")) From 4f43cda69c8ed06b9492ed639d848db10af2c8bd Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 29 Nov 2011 11:05:10 +0530 Subject: [PATCH 07/19] [IMP]account_payment: remove a ui folder and its file and move a process file in test and added a demo data yml for account_payment bzr revid: mma@tinyerp.com-20111129053510-mgyesspwq3gc8a6d --- addons/account_payment/__openerp__.py | 10 +++--- .../account_payment/account_payment_demo.yml | 19 +++++++++++ .../{process => }/account_payment_report.yml | 0 .../draft2cancel_payment_order.yml | 0 .../draft2done_payment_order.yml | 0 .../draft2valid_bank_statement.yml | 0 .../test/ui/payment_order_form.yml | 34 ------------------- 7 files changed, 24 insertions(+), 39 deletions(-) create mode 100644 addons/account_payment/account_payment_demo.yml rename addons/account_payment/test/{process => }/account_payment_report.yml (100%) rename addons/account_payment/test/{process => }/draft2cancel_payment_order.yml (100%) rename addons/account_payment/test/{process => }/draft2done_payment_order.yml (100%) rename addons/account_payment/test/{process => }/draft2valid_bank_statement.yml (100%) delete mode 100644 addons/account_payment/test/ui/payment_order_form.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index d5d8aa915ec..c547dc92715 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -51,11 +51,11 @@ This module provides : ], 'demo_xml': ['account_payment_demo.xml'], 'test': [ - 'test/process/draft2cancel_payment_order.yml', - 'test/process/draft2done_payment_order.yml', - 'test/process/draft2valid_bank_statement.yml', - 'test/ui/payment_order_form.yml', - 'test/process/account_payment_report.yml' + 'test/draft2cancel_payment_order.yml', + 'test/draft2done_payment_order.yml', + 'test/draft2valid_bank_statement.yml', + 'account_payment_demo.yml', + 'test/account_payment_report.yml' ], 'installable': True, 'active': False, diff --git a/addons/account_payment/account_payment_demo.yml b/addons/account_payment/account_payment_demo.yml new file mode 100644 index 00000000000..b5069408e47 --- /dev/null +++ b/addons/account_payment/account_payment_demo.yml @@ -0,0 +1,19 @@ +- + !record {model: res.partner.bank, id: partner_bank_1}: + name: Reserve Bank + acc_number: 00987654321 + partner_id: base.res_partner_agrolait + bank: base.res_bank_1 + state: bank + +- + !record {model: payment.mode, id: payment_mode_1}: + name: Direct Payment + journal: account.bank_journal + bank_id: account_payment.partner_bank_1 + +- + !record {model: payment.order, id: payment_order_1}: + mode: account_payment.payment_mode_1 + user_id: base.user_root + date_prefered: now diff --git a/addons/account_payment/test/process/account_payment_report.yml b/addons/account_payment/test/account_payment_report.yml similarity index 100% rename from addons/account_payment/test/process/account_payment_report.yml rename to addons/account_payment/test/account_payment_report.yml diff --git a/addons/account_payment/test/process/draft2cancel_payment_order.yml b/addons/account_payment/test/draft2cancel_payment_order.yml similarity index 100% rename from addons/account_payment/test/process/draft2cancel_payment_order.yml rename to addons/account_payment/test/draft2cancel_payment_order.yml diff --git a/addons/account_payment/test/process/draft2done_payment_order.yml b/addons/account_payment/test/draft2done_payment_order.yml similarity index 100% rename from addons/account_payment/test/process/draft2done_payment_order.yml rename to addons/account_payment/test/draft2done_payment_order.yml diff --git a/addons/account_payment/test/process/draft2valid_bank_statement.yml b/addons/account_payment/test/draft2valid_bank_statement.yml similarity index 100% rename from addons/account_payment/test/process/draft2valid_bank_statement.yml rename to addons/account_payment/test/draft2valid_bank_statement.yml diff --git a/addons/account_payment/test/ui/payment_order_form.yml b/addons/account_payment/test/ui/payment_order_form.yml deleted file mode 100644 index fbe5e4dfb6b..00000000000 --- a/addons/account_payment/test/ui/payment_order_form.yml +++ /dev/null @@ -1,34 +0,0 @@ -- - In order to test the features of payment mode form -- - I call a onchange event to change the company of payment mode -- - !python {model: payment.mode}: | - self.onchange_company_id(cr, uid, [ref("account_payment.payment_mode_1")], ref("base.main_company")) - -- - I call a onchange event to change the company and partner of payment line -- - !python {model: payment.line}: | - payment = self.pool.get('payment.order').browse(cr, uid, ref("account_payment.payment_order_1")) - payment_line = payment.line_ids[0] - - self.onchange_amount(cr, uid, [payment_line.id], 14, ref("base.EUR"), ref("base.EUR")) - self.onchange_partner(cr, uid, [payment_line.id], ref("base.res_partner_maxtor"), 1) - -- - I view the payment entries record -- - !python {model: account.payment.populate.statement}: | - self.fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False) -- - I view the payment entries record -- - !python {model: payment.order.create}: | - self.fields_view_get(cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False) - -- - I copy the payment order record -- - !python {model: payment.mode}: | - self.copy(cr, uid, (ref("account_payment.payment_order_1"))) From ac3af69aa414b4c821c09ecd5fa478bcaa6e8b23 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 5 Dec 2011 15:59:13 +0530 Subject: [PATCH 08/19] [FIX]product:set a order by complete_name to sort a category by parent to child relation lp bug: https://launchpad.net/bugs/898579 fixed bzr revid: mma@tinyerp.com-20111205102913-qk34ym2q9xpy7swj --- addons/product/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index c67b1f6c029..9033c172263 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -213,7 +213,7 @@ class product_category(osv.osv): _description = "Product Category" _columns = { 'name': fields.char('Name', size=64, required=True, translate=True), - 'complete_name': fields.function(_name_get_fnc, type="char", string='Name'), + 'complete_name': fields.function(_name_get_fnc, type="char", string='Name', store=True), 'parent_id': fields.many2one('product.category','Parent Category', select=True), 'child_id': fields.one2many('product.category', 'parent_id', string='Child Categories'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."), @@ -225,7 +225,7 @@ class product_category(osv.osv): 'type' : lambda *a : 'normal', } - _order = "sequence, name" + _order = 'complete_name' def _check_recursion(self, cr, uid, ids, context=None): level = 100 while len(ids): From b27b984caa832eff582a58f0cdc38af38094dfbc Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 5 Dec 2011 16:27:40 +0530 Subject: [PATCH 09/19] [IMP]stock:set a size of complete_name bzr revid: mma@tinyerp.com-20111205105740-mz5s9n1qi7rh0yfj --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 9033c172263..6b66c0ccee0 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -213,7 +213,7 @@ class product_category(osv.osv): _description = "Product Category" _columns = { 'name': fields.char('Name', size=64, required=True, translate=True), - 'complete_name': fields.function(_name_get_fnc, type="char", string='Name', store=True), + 'complete_name': fields.function(_name_get_fnc, type="char", string='Name',size=256, store=True), 'parent_id': fields.many2one('product.category','Parent Category', select=True), 'child_id': fields.one2many('product.category', 'parent_id', string='Child Categories'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."), From f44e88a67dd555cac8f828a1b8656b50b491c1c0 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 19 Dec 2011 12:22:14 +0530 Subject: [PATCH 10/19] [IMP] improvement in yml test code in account_payment module bzr revid: tpa@tinyerp.com-20111219065214-m5a570xuc4z3f5vy --- addons/account_payment/__openerp__.py | 3 +- addons/account_payment/account_payment.py | 4 +- .../account_payment/account_payment_demo.yml | 19 ----- .../test/account_payment_demo.yml | 18 +++++ .../test/account_payment_order_wiz.yml | 37 +++++++++ .../test/account_payment_report.yml | 4 +- .../test/draft2cancel_payment_order.yml | 25 ++++-- .../test/draft2done_payment_order.yml | 80 +++++-------------- .../test/draft2valid_bank_statement.yml | 42 +++------- .../account_payment_populate_statement.py | 2 +- 10 files changed, 110 insertions(+), 124 deletions(-) delete mode 100644 addons/account_payment/account_payment_demo.yml create mode 100644 addons/account_payment/test/account_payment_demo.yml create mode 100644 addons/account_payment/test/account_payment_order_wiz.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index c547dc92715..593fddffdde 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -51,10 +51,11 @@ This module provides : ], 'demo_xml': ['account_payment_demo.xml'], 'test': [ + 'test/account_payment_demo.yml', 'test/draft2cancel_payment_order.yml', 'test/draft2done_payment_order.yml', + 'test/account_payment_order_wiz.yml', 'test/draft2valid_bank_statement.yml', - 'account_payment_demo.yml', 'test/account_payment_report.yml' ], 'installable': True, diff --git a/addons/account_payment/account_payment.py b/addons/account_payment/account_payment.py index f5ba3ed7d54..abd5b09fde4 100644 --- a/addons/account_payment/account_payment.py +++ b/addons/account_payment/account_payment.py @@ -68,7 +68,7 @@ class payment_order(osv.osv): _rec_name = 'reference' _order = 'id desc' -#TODO:REMOVE this function is not used + #dead code def get_wizard(self, type): logger = netsvc.Logger() logger.notifyChannel("warning", netsvc.LOG_WARNING, @@ -236,7 +236,7 @@ class payment_line(osv.osv): break return result - #TODO:REMOVE this function is not used + #dead code def select_by_name(self, cr, uid, ids, name, args, context=None): if not ids: return {} partner_obj = self.pool.get('res.partner') diff --git a/addons/account_payment/account_payment_demo.yml b/addons/account_payment/account_payment_demo.yml deleted file mode 100644 index b5069408e47..00000000000 --- a/addons/account_payment/account_payment_demo.yml +++ /dev/null @@ -1,19 +0,0 @@ -- - !record {model: res.partner.bank, id: partner_bank_1}: - name: Reserve Bank - acc_number: 00987654321 - partner_id: base.res_partner_agrolait - bank: base.res_bank_1 - state: bank - -- - !record {model: payment.mode, id: payment_mode_1}: - name: Direct Payment - journal: account.bank_journal - bank_id: account_payment.partner_bank_1 - -- - !record {model: payment.order, id: payment_order_1}: - mode: account_payment.payment_mode_1 - user_id: base.user_root - date_prefered: now diff --git a/addons/account_payment/test/account_payment_demo.yml b/addons/account_payment/test/account_payment_demo.yml new file mode 100644 index 00000000000..aa69350f272 --- /dev/null +++ b/addons/account_payment/test/account_payment_demo.yml @@ -0,0 +1,18 @@ +- + !record {model: res.company, id: company_1}: + name: TinyERP +- + !record {model: payment.mode, id: payment_mode_1}: + company_id: company_1 +#- +# call onchange. +#- + #!python {model: payment.order}: | + #pay_line_obj = self.pool.get('payment.line') + #invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) + #payment = self.browse(cr, uid, ref("payment_order_1")) + #payment_line = payment.line_ids[0] + #pay_line_obj.onchange_move_line(cr, uid, [payment_line.id] ,invoice.move_id.line_id[0].id ,payment.mode, payment.date_prefered, payment.date_scheduled, payment_line.currency, payment_line.company_currency, context) + #pay_line_obj.onchange_amount(cr, uid, [payment_line.id] , payment_line.amount_currency, payment_line.currency.id, payment_line.company_currency.id, context) + #pay_line_obj.onchange_partner(cr, uid, [payment_line.id] , ref("base.res_partner_maxtor"), payment.mode, context) +#- \ No newline at end of file diff --git a/addons/account_payment/test/account_payment_order_wiz.yml b/addons/account_payment/test/account_payment_order_wiz.yml new file mode 100644 index 00000000000..0213b14145a --- /dev/null +++ b/addons/account_payment/test/account_payment_order_wiz.yml @@ -0,0 +1,37 @@ +- + In order to test the Select invoice to pay wizard +- + I create a record for payment order. +- + !record {model: payment.order.create, id: payment_order_create_0}: + duedate: !eval time.strftime('%Y-%m-%d') +- + I perform a action to search the entries for create a payment line +- + !python {model: payment.order.create}: | + self.search_entries(cr, uid, [ref("payment_order_create_0")], { + "active_model": "payment.order", "active_ids": [ref("payment_order_1")], + "active_id": ref("payment_order_1"), }) +- + In order to make entries in payment line, I create a entries. +- + !python {model: payment.order.create}: | + invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) + move_line = invoice.move_id.line_id[0] + self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]}) + self.create_payment(cr, uid, [ref("payment_order_create_0")], { + "active_model": "payment.order", "active_ids": [ref("payment_order_1")], + "active_id": ref("payment_order_1")}) +- + I check a payment line is created with proper data. +- + !python {model: payment.order}: | + invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) + payment = self.browse(cr, uid, ref("payment_order_1")) + payment_line = payment.line_ids[0] + + assert payment_line.move_line_id, "move line is not created in payment line." + assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created." + assert invoice.partner_id == payment_line.partner_id, "partner is not same created." + assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created." + assert invoice.amount_total == payment_line.amount, "payment amount is not same created." diff --git a/addons/account_payment/test/account_payment_report.yml b/addons/account_payment/test/account_payment_report.yml index 45022e19a73..4bb607a6f47 100644 --- a/addons/account_payment/test/account_payment_report.yml +++ b/addons/account_payment/test/account_payment_report.yml @@ -1,8 +1,8 @@ - In order to test the PDF reports defined on Account Payment, Print a Payment Order -- +- !python {model: payment.order}: | import netsvc, tools, os - (data, format) = netsvc.LocalService('report.payment.order').create(cr, uid, [ref('account_payment.payment_order_1')], {}, {}) + (data, format) = netsvc.LocalService('report.payment.order').create(cr, uid, [ref('payment_order_1')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data) \ No newline at end of file diff --git a/addons/account_payment/test/draft2cancel_payment_order.yml b/addons/account_payment/test/draft2cancel_payment_order.yml index 9b544ab7ca0..7ce89c8550e 100644 --- a/addons/account_payment/test/draft2cancel_payment_order.yml +++ b/addons/account_payment/test/draft2cancel_payment_order.yml @@ -1,21 +1,30 @@ - In order to test the process of payment order - - I perform action to change the state of payment order to "confirmed" + I confirm payment order. - - !workflow {model: payment.order, action: open, ref: account_payment.payment_order_1} + !workflow {model: payment.order, action: open, ref: payment_order_1} - - I check that Payment order is now "Confirmed" + I check that Payment order is now "Confirmed". - - !assert {model: payment.order, id: account_payment.payment_order_1}: + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed' state}: - state == 'open' - - In order to not payment line so I perform action to change the state of payment order to "cancel" + In order to not payment line so I perform action to change the state of payment order to "cancel". +- + !workflow {model: payment.order, action: cancel, ref: payment_order_1} +- + I check that Payment order is now "cancelled". +- + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Confirmed' state}: + - state == 'cancel' +- + I set the payment order in "Draft" state. - !python {model: payment.order}: | - self.set_to_draft(cr, uid, [ref("account_payment.payment_order_1")]) + self.set_to_draft(cr, uid, [ref("payment_order_1")]) - - I check that Payment order is now "draft" + I check that Payment order is now "draft". - - !assert {model: payment.order, id: account_payment.payment_order_1}: + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Draft' state}: - state == 'draft' \ No newline at end of file diff --git a/addons/account_payment/test/draft2done_payment_order.yml b/addons/account_payment/test/draft2done_payment_order.yml index f0b0426d7bd..f5687b2adb4 100644 --- a/addons/account_payment/test/draft2done_payment_order.yml +++ b/addons/account_payment/test/draft2done_payment_order.yml @@ -1,4 +1,3 @@ - - In order to test the process of supplier invoice, I enter the amount for a total of invoice - @@ -11,79 +10,36 @@ invoice = self.browse(cr, uid, ref("account.demo_invoice_0")) assert (not invoice.move_id), "Move wrongly created at draft" - - I perform action to change the state of invoice to "open" + I change the state of invoice to "open". - !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} - - I check that the invoice state is now "Open" + I check that the invoice state is now "Open". - - !assert {model: account.invoice, id: account.demo_invoice_0}: - - state == 'open' - -- - In order to test the process of payment order and payment line -- - I create a record for payment order -- - !record {model: payment.order.create, id: payment_order_create_0}: - duedate: !eval time.strftime('%Y-%m-%d') - -- - I perform a action to search the entries for create a payment line -- - !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("account_payment.payment_order_1")], - "tz": False, "active_id": ref("account_payment.payment_order_1"), }) - -- - In order to make entries in payment line, I create a entries -- - !python {model: payment.order.create}: | - invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) - move_line = invoice.move_id.line_id[0] - self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]}) - self.create_payment(cr, uid, [ref("payment_order_create_0")], {"lang": "en_US", - "active_model": "payment.order", "active_ids": [ref("account_payment.payment_order_1")], - "tz": False, "active_id": ref("account_payment.payment_order_1"), }) - -- - I check a payment line is created with proper data -- - !python {model: payment.order}: | - invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) - payment = self.browse(cr, uid, ref("account_payment.payment_order_1")) - payment_line = payment.line_ids[0] - - assert payment_line.move_line_id, "move line is not created in payment line" - assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created" - assert invoice.partner_id == payment_line.partner_id, "partner is not same created" - assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created" - assert invoice.amount_total == payment_line.amount, "payment amount is not same created" - -- - I perform action to change the state of payment order to "confirmed" -- - !workflow {model: payment.order, action: open, ref: account_payment.payment_order_1} -- - I check that Payment order is now "Confirmed" -- - !assert {model: payment.order, id: account_payment.payment_order_1}: + !assert {model: account.invoice, id: account.demo_invoice_0, severity: error, string: Invoice should be in 'Open' state}: - state == 'open' - - I perform action to change the state of payment order to "done" + I change the state of Payment Order to "Confirmed". +- + !workflow {model: payment.order, action: open, ref: payment_order_1} +- + I check that Payment order is now "Confirmed". +- + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Confirmed' state}: + - state == 'open' +- + I change the state of payment order to "done". - !python {model: payment.order}: | - self.set_done(cr, uid, [ref("account_payment.payment_order_1")]) + self.set_done(cr, uid, [ref("payment_order_1")]) - - I check that Payment order is now "done" + I check that Payment order is now "done". - - !assert {model: payment.order, id: account_payment.payment_order_1}: + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Done' state}: - state == 'done' - - - I check a payment order is done with proper data + I check a payment order is done with proper data. - !python {model: payment.order}: | - payment = self.browse(cr, uid, ref("account_payment.payment_order_1")) + payment = self.browse(cr, uid, ref("payment_order_1")) assert payment.date_done, "date is not created after done payment order" \ No newline at end of file diff --git a/addons/account_payment/test/draft2valid_bank_statement.yml b/addons/account_payment/test/draft2valid_bank_statement.yml index 710a63a1540..a5dd797d49c 100644 --- a/addons/account_payment/test/draft2valid_bank_statement.yml +++ b/addons/account_payment/test/draft2valid_bank_statement.yml @@ -10,59 +10,43 @@ journal_id: account.bank_journal name: / period_id: account.period_10 - - - In order to make entries in bank statement line, I import payment order lines + In order to make entries in bank statement line, I import payment order lines. - !python {model: account.payment.populate.statement}: | - payment = self.pool.get('payment.order').browse(cr, uid, ref("account_payment.payment_order_1")) + payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1")) payment_line = payment.line_ids[0] import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]}) - self.populate_statement(cr, uid, [import_payment_id], {"lang": "en_US", "tz": False, "statement_id": ref("account_bank_statement_1"), "active_model": "account.bank.statement", "journal_type": "cash", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1")}) - + self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"), + "active_model": "account.bank.statement", "journal_type": "cash", + "active_id": ref("account_bank_statement_1")}) - - I check that payment line is import successfully in bank statement line + I check that payment line is import successfully in bank statement line. - !python {model: account.bank.statement}: | bank = self.browse(cr, uid, ref("account_bank_statement_1")) - assert bank.line_ids, "bank statement line is not created" - + assert bank.line_ids, "bank statement line is not created." - I modify the bank statement and set the Closing Balance. - !record {model: account.bank.statement, id: account_bank_statement_1}: balance_end_real: -14.0 - - - I perform action to confirm the bank statement. + I confirm the bank statement. - !python {model: account.bank.statement}: | self.button_confirm_bank(cr, uid, [ref("account_bank_statement_1")]) - - I check that bank statement state is now "Closed" + I check that bank statement state is now "Confirm" - !assert {model: account.bank.statement, id: account_bank_statement_1}: - state == 'confirm' - - I check that move lines created for bank statement + I check that move lines created for bank statement. - !python {model: account.bank.statement}: | bank = self.browse(cr, uid, ref("account_bank_statement_1")) move_line = bank.move_line_ids[0] - - assert bank.move_line_ids, "Move lines not created for bank statement" - assert move_line.state == 'valid', "Move state is not valid" -- - I check that the payment is created with proper data in supplier invoice -- - !python {model: account.invoice}: | - invoice = self.browse(cr, uid, ref("account.demo_invoice_0")) - payment_line = invoice.payment_ids[0] - - assert invoice.state == 'paid', "invoice state is not paid" - assert invoice.reconciled == True, "invoice reconcile is not True" - assert invoice.residual == 0.0, "invoice residua amount is not filly paid" - assert payment_line, "payment line not created for paid invoice" - assert payment_line.debit == invoice.amount_total and payment_line.credit == 0.0, "proper amount is not debit to payment account " - assert payment_line.reconcile_id, "reconcile is not created for paid invoice" - \ No newline at end of file + + assert bank.move_line_ids, "Move lines not created for bank statement." + assert move_line.state == 'valid', "Move state is not valid." \ No newline at end of file diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 16d8dc5a7e4..f1424ab157f 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -76,7 +76,7 @@ class account_payment_populate_statement(osv.osv_memory): statement.currency.id, line.amount_currency, context=ctx) context.update({'move_line_ids': [line.move_line_id.id]}) - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context) + result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, amount=abs(amount), currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context) if line.move_line_id: voucher_res = { From 9dacf0305e247269d9879882cb03c44bd935a223 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 19 Dec 2011 15:37:47 +0530 Subject: [PATCH 11/19] [IMP] Improvrd YML test cases of Account_payment module. bzr revid: tpa@tinyerp.com-20111219100747-zzt5i2gnsngt30gl --- .../test/account_payment_demo.yml | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/addons/account_payment/test/account_payment_demo.yml b/addons/account_payment/test/account_payment_demo.yml index aa69350f272..1dbc720cc83 100644 --- a/addons/account_payment/test/account_payment_demo.yml +++ b/addons/account_payment/test/account_payment_demo.yml @@ -4,15 +4,13 @@ - !record {model: payment.mode, id: payment_mode_1}: company_id: company_1 -#- -# call onchange. -#- - #!python {model: payment.order}: | - #pay_line_obj = self.pool.get('payment.line') - #invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) - #payment = self.browse(cr, uid, ref("payment_order_1")) - #payment_line = payment.line_ids[0] - #pay_line_obj.onchange_move_line(cr, uid, [payment_line.id] ,invoice.move_id.line_id[0].id ,payment.mode, payment.date_prefered, payment.date_scheduled, payment_line.currency, payment_line.company_currency, context) - #pay_line_obj.onchange_amount(cr, uid, [payment_line.id] , payment_line.amount_currency, payment_line.currency.id, payment_line.company_currency.id, context) - #pay_line_obj.onchange_partner(cr, uid, [payment_line.id] , ref("base.res_partner_maxtor"), payment.mode, context) -#- \ No newline at end of file +- + !record {model: payment.order, id: payment_order_2}: + mode: payment_mode_1 +- + !record {model: payment.line, id: payment_line_0}: + name: Test + communication: Test + partner_id: base.res_partner_agrolait + order_id: payment_order_2 + amount_currency: 100.00 \ No newline at end of file From f48f8864328f2a6a6e12bc71ece4ed888f587b3d Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 20 Dec 2011 14:27:54 +0530 Subject: [PATCH 12/19] [IMP]product: remove a store=True and replace by store= bzr revid: mma@tinyerp.com-20111220085754-55yt6cy6zvbjzawg --- addons/product/product.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 6b66c0ccee0..36aeebd1134 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -213,7 +213,10 @@ class product_category(osv.osv): _description = "Product Category" _columns = { 'name': fields.char('Name', size=64, required=True, translate=True), - 'complete_name': fields.function(_name_get_fnc, type="char", string='Name',size=256, store=True), + 'complete_name': fields.function(_name_get_fnc, type="char", string='Name',size=256, + store={ + 'product.category': (lambda self, cr, uid, ids, c={}: ids, ['name','parent_id'], 10), + }), 'parent_id': fields.many2one('product.category','Parent Category', select=True), 'child_id': fields.one2many('product.category', 'parent_id', string='Child Categories'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."), From b9e329b8bccb9eee7de1b9b3ba76c1861450a32d Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Tue, 20 Dec 2011 17:39:24 +0530 Subject: [PATCH 13/19] [IMP] Improved YML test case of account_payment module. bzr revid: tpa@tinyerp.com-20111220120924-01l9t6eq69y7lqb8 --- addons/account_payment/__openerp__.py | 2 - .../test/account_payment_order_wiz.yml | 37 ------------ .../test/draft2done_payment_order.yml | 57 ++++++++++++++++++- .../test/draft2valid_bank_statement.yml | 52 ----------------- 4 files changed, 56 insertions(+), 92 deletions(-) delete mode 100644 addons/account_payment/test/account_payment_order_wiz.yml delete mode 100644 addons/account_payment/test/draft2valid_bank_statement.yml diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index 593fddffdde..a6651d53b1f 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -54,8 +54,6 @@ This module provides : 'test/account_payment_demo.yml', 'test/draft2cancel_payment_order.yml', 'test/draft2done_payment_order.yml', - 'test/account_payment_order_wiz.yml', - 'test/draft2valid_bank_statement.yml', 'test/account_payment_report.yml' ], 'installable': True, diff --git a/addons/account_payment/test/account_payment_order_wiz.yml b/addons/account_payment/test/account_payment_order_wiz.yml deleted file mode 100644 index 0213b14145a..00000000000 --- a/addons/account_payment/test/account_payment_order_wiz.yml +++ /dev/null @@ -1,37 +0,0 @@ -- - In order to test the Select invoice to pay wizard -- - I create a record for payment order. -- - !record {model: payment.order.create, id: payment_order_create_0}: - duedate: !eval time.strftime('%Y-%m-%d') -- - I perform a action to search the entries for create a payment line -- - !python {model: payment.order.create}: | - self.search_entries(cr, uid, [ref("payment_order_create_0")], { - "active_model": "payment.order", "active_ids": [ref("payment_order_1")], - "active_id": ref("payment_order_1"), }) -- - In order to make entries in payment line, I create a entries. -- - !python {model: payment.order.create}: | - invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) - move_line = invoice.move_id.line_id[0] - self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]}) - self.create_payment(cr, uid, [ref("payment_order_create_0")], { - "active_model": "payment.order", "active_ids": [ref("payment_order_1")], - "active_id": ref("payment_order_1")}) -- - I check a payment line is created with proper data. -- - !python {model: payment.order}: | - invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) - payment = self.browse(cr, uid, ref("payment_order_1")) - payment_line = payment.line_ids[0] - - assert payment_line.move_line_id, "move line is not created in payment line." - assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created." - assert invoice.partner_id == payment_line.partner_id, "partner is not same created." - assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created." - assert invoice.amount_total == payment_line.amount, "payment amount is not same created." diff --git a/addons/account_payment/test/draft2done_payment_order.yml b/addons/account_payment/test/draft2done_payment_order.yml index f5687b2adb4..188c9b7ca10 100644 --- a/addons/account_payment/test/draft2done_payment_order.yml +++ b/addons/account_payment/test/draft2done_payment_order.yml @@ -27,6 +27,41 @@ - !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Confirmed' state}: - state == 'open' +- + I create a record for payment order create. +- + !record {model: payment.order.create, id: payment_order_create_0}: + duedate: !eval time.strftime('%Y-%m-%d') +- + I perform a action to search the entries for create a payment line +- + !python {model: payment.order.create}: | + self.search_entries(cr, uid, [ref("payment_order_create_0")], { + "active_model": "payment.order", "active_ids": [ref("payment_order_1")], + "active_id": ref("payment_order_1"), }) +- + In order to make entries in payment line, I create a entries. +- + !python {model: payment.order.create}: | + invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) + move_line = invoice.move_id.line_id[0] + self.write(cr, uid, [ref("payment_order_create_0")], {'entries': [(6,0,[move_line.id])]}) + self.create_payment(cr, uid, [ref("payment_order_create_0")], { + "active_model": "payment.order", "active_ids": [ref("payment_order_1")], + "active_id": ref("payment_order_1")}) +- + I check a payment line is created with proper data. +- + !python {model: payment.order}: | + invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) + payment = self.browse(cr, uid, ref("payment_order_1")) + payment_line = payment.line_ids[0] + + assert payment_line.move_line_id, "move line is not created in payment line." + assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created." + assert invoice.partner_id == payment_line.partner_id, "partner is not same created." + assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created." + assert invoice.amount_total == payment_line.amount, "payment amount is not same created." - I change the state of payment order to "done". - @@ -42,4 +77,24 @@ - !python {model: payment.order}: | payment = self.browse(cr, uid, ref("payment_order_1")) - assert payment.date_done, "date is not created after done payment order" \ No newline at end of file + assert payment.date_done, "date is not created after done payment order" +- + I create a record for bank statement. +- + !record {model: account.bank.statement, id: account_bank_statement_1}: + balance_end_real: 0.0 + balance_start: 0.0 + date: !eval time.strftime('%Y-%m-%d') + journal_id: account.bank_journal + name: / + period_id: account.period_10 +- + In order to make entries in bank statement line, I import payment order lines. +- + !python {model: account.payment.populate.statement}: | + payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1")) + payment_line = payment.line_ids[0] + import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]}) + self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"), + "active_model": "account.bank.statement", "journal_type": "cash", + "active_id": ref("account_bank_statement_1")}) \ No newline at end of file diff --git a/addons/account_payment/test/draft2valid_bank_statement.yml b/addons/account_payment/test/draft2valid_bank_statement.yml deleted file mode 100644 index a5dd797d49c..00000000000 --- a/addons/account_payment/test/draft2valid_bank_statement.yml +++ /dev/null @@ -1,52 +0,0 @@ -- - In order to test the process of bank statement -- - I create a record for bank statement -- - !record {model: account.bank.statement, id: account_bank_statement_1}: - balance_end_real: 0.0 - balance_start: 0.0 - date: !eval time.strftime('%Y-%m-%d') - journal_id: account.bank_journal - name: / - period_id: account.period_10 -- - In order to make entries in bank statement line, I import payment order lines. -- - !python {model: account.payment.populate.statement}: | - payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1")) - payment_line = payment.line_ids[0] - import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]}) - self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"), - "active_model": "account.bank.statement", "journal_type": "cash", - "active_id": ref("account_bank_statement_1")}) -- - I check that payment line is import successfully in bank statement line. -- - !python {model: account.bank.statement}: | - bank = self.browse(cr, uid, ref("account_bank_statement_1")) - assert bank.line_ids, "bank statement line is not created." -- - I modify the bank statement and set the Closing Balance. -- - !record {model: account.bank.statement, id: account_bank_statement_1}: - balance_end_real: -14.0 -- - I confirm the bank statement. -- - !python {model: account.bank.statement}: | - self.button_confirm_bank(cr, uid, [ref("account_bank_statement_1")]) -- - I check that bank statement state is now "Confirm" -- - !assert {model: account.bank.statement, id: account_bank_statement_1}: - - state == 'confirm' -- - I check that move lines created for bank statement. -- - !python {model: account.bank.statement}: | - bank = self.browse(cr, uid, ref("account_bank_statement_1")) - move_line = bank.move_line_ids[0] - - assert bank.move_line_ids, "Move lines not created for bank statement." - assert move_line.state == 'valid', "Move state is not valid." \ No newline at end of file From 583d85cd3b590664d9f5e080294e04eb1dc17e61 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 21 Dec 2011 11:04:57 +0530 Subject: [PATCH 14/19] [IMP] improved YML test cases in account_payment bzr revid: tpa@tinyerp.com-20111221053457-8p9co1qdhdznxviw --- addons/account_payment/test/account_payment_demo.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/account_payment/test/account_payment_demo.yml b/addons/account_payment/test/account_payment_demo.yml index 1dbc720cc83..11be33cd44b 100644 --- a/addons/account_payment/test/account_payment_demo.yml +++ b/addons/account_payment/test/account_payment_demo.yml @@ -1,9 +1,6 @@ -- - !record {model: res.company, id: company_1}: - name: TinyERP - !record {model: payment.mode, id: payment_mode_1}: - company_id: company_1 + company_id: base.main_company - !record {model: payment.order, id: payment_order_2}: mode: payment_mode_1 From 8ff2693b8fec558ab28d9d62266893a3865fd451 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 21 Dec 2011 12:44:59 +0530 Subject: [PATCH 15/19] [IMP] Improvement in yml test cases of account_payment. bzr revid: tpa@tinyerp.com-20111221071459-7mxdi5uj8o9pkae4 --- .../account_payment/test/draft2done_payment_order.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/account_payment/test/draft2done_payment_order.yml b/addons/account_payment/test/draft2done_payment_order.yml index 188c9b7ca10..ae850a794bf 100644 --- a/addons/account_payment/test/draft2done_payment_order.yml +++ b/addons/account_payment/test/draft2done_payment_order.yml @@ -97,4 +97,13 @@ import_payment_id = self.create(cr, uid, {'lines': [(6,0,[payment_line.id])]}) self.populate_statement(cr, uid, [import_payment_id], {"statement_id": ref("account_bank_statement_1"), "active_model": "account.bank.statement", "journal_type": "cash", - "active_id": ref("account_bank_statement_1")}) \ No newline at end of file + "active_id": ref("account_bank_statement_1")}) +- + I am checking whether the calculations of Owner Account and Destination Account are done correctly or not in payment line. +- + !python {model: payment.line}: | + payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1")) + line_id = self.browse(cr, uid,payment.line_ids[0].id,context) + assert line_id.info_owner, "Owner Account not proper." + assert line_id.info_partner, "Destination Account not proper." + assert line_id.ml_inv_ref, "Invoice reference is not proper." \ No newline at end of file From a8e600ed71c1972d8934d0853f6abdc1052bc804 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Thu, 22 Dec 2011 11:32:53 +0530 Subject: [PATCH 16/19] [IMP] account_payment: Improved sentence formation in ymls. bzr revid: uco@tinyerp.com-20111222060253-5yf56zm2jkx6fctt --- addons/account_payment/__openerp__.py | 4 +- .../test/account_payment_report.yml | 4 +- .../test/cancel_payment_order.yml | 30 +++++++++++++ .../test/draft2cancel_payment_order.yml | 30 ------------- ...nt_order.yml => payment_order_process.yml} | 42 +++++++++---------- 5 files changed, 54 insertions(+), 56 deletions(-) create mode 100644 addons/account_payment/test/cancel_payment_order.yml delete mode 100644 addons/account_payment/test/draft2cancel_payment_order.yml rename addons/account_payment/test/{draft2done_payment_order.yml => payment_order_process.yml} (73%) diff --git a/addons/account_payment/__openerp__.py b/addons/account_payment/__openerp__.py index a6651d53b1f..8905d9aa208 100644 --- a/addons/account_payment/__openerp__.py +++ b/addons/account_payment/__openerp__.py @@ -52,8 +52,8 @@ This module provides : 'demo_xml': ['account_payment_demo.xml'], 'test': [ 'test/account_payment_demo.yml', - 'test/draft2cancel_payment_order.yml', - 'test/draft2done_payment_order.yml', + 'test/cancel_payment_order.yml', + 'test/payment_order_process.yml', 'test/account_payment_report.yml' ], 'installable': True, diff --git a/addons/account_payment/test/account_payment_report.yml b/addons/account_payment/test/account_payment_report.yml index 4bb607a6f47..8786841bf1a 100644 --- a/addons/account_payment/test/account_payment_report.yml +++ b/addons/account_payment/test/account_payment_report.yml @@ -1,8 +1,8 @@ - - In order to test the PDF reports defined on Account Payment, Print a Payment Order + In order to test the PDF reports defined on Account Payment, I print a Payment Order report. - !python {model: payment.order}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.payment.order').create(cr, uid, [ref('payment_order_1')], {}, {}) if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data) \ No newline at end of file + file(os.path.join(tools.config['test_report_directory'], 'account_payment-payment_order_report.'+format), 'wb+').write(data) diff --git a/addons/account_payment/test/cancel_payment_order.yml b/addons/account_payment/test/cancel_payment_order.yml new file mode 100644 index 00000000000..9337581f219 --- /dev/null +++ b/addons/account_payment/test/cancel_payment_order.yml @@ -0,0 +1,30 @@ +- + In order to test the process of cancelling the payment order, +- + I confirm payment order. +- + !workflow {model: payment.order, action: open, ref: payment_order_1} +- + I check that payment order is now "Confirmed". +- + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed'.}: + - state == 'open' +- + Now, I cancel the payment order. +- + !workflow {model: payment.order, action: cancel, ref: payment_order_1} +- + I check that payment order is now "Cancelled". +- + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Cancelled'.}: + - state == 'cancel' +- + I again set the payment order to draft. +- + !python {model: payment.order}: | + self.set_to_draft(cr, uid, [ref("payment_order_1")]) +- + I check that payment order is now "Draft". +- + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Draft' state.}: + - state == 'draft' diff --git a/addons/account_payment/test/draft2cancel_payment_order.yml b/addons/account_payment/test/draft2cancel_payment_order.yml deleted file mode 100644 index 7ce89c8550e..00000000000 --- a/addons/account_payment/test/draft2cancel_payment_order.yml +++ /dev/null @@ -1,30 +0,0 @@ -- - In order to test the process of payment order -- - I confirm payment order. -- - !workflow {model: payment.order, action: open, ref: payment_order_1} -- - I check that Payment order is now "Confirmed". -- - !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed' state}: - - state == 'open' -- - In order to not payment line so I perform action to change the state of payment order to "cancel". -- - !workflow {model: payment.order, action: cancel, ref: payment_order_1} -- - I check that Payment order is now "cancelled". -- - !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Confirmed' state}: - - state == 'cancel' -- - I set the payment order in "Draft" state. -- - !python {model: payment.order}: | - self.set_to_draft(cr, uid, [ref("payment_order_1")]) -- - I check that Payment order is now "draft". -- - !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Draft' state}: - - state == 'draft' \ No newline at end of file diff --git a/addons/account_payment/test/draft2done_payment_order.yml b/addons/account_payment/test/payment_order_process.yml similarity index 73% rename from addons/account_payment/test/draft2done_payment_order.yml rename to addons/account_payment/test/payment_order_process.yml index ae850a794bf..2bb04807a64 100644 --- a/addons/account_payment/test/draft2done_payment_order.yml +++ b/addons/account_payment/test/payment_order_process.yml @@ -1,16 +1,16 @@ - - In order to test the process of supplier invoice, I enter the amount for a total of invoice + In order to test the process of payment order, I start with the supplier invoice. - !python {model: account.invoice}: | self.write(cr, uid, [ref('account.demo_invoice_0')], {'check_total': 14}) - - In order to test account move line of journal, I check that there is no move attached to the invoice at draft + In order to test account move line of journal, I check that there is no move attached to the invoice. - !python {model: account.invoice}: | invoice = self.browse(cr, uid, ref("account.demo_invoice_0")) - assert (not invoice.move_id), "Move wrongly created at draft" + assert (not invoice.move_id), "Moves are wrongly created for invoice." - - I change the state of invoice to "open". + I open the invoice. - !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} - @@ -19,28 +19,26 @@ !assert {model: account.invoice, id: account.demo_invoice_0, severity: error, string: Invoice should be in 'Open' state}: - state == 'open' - - I change the state of Payment Order to "Confirmed". + I confirm the payment order. - !workflow {model: payment.order, action: open, ref: payment_order_1} - - I check that Payment order is now "Confirmed". + I check that payment order is now "Confirmed". - - !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Confirmed' state}: + !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be 'Confirmed'.}: - state == 'open' -- - I create a record for payment order create. - !record {model: payment.order.create, id: payment_order_create_0}: duedate: !eval time.strftime('%Y-%m-%d') - - I perform a action to search the entries for create a payment line + I search for the invoice entries to make the payment. - !python {model: payment.order.create}: | self.search_entries(cr, uid, [ref("payment_order_create_0")], { "active_model": "payment.order", "active_ids": [ref("payment_order_1")], "active_id": ref("payment_order_1"), }) - - In order to make entries in payment line, I create a entries. + I create payment lines entries. - !python {model: payment.order.create}: | invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) @@ -50,7 +48,7 @@ "active_model": "payment.order", "active_ids": [ref("payment_order_1")], "active_id": ref("payment_order_1")}) - - I check a payment line is created with proper data. + I check that payment line is created with proper data. - !python {model: payment.order}: | invoice = self.pool.get('account.invoice').browse(cr, uid, ref("account.demo_invoice_0")) @@ -59,27 +57,27 @@ assert payment_line.move_line_id, "move line is not created in payment line." assert invoice.move_id.name == payment_line.ml_inv_ref.number, "invoice reference number is not same created." - assert invoice.partner_id == payment_line.partner_id, "partner is not same created." - assert invoice.date_due == payment_line.ml_maturity_date, "due date is not same created." - assert invoice.amount_total == payment_line.amount, "payment amount is not same created." + assert invoice.partner_id == payment_line.partner_id, "Partner is not correct." + assert invoice.date_due == payment_line.ml_maturity_date, "Due date is not correct." + assert invoice.amount_total == payment_line.amount, "Payment amount is not correct." - - I change the state of payment order to "done". + After making all payments, I finish the payment order. - !python {model: payment.order}: | self.set_done(cr, uid, [ref("payment_order_1")]) - - I check that Payment order is now "done". + I check that payment order is now "Done". - !assert {model: payment.order, id: payment_order_1, severity: error, string: Payment Order should be in 'Done' state}: - state == 'done' - - I check a payment order is done with proper data. + I check that payment order is done with proper data. - !python {model: payment.order}: | payment = self.browse(cr, uid, ref("payment_order_1")) - assert payment.date_done, "date is not created after done payment order" + assert payment.date_done, "Date is not created." - - I create a record for bank statement. + I create a bank statement. - !record {model: account.bank.statement, id: account_bank_statement_1}: balance_end_real: 0.0 @@ -89,7 +87,7 @@ name: / period_id: account.period_10 - - In order to make entries in bank statement line, I import payment order lines. + I import payment order lines for the bank statement. - !python {model: account.payment.populate.statement}: | payment = self.pool.get('payment.order').browse(cr, uid, ref("payment_order_1")) @@ -106,4 +104,4 @@ line_id = self.browse(cr, uid,payment.line_ids[0].id,context) assert line_id.info_owner, "Owner Account not proper." assert line_id.info_partner, "Destination Account not proper." - assert line_id.ml_inv_ref, "Invoice reference is not proper." \ No newline at end of file + assert line_id.ml_inv_ref, "Invoice reference is not proper." From 5e4f8b529abb05c08d72c09255e6b8d1eae6cfae Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 5 Jan 2012 15:28:38 +0530 Subject: [PATCH 17/19] [IMP]product:set a order by _parent_order to sort a category by parent to child relation bzr revid: mma@tinyerp.com-20120105095838-kexii21iratg1t3b --- addons/product/product.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 36aeebd1134..abd40aec492 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -213,14 +213,13 @@ class product_category(osv.osv): _description = "Product Category" _columns = { 'name': fields.char('Name', size=64, required=True, translate=True), - 'complete_name': fields.function(_name_get_fnc, type="char", string='Name',size=256, - store={ - 'product.category': (lambda self, cr, uid, ids, c={}: ids, ['name','parent_id'], 10), - }), - 'parent_id': fields.many2one('product.category','Parent Category', select=True), + 'complete_name': fields.function(_name_get_fnc, type="char", string='Name'), + 'parent_id': fields.many2one('product.category','Parent Category', select=True, ondelete='cascade'), 'child_id': fields.one2many('product.category', 'parent_id', string='Child Categories'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."), 'type': fields.selection([('view','View'), ('normal','Normal')], 'Category Type'), + 'parent_left': fields.integer('Left Parent', select=1), + 'parent_right': fields.integer('Right Parent', select=1), } @@ -228,7 +227,11 @@ class product_category(osv.osv): 'type' : lambda *a : 'normal', } - _order = 'complete_name' + _parent_name = "parent_id" + _parent_store = True + _parent_order = 'sequence,name' + _order = 'parent_left' + def _check_recursion(self, cr, uid, ids, context=None): level = 100 while len(ids): From 481ca116336a3a2142e9e317a48dfa522186e90e Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Thu, 5 Jan 2012 12:22:47 +0100 Subject: [PATCH 18/19] [IMP] product: remove cascading delete on product categories bzr revid: rco@openerp.com-20120105112247-yn1nhecqgyhcxna7 --- addons/product/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index abd40aec492..2a3015e37ab 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -214,7 +214,7 @@ class product_category(osv.osv): _columns = { 'name': fields.char('Name', size=64, required=True, translate=True), 'complete_name': fields.function(_name_get_fnc, type="char", string='Name'), - 'parent_id': fields.many2one('product.category','Parent Category', select=True, ondelete='cascade'), + 'parent_id': fields.many2one('product.category','Parent Category', select=True), 'child_id': fields.one2many('product.category', 'parent_id', string='Child Categories'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."), 'type': fields.selection([('view','View'), ('normal','Normal')], 'Category Type'), @@ -229,7 +229,7 @@ class product_category(osv.osv): _parent_name = "parent_id" _parent_store = True - _parent_order = 'sequence,name' + _parent_order = 'sequence, name' _order = 'parent_left' def _check_recursion(self, cr, uid, ids, context=None): From c3c70e2dcfd886cc25355cb962a9b21c77887772 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Thu, 5 Jan 2012 14:33:30 +0100 Subject: [PATCH 19/19] [IMP small fix in POS bzr revid: fp@tinyerp.com-20120105133330-pgqqrzkhx7ajuy2j --- addons/point_of_sale/point_of_sale_workflow.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale_workflow.xml b/addons/point_of_sale/point_of_sale_workflow.xml index c8e05788d3d..31781641c6f 100644 --- a/addons/point_of_sale/point_of_sale_workflow.xml +++ b/addons/point_of_sale/point_of_sale_workflow.xml @@ -18,7 +18,7 @@ paid - dummy + write({'state':'paid'})