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] [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