summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2011-12-20 10:07:52 +0100
committerRaphael Collet <rco@openerp.com>2011-12-20 10:07:52 +0100
commit33155125bddc195475e7f1cb41ca6f9ee088df79 (patch)
treed1942b7ce41b82d81c3fbf6f6034ebe70c16d469 /addons
parentdf44e44cc2a55ca65f94f6fbbc24c3f3a9cab225 (diff)
parent0919bba650c7df37b97bfea623671faf05c6c8da (diff)
[MERGE] purchase, purchase_double_validation: clean yml
bzr revid: rco@openerp.com-20111220090752-25d6vv195l193rfy
Diffstat (limited to 'addons')
-rw-r--r--addons/purchase/__openerp__.py1
-rw-r--r--addons/purchase/report/order.py7
-rw-r--r--addons/purchase/test/process/invoice_on_poline.yml27
-rw-r--r--addons/purchase_double_validation/__openerp__.py5
-rw-r--r--addons/purchase_double_validation/test/purchase_double_validation_demo.yml13
-rwxr-xr-xaddons/purchase_double_validation/test/purchase_double_validation_test.yml113
6 files changed, 67 insertions, 99 deletions
diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py
index 010b0369edf..373c7b51fc2 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/report/order.py b/addons/purchase/report/order.py
index 6c99d6381f4..c19ef9c4ba1 100644
--- a/addons/purchase/report/order.py
+++ b/addons/purchase/report/order.py
@@ -33,6 +33,8 @@ 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 +46,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 +76,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
new file mode 100644
index 00000000000..c2ad07aab95
--- /dev/null
+++ b/addons/purchase/test/process/invoice_on_poline.yml
@@ -0,0 +1,27 @@
+-
+ I confirm purchase order which has invoicing control method "Based on Purchase Order Lines".
+-
+ !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)
+-
+ 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 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'})
+ self.execute(cr, uid, [new_id])
+
diff --git a/addons/purchase_double_validation/__openerp__.py b/addons/purchase_double_validation/__openerp__.py
index eda89e81aa8..b8c0225fd2f 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/purchase_double_validation_demo.yml',
+ 'test/purchase_double_validation_test.yml'
+ ],
'demo_xml': [],
'installable': True,
'active': False,
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..a3143de5ee7
--- /dev/null
+++ b/addons/purchase_double_validation/test/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
+
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 ecc8d08a493..0d37b22abcf 100755
--- a/addons/purchase_double_validation/test/purchase_double_validation_test.yml
+++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml
@@ -1,117 +1,36 @@
-
- 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
--
- 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.
+ In order to test the flow, I confirmed the purchase 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.
+ !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11}
-
- !assert {model: purchase.order, id: purchase_order_po11}:
- - state == 'draft'
+ 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.
-
- I confirm the purchase order for MOB1.
+ !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should not be in Approved state.}:
+ - state != 'approved'
-
- !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.
+ I Approved the purchase order.
-
- !assert {model: purchase.order, id: purchase_order_po11}:
- - state == 'confirmed'
+ !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase11}
-
- 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: order_purchase11, severity: error, string: Purchase Order should be in Approved state.}:
+ - state == 'approved'
-
- !assert {model: purchase.order, id: purchase_order_po12}:
- - state == 'draft'
+ I confirmed the purchase order of amount of less than Limit amount.
-
- I confirm the purchase order for MOB1.
+ !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12}
-
- !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.
+ I check that the order is in approved state.
-
- !assert {model: purchase.order, id: purchase_order_po12}:
+ !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