flectra/addons/product_margin/test/product_margin.yml
flectra-admin 769eafb483 [INIT] Inception of Flectra from Odoo
Flectra is Forked from Odoo v11 commit : (6135e82d73)
2018-01-16 11:45:59 +05:30

26 lines
1.3 KiB
YAML

-
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 PC-DEM
-
!python {model: product.margin, id: False}: |
self.browse(ref('product_margin_wiz0')).with_context({"lang": 'en_US',
"search_default_filter_to_sell": "1", "tz": False, "active_model": "product.product", "disable_log": True,
"active_ids": [ref("product.product_product_5")], "active_id": ref("product.product_product_5")}).action_open_window()
-
I read the fields of the product.
-
!python {model: product.product, id: False}: |
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.browse(ref('product_margin_wiz0')).with_context({"lang": 'en_US',
"search_default_filter_to_sell": "1", "tz": False, "active_model": "product.product",
"bin_size": True, "active_ids": [ref("product.product_product_5")],
"active_id": ref("product.product_product_5")}).read(fields)