From 78dcac034ade311fef136b1a87131a868d1173b2 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 6 Dec 2011 12:33:25 +0530 Subject: [PATCH 01/11] [IMP]:changed expected in PO bzr revid: ksa@tinyerp.com-20111206070325-m6rayl7d6rw4li7e --- addons/purchase/test/process/cancel_order.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/purchase/test/process/cancel_order.yml b/addons/purchase/test/process/cancel_order.yml index 4ac8e09443f..9ef5597b2d2 100644 --- a/addons/purchase/test/process/cancel_order.yml +++ b/addons/purchase/test/process/cancel_order.yml @@ -4,6 +4,13 @@ I confirm the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase4} +- + I changed Expected Date to Next Day. +- + !python {model: purchase.order}: | + import datetime + next_day = (datetime.date.today()+datetime.timedelta(days=1)) + self.write(cr, uid, [ref("order_purchase4")], {'minimum_planned_date': next_day}) - I check the "Approved" status after confirmed RFQ. - From 07f69837f5483ab2442568fb1565c7cd0eccbe88 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 6 Dec 2011 16:38:04 +0530 Subject: [PATCH 02/11] [IMP]:create invoice on po line bzr revid: ksa@tinyerp.com-20111206110804-ydk9e2cyuk2erejn --- addons/purchase/__openerp__.py | 1 + .../purchase/test/process/invoice_on_poline.yml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 addons/purchase/test/process/invoice_on_poline.yml diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index b4f3a9adf30..ab188d8f95c 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -67,6 +67,7 @@ Dashboard for purchase management that includes: 'test/process/run_scheduler.yml', 'test/process/merge_order.yml', 'test/process/edi_purchase_order.yml', + 'test/process/invoice_on_poline.yml', 'test/ui/print_report.yml', 'test/ui/duplicate_order.yml', 'test/ui/delete_order.yml', diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml new file mode 100644 index 00000000000..7cdfd3c259f --- /dev/null +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -0,0 +1,17 @@ +- + In order to test the flow, I start it from confirmed purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase6} +- + In order to test create invoice for purchase order line. +- + !python {model: purchase.order}: | + invoice_line_obj = self.pool.get('purchase.order.line_invoice') + purchase_order = self.browse(cr, uid, ref("order_purchase6")) + context.update({'active_model': 'purchase.order', 'active_ids': [ref("order_purchase6")]}) + for purchase_line in purchase_order.order_line: + invoice_line_obj.makeInvoices(cr, uid, purchase_line.id, context=context) + assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." + assert purchase_line.invoiced == True + assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." + From 067e49739dd0a3d75af36fc1ffa1d274954de7ed Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 7 Dec 2011 11:48:31 +0530 Subject: [PATCH 03/11] [ADD]:demo data for purchase double validation bzr revid: ksa@tinyerp.com-20111207061831-37z6bwtvrcu6393m --- .../process/purchase_double_validation_demo.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml new file mode 100644 index 00000000000..7c074675b75 --- /dev/null +++ b/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml @@ -0,0 +1,13 @@ +- + !record {model: purchase.order, id: order_purchase11}: + partner_id: base.res_partner_desertic_hispafuentes + order_line: + - product_id: product.product_product_pc4 + product_qty: 10 + +- + !record {model: purchase.order, id: order_purchase12}: + partner_id: base.res_partner_vickingdirect0 + order_line: + - product_id: product.product_product_hdd2 + product_qty: 10 From 0b687827bd7b770774e9c230139b9fd4bf91a8db Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 7 Dec 2011 11:50:31 +0530 Subject: [PATCH 04/11] [IMP]:yml for double validation bzr revid: ksa@tinyerp.com-20111207062031-lxtpm8bvx09ehp0l --- .../purchase_double_validation/__openerp__.py | 5 +- .../purchase_double_validation_test.yml | 62 ++++++++++ .../test/purchase_double_validation_test.yml | 117 ------------------ 3 files changed, 66 insertions(+), 118 deletions(-) create mode 100755 addons/purchase_double_validation/test/process/purchase_double_validation_test.yml delete mode 100755 addons/purchase_double_validation/test/purchase_double_validation_test.yml diff --git a/addons/purchase_double_validation/__openerp__.py b/addons/purchase_double_validation/__openerp__.py index cd379afdb59..82a18cba335 100644 --- a/addons/purchase_double_validation/__openerp__.py +++ b/addons/purchase_double_validation/__openerp__.py @@ -41,7 +41,10 @@ that exceeds minimum amount set by configuration wizard. 'purchase_double_validation_installer.xml', 'board_purchase_view.xml' ], - 'test': ['test/purchase_double_validation_test.yml'], + 'test': [ + 'test/process/purchase_double_validation_demo.yml', + 'test/process/purchase_double_validation_test.yml' + ], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml new file mode 100755 index 00000000000..a2582553bc1 --- /dev/null +++ b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml @@ -0,0 +1,62 @@ +- + I Create new limit amount from Configure Limit Amount for Purchase wizard. +- + !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: + limit_amount: 3000 +- + Then I set the Limit Amount. +- + !python {model: purchase.double.validation.installer}: | + self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) +- + Test for purchase double validation in which Total > = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase11")) + assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" +- + In order to test the flow, I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} +- + I check that the order which was initially in the draft state has transmit to confirm state for double validation. +- + !assert {model: purchase.order, id: order_purchase11}: + - state == 'confirmed' +- + I Approved the purchase order. +- + !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase11} +- + I check that the order which was initially in the confirmed state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase11}: + - state == 'approved' +- + Test for purchase double validation in which Total < = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase12")) + assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Less then the Limit Amount" +- + I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} +- + I check that the order which was initially in the draft state has transmit to confirm state for double validation. +- + !assert {model: purchase.order, id: order_purchase12}: + - state == 'confirmed' +- + I Approved the purchase order. +- + !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase12} +- + I check that the order which was initially in the confirmed state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase12}: + - state == 'approved' + + diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml deleted file mode 100755 index ecc8d08a493..00000000000 --- a/addons/purchase_double_validation/test/purchase_double_validation_test.yml +++ /dev/null @@ -1,117 +0,0 @@ -- - I Create new limit amount from Configure Limit Amount for Purchase wizard. -- - !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: - limit_amount: 3000 -- - Then I set the Limit Amount -- - !python {model: purchase.double.validation.installer}: | - self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) -- - In order to test the purchase double validation flow,I start by creating a new product 'MOB1' -- - !record {model: product.product, id: product_product_mob1}: - categ_id: 'product.product_category_3' - cost_method: standard - mes_type: fixed - name: MOB1 - price_margin: 2.0 - procure_method: make_to_stock - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production - seller_delay: '1' - standard_price: 2000.0 - supply_method: buy - type: product - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit - volume: 0.0 - warranty: 0.0 - weight: 0.0 - weight_net: 0.0 -- - In order to test the purchase double validation flow,I create a new record where "invoice_method" is From Order. -- - Test for purchase double validation in which Total > = Limit Amount. -- - I create purchase order for MOB1 for 3 quantity. -- - !record {model: purchase.order, id: purchase_order_po11}: - company_id: base.main_company - date_order: '2011-01-1' - invoice_method: order - location_id: stock.stock_location_stock - order_line: - - date_planned: '2011-01-11' - name: MOB1 - price_unit: 2000.0 - product_id: 'product_product_mob1' - product_qty: 3.0 - product_uom: product.product_uom_unit - state: draft - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 - pricelist_id: purchase.list0 -- - Initially purchase order is in the draft state. -- - !assert {model: purchase.order, id: purchase_order_po11}: - - state == 'draft' -- - I confirm the purchase order for MOB1. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po11} -- - I check that the order which was initially in the draft state has transmit to confirm state for double validation. -- - !assert {model: purchase.order, id: purchase_order_po11}: - - state == 'confirmed' -- - I Approved purchase order by Supplier for MOB1. -- - !workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po11} -- - I check that the order which was initially in the confirmed state has transmit to approved state. -- - !assert {model: purchase.order, id: purchase_order_po11}: - - state == 'approved' -- - Test for purchase double validation in which Total < Limit Amount. -- - I create purchase order for MOB1 for 1 quantity. -- - !record {model: purchase.order, id: purchase_order_po12}: - company_id: base.main_company - date_order: '2011-01-02' - invoice_method: order - location_id: stock.stock_location_stock - order_line: - - date_planned: '2011-01-12' - name: MOB1 - price_unit: 2000.0 - product_id: 'product_product_mob1' - product_qty: 1.0 - product_uom: product.product_uom_unit - state: draft - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 - pricelist_id: purchase.list0 -- - Initially purchase order is in the draft state. -- - !assert {model: purchase.order, id: purchase_order_po12}: - - state == 'draft' -- - I confirm the purchase order for MOB1. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po12} -- - I check that the order which was initially in the draft state has transmit to approved state. -- - !assert {model: purchase.order, id: purchase_order_po12}: - - state == 'approved' - - - \ No newline at end of file From ab67c3db61ff0fdeb591686badc269863ec45202 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 7 Dec 2011 11:55:00 +0530 Subject: [PATCH 05/11] [IMP]: improved the statement bzr revid: ksa@tinyerp.com-20111207062500-4rztx35ds937lbsj --- .../test/process/purchase_double_validation_test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml index a2582553bc1..634c1976ea2 100755 --- a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml +++ b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml @@ -44,17 +44,12 @@ I confirmed the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} -- - I check that the order which was initially in the draft state has transmit to confirm state for double validation. -- - !assert {model: purchase.order, id: order_purchase12}: - - state == 'confirmed' - I Approved the purchase order. - !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase12} - - I check that the order which was initially in the confirmed state has transmit to approved state. + I check that the order has transmit to approved state. - !assert {model: purchase.order, id: order_purchase12}: - state == 'approved' From 88f0fda7dee83e205aed60913498079617d3bd5d Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Tue, 13 Dec 2011 15:56:40 +0530 Subject: [PATCH 06/11] [IMP] Improved YML test cases of purchase module. bzr revid: tpa@tinyerp.com-20111213102640-7mz5rddu4mtzir9e --- addons/purchase/report/order.py | 6 +++++- addons/purchase/test/process/invoice_on_poline.yml | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/purchase/report/order.py b/addons/purchase/report/order.py index 6c99d6381f4..c017a0b7838 100644 --- a/addons/purchase/report/order.py +++ b/addons/purchase/report/order.py @@ -33,6 +33,7 @@ class order(report_sxw.rml_parse): 'get_tax': self._get_tax, 'get_product_code': self._get_product_code, }) + #dead code def _get_line_tax(self, line_obj): self.cr.execute("SELECT tax_id FROM purchase_order_taxe WHERE order_line_id=%s", (line_obj.id)) res = self.cr.fetchall() or None @@ -44,7 +45,8 @@ class order(report_sxw.rml_parse): tax_ids = res[0] res = [tax.name for tax in pooler.get_pool(self.cr.dbname).get('account.tax').browse(self.cr, self.uid, tax_ids)] return ",\n ".join(res) - + + #dead code def _get_tax(self, order_obj): self.cr.execute("SELECT DISTINCT tax_id FROM purchase_order_taxe, purchase_order_line, purchase_order \ WHERE (purchase_order_line.order_id=purchase_order.id) AND (purchase_order.id=%s)", (order_obj.id)) @@ -73,6 +75,8 @@ class order(report_sxw.rml_parse): 'base':base, 'amount':base*tax.amount}) return res + + #dead code def _get_product_code(self, product_id, partner_id): product_obj=pooler.get_pool(self.cr.dbname).get('product.product') return product_obj._product_code(self.cr, self.uid, [product_id], name=None, arg=None, context={'partner_id': partner_id})[product_id] diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml index 7cdfd3c259f..faf0e4354c8 100644 --- a/addons/purchase/test/process/invoice_on_poline.yml +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -1,3 +1,13 @@ +- + I create the Default invoicing control method "Based on Purchase Order Lines". +- + !record {model: purchase.config.wizard, id: invoice_control}: + default_method: manual +- + I set the Default invoicing control method "Based on Purchase Order Lines". +- + !python {model: purchase.config.wizard}: | + self.execute(cr, uid, [ref('invoice_control')]) - In order to test the flow, I start it from confirmed purchase order. - @@ -13,5 +23,4 @@ invoice_line_obj.makeInvoices(cr, uid, purchase_line.id, context=context) assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." assert purchase_line.invoiced == True - assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." - + assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." \ No newline at end of file From 2c87b0e5f91b099f7b39ee2944a67274c8ccd3f4 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 16 Dec 2011 12:57:54 +0530 Subject: [PATCH 07/11] [IMP] Improved YML test cases of Purchase_double_validation module. bzr revid: tpa@tinyerp.com-20111216072754-s2nwygk3mhp8cvea --- .../purchase_double_validation/__openerp__.py | 4 +- .../purchase_double_validation_demo.yml | 13 ----- .../purchase_double_validation_test.yml | 57 ------------------- 3 files changed, 2 insertions(+), 72 deletions(-) delete mode 100644 addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml delete mode 100755 addons/purchase_double_validation/test/process/purchase_double_validation_test.yml diff --git a/addons/purchase_double_validation/__openerp__.py b/addons/purchase_double_validation/__openerp__.py index e0fb45857e5..17c600fb832 100644 --- a/addons/purchase_double_validation/__openerp__.py +++ b/addons/purchase_double_validation/__openerp__.py @@ -42,8 +42,8 @@ that exceeds minimum amount set by configuration wizard. 'board_purchase_view.xml' ], 'test': [ - 'test/process/purchase_double_validation_demo.yml', - 'test/process/purchase_double_validation_test.yml' + 'test/purchase_double_validation_demo.yml', + 'test/purchase_double_validation_test.yml' ], 'demo_xml': [], 'installable': True, diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml deleted file mode 100644 index 7c074675b75..00000000000 --- a/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml +++ /dev/null @@ -1,13 +0,0 @@ -- - !record {model: purchase.order, id: order_purchase11}: - partner_id: base.res_partner_desertic_hispafuentes - order_line: - - product_id: product.product_product_pc4 - product_qty: 10 - -- - !record {model: purchase.order, id: order_purchase12}: - partner_id: base.res_partner_vickingdirect0 - order_line: - - product_id: product.product_product_hdd2 - product_qty: 10 diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml deleted file mode 100755 index 634c1976ea2..00000000000 --- a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml +++ /dev/null @@ -1,57 +0,0 @@ -- - I Create new limit amount from Configure Limit Amount for Purchase wizard. -- - !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: - limit_amount: 3000 -- - Then I set the Limit Amount. -- - !python {model: purchase.double.validation.installer}: | - self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) -- - Test for purchase double validation in which Total > = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase11")) - assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" -- - In order to test the flow, I confirmed the purchase order. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} -- - I check that the order which was initially in the draft state has transmit to confirm state for double validation. -- - !assert {model: purchase.order, id: order_purchase11}: - - state == 'confirmed' -- - I Approved the purchase order. -- - !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase11} -- - I check that the order which was initially in the confirmed state has transmit to approved state. -- - !assert {model: purchase.order, id: order_purchase11}: - - state == 'approved' -- - Test for purchase double validation in which Total < = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase12")) - assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Less then the Limit Amount" -- - I confirmed the purchase order. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} -- - I Approved the purchase order. -- - !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase12} -- - I check that the order has transmit to approved state. -- - !assert {model: purchase.order, id: order_purchase12}: - - state == 'approved' - - From c7027f8e95a4c63b1938257f04e01d74cd11f744 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 16 Dec 2011 13:30:55 +0530 Subject: [PATCH 08/11] [IMP] Improved YML test cases of Purchase_double_validation module. bzr revid: tpa@tinyerp.com-20111216080055-ikpnnuwkaa785pbw --- .../test/purchase_double_validation_demo.yml | 12 +++++ .../test/purchase_double_validation_test.yml | 51 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 addons/purchase_double_validation/test/purchase_double_validation_demo.yml create mode 100755 addons/purchase_double_validation/test/purchase_double_validation_test.yml diff --git a/addons/purchase_double_validation/test/purchase_double_validation_demo.yml b/addons/purchase_double_validation/test/purchase_double_validation_demo.yml new file mode 100644 index 00000000000..7e91f3fc03a --- /dev/null +++ b/addons/purchase_double_validation/test/purchase_double_validation_demo.yml @@ -0,0 +1,12 @@ +- + !record {model: purchase.order, id: order_purchase11}: + partner_id: base.res_partner_desertic_hispafuentes + order_line: + - product_id: product.product_product_pc4 + product_qty: 10 +- + !record {model: purchase.order, id: order_purchase12}: + partner_id: base.res_partner_vickingdirect0 + order_line: + - product_id: product.product_product_hdd2 + product_qty: 10 \ No newline at end of file diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml new file mode 100755 index 00000000000..cb4841e7fa8 --- /dev/null +++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml @@ -0,0 +1,51 @@ +- + I Create new limit amount from Configure Limit Amount for Purchase wizard. +- + !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: + limit_amount: 3000 +- + I set the Limit Amount. +- + !python {model: purchase.double.validation.installer}: | + self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) +- + I Test for purchase double validation in which Total > = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase11")) + assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Less then the Limit Amount" +- + In order to test the flow, I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} +- + I check that the order which was initially in the draft state has transmit to confirm state for double validation. +- + !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Confirmed state.}: + - state == 'confirmed' +- + I Approved the purchase order. +- + !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase11} +- + I check that the order which was initially in the confirmed state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Approved state.}: + - state == 'approved' +- + Test for purchase double validation in which Total < = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase12")) + assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" +- + I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} +- + I check that the order is in approved state. +- + !assert {model: purchase.order, id: order_purchase12, severity: error, string: Purchase Order should be in Approved state.}: + - state == 'approved' \ No newline at end of file From f498776b63cc8bedda98739ced974811c98d5f6b Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 16 Dec 2011 18:54:39 +0530 Subject: [PATCH 09/11] [IMP] improvement in YML test cases in purchase module. bzr revid: tpa@tinyerp.com-20111216132439-ztvw2em8gxh44c0i --- addons/purchase/test/process/cancel_order.yml | 7 ----- .../test/process/invoice_on_poline.yml | 26 +++++++++---------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/addons/purchase/test/process/cancel_order.yml b/addons/purchase/test/process/cancel_order.yml index 9ef5597b2d2..4ac8e09443f 100644 --- a/addons/purchase/test/process/cancel_order.yml +++ b/addons/purchase/test/process/cancel_order.yml @@ -4,13 +4,6 @@ I confirm the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase4} -- - I changed Expected Date to Next Day. -- - !python {model: purchase.order}: | - import datetime - next_day = (datetime.date.today()+datetime.timedelta(days=1)) - self.write(cr, uid, [ref("order_purchase4")], {'minimum_planned_date': next_day}) - I check the "Approved" status after confirmed RFQ. - diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml index faf0e4354c8..8c61e679cef 100644 --- a/addons/purchase/test/process/invoice_on_poline.yml +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -1,13 +1,3 @@ -- - I create the Default invoicing control method "Based on Purchase Order Lines". -- - !record {model: purchase.config.wizard, id: invoice_control}: - default_method: manual -- - I set the Default invoicing control method "Based on Purchase Order Lines". -- - !python {model: purchase.config.wizard}: | - self.execute(cr, uid, [ref('invoice_control')]) - In order to test the flow, I start it from confirmed purchase order. - @@ -21,6 +11,16 @@ context.update({'active_model': 'purchase.order', 'active_ids': [ref("order_purchase6")]}) for purchase_line in purchase_order.order_line: invoice_line_obj.makeInvoices(cr, uid, purchase_line.id, context=context) - assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." - assert purchase_line.invoiced == True - assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." \ No newline at end of file +- + I check the invoice of order. +- + !python {model: purchase.order}: | + purchase_order = self.browse(cr, uid, ref("order_purchase6")) + for purchase_line in purchase_order.order_line: + assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." +- + I create the Default invoicing control method "Based on Purchase Order Lines". +- + !python {model: purchase.config.wizard}: | + new_id = self.create(cr ,uid, {'default_method': 'manual'}) + self.execute(cr, uid, [new_id]) \ No newline at end of file From 1c2ce5e611d1794c8807db32a82d7ffe4e30af9d Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 19 Dec 2011 11:07:49 +0530 Subject: [PATCH 10/11] [IMP] Improved YML string in purchase_double_validation module bzr revid: tpa@tinyerp.com-20111219053749-qevy3tpm8eqh4wl1 --- .../test/purchase_double_validation_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml index cb4841e7fa8..25c75242c1b 100755 --- a/addons/purchase_double_validation/test/purchase_double_validation_test.yml +++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml @@ -41,7 +41,7 @@ purchase_order = self.browse(cr, uid, ref("order_purchase12")) assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" - - I confirmed the purchase order. + I confirmed the purchase order of amount of less than Limit amount. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} - From 0919bba650c7df37b97bfea623671faf05c6c8da Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 19 Dec 2011 15:24:03 +0530 Subject: [PATCH 11/11] [IMP]improvement in YML test cases in purchase and purchase_double_validation module. bzr revid: tpa@tinyerp.com-20111219095403-eaz809x63h114kog --- .../test/process/invoice_on_poline.yml | 4 ++-- .../test/purchase_double_validation_test.yml | 24 ++++--------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml index 8c61e679cef..22d21fa92ed 100644 --- a/addons/purchase/test/process/invoice_on_poline.yml +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -1,5 +1,5 @@ - - In order to test the flow, I start it from confirmed purchase order. + I confirm purchase order which has invoicing control method "Based on Purchase Order Lines". - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase6} - @@ -19,7 +19,7 @@ for purchase_line in purchase_order.order_line: assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." - - I create the Default invoicing control method "Based on Purchase Order Lines". + I set the default invoicing control method "Based on Purchase Order Lines". - !python {model: purchase.config.wizard}: | new_id = self.create(cr ,uid, {'default_method': 'manual'}) diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml index 25c75242c1b..65578d1e5f4 100755 --- a/addons/purchase_double_validation/test/purchase_double_validation_test.yml +++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml @@ -1,29 +1,20 @@ - - I Create new limit amount from Configure Limit Amount for Purchase wizard. + I set new limit amount from Configure Limit Amount for Purchase . - !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: limit_amount: 3000 -- - I set the Limit Amount. - !python {model: purchase.double.validation.installer}: | self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) -- - I Test for purchase double validation in which Total > = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase11")) - assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Less then the Limit Amount" - In order to test the flow, I confirmed the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} - - I check that the order which was initially in the draft state has transmit to confirm state for double validation. + I check that the order which was initially in the draft state has transmit to confirm state for double validation it should not an Approve state. - - !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Confirmed state.}: - - state == 'confirmed' + !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should not be in Approved state.}: + - state != 'approved' - I Approved the purchase order. - @@ -33,13 +24,6 @@ - !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Approved state.}: - state == 'approved' -- - Test for purchase double validation in which Total < = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase12")) - assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" - I confirmed the purchase order of amount of less than Limit amount. -