diff --git a/addons/product_margin/__openerp__.py b/addons/product_margin/__openerp__.py index 69553f1aced..9ef858fa9ec 100644 --- a/addons/product_margin/__openerp__.py +++ b/addons/product_margin/__openerp__.py @@ -37,6 +37,7 @@ The wizard to launch the report has several options to help you get the data you 'wizard/product_margin_view.xml', 'product_margin_view.xml' ], + 'test':['test/product_margin.yml'], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/product_margin/test/product_margin.yml b/addons/product_margin/test/product_margin.yml new file mode 100644 index 00000000000..fa8241ab206 --- /dev/null +++ b/addons/product_margin/test/product_margin.yml @@ -0,0 +1,25 @@ +- + In order to test the product_margin module, I create a product margin record +- + !record {model: product.margin, id: product_margin_wiz0}: + from_date: !eval "'%s-01-01' %(datetime.now().year)" + to_date: !eval "'%s-12-31' %(datetime.now().year)" + invoice_state: open_paid +- + I open margin for PC3 +- + !python {model: product.margin}: | + self.action_open_window(cr, uid, [ref("product_margin_wiz0")], {"lang": 'en_US', + "search_default_filter_to_sell": "1", "tz": False, "active_model": "product.product", "disable_log": True, + "active_ids": [ref("product.product_product_pc3")], "active_id": ref("product.product_product_pc3")}) +- + I read the fields of the product. +- + !python {model: product.product}: | + fields = ['sale_avg_price', 'expected_margin_rate', 'total_margin_rate', 'total_cost', 'sale_num_invoiced', + 'total_margin', 'sales_gap', 'purchase_num_invoiced', 'expected_margin', 'turnover'] + self.read(cr, uid, [ref("product_margin_wiz0")], fields, {"lang": 'en_US', + "search_default_filter_to_sell": "1", "tz": False, "active_model": "product.product", + "bin_size": True, "active_ids": [ref("product.product_product_pc3")], + "active_id": ref("product.product_product_pc3")}) +