[IMP] Improved YML test cases of purchase module.

bzr revid: tpa@tinyerp.com-20111213102640-7mz5rddu4mtzir9e
This commit is contained in:
Turkesh Patel (Open ERP) 2011-12-13 15:56:40 +05:30
parent d8b58b2c8f
commit 88f0fda7de
2 changed files with 16 additions and 3 deletions

View File

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

View File

@ -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."