2 In order to test the product_margin module, I create a product margin record
4 !record {model: product.margin, id: product_margin_wiz0}:
5 from_date: !eval "'%s-01-01' %(datetime.now().year)"
6 to_date: !eval "'%s-12-31' %(datetime.now().year)"
7 invoice_state: open_paid
11 !python {model: product.margin}: |
12 self.action_open_window(cr, uid, [ref("product_margin_wiz0")], {"lang": 'en_US',
13 "search_default_filter_to_sell": "1", "tz": False, "active_model": "product.product", "disable_log": True,
14 "active_ids": [ref("product.product_product_pc3")], "active_id": ref("product.product_product_pc3")})
16 I read the fields of the product.
18 !python {model: product.product}: |
19 fields = ['sale_avg_price', 'expected_margin_rate', 'total_margin_rate', 'total_cost', 'sale_num_invoiced',
20 'total_margin', 'sales_gap', 'purchase_num_invoiced', 'expected_margin', 'turnover']
21 self.read(cr, uid, [ref("product_margin_wiz0")], fields, {"lang": 'en_US',
22 "search_default_filter_to_sell": "1", "tz": False, "active_model": "product.product",
23 "bin_size": True, "active_ids": [ref("product.product_product_pc3")],
24 "active_id": ref("product.product_product_pc3")})