Hello i am trying to develop a proteus script in order do change the cost_price of a product. i know i should use a wizzard but i do not kow how to do such thing and i do not know where to find some piece of code that could help. i only found how to do if the product has no stock_move.
You should use the wizard class on proteus to instantiate a wizard and run some of its methods.
You can see an example in the proteus documentation:
1 Like
thanks ![]()
i found some code to help in
trytond/modules/stock/tests/scenario_stock_average_cost_price.rst
and i have a working snippet
import warnings ; warnings.warn = lambda *args,**kwargs: None
from proteus import config, Model, Wizard, Report
import sys
my_config = config.set_trytond('postgresql:///BDD',config_file='/etc/tryton/trytond.conf')
The_Product = Model.get('product.product')
the_product,=The_Product.find([('code', '=', 'BDT0001')]) #<==product code
modify_cost_price = Wizard('product.modify_cost_price',[the_product])
modify_cost_price.form.cost_price ='11.85' #<==new pricee
modify_cost_price.execute('modify')