Merge lp:~camptocamp/oerpscenario/trunk-python-add_default_values_step-afe into lp:oerpscenario

Proposed by Alexandre Fayolle - camptocamp
Status: Merged
Merged at revision: 328
Proposed branch: lp:~camptocamp/oerpscenario/trunk-python-add_default_values_step-afe
Merge into: lp:oerpscenario
Diff against target: 25 lines (+18/-0)
1 file modified
features/steps/dsl.py (+18/-0)
To merge this branch: bzr merge lp:~camptocamp/oerpscenario/trunk-python-add_default_values_step-afe
Reviewer Review Type Date Requested Status
Leonardo Pistone code review Approve
Guewen Baconnier @ Camptocamp code review Approve
Yannick Vaucher @ Camptocamp code review, no tests Approve
Review via email: mp+206152@code.launchpad.net

Description of the change

add a new step to set default values for a column in a scenario. The implementation manages per company default (if 'Given I am configuring the company with ref "xxxx"' was used).

To post a comment you must log in.
329. By Alexandre Fayolle - camptocamp

[IMP] example use of the new phrase in docstring

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review, no tests)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks, LGTM

review: Approve (code review)
Revision history for this message
Leonardo Pistone (lepistone) wrote :

ok!
thanks

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'features/steps/dsl.py'
--- features/steps/dsl.py 2013-11-21 13:27:12 +0000
+++ features/steps/dsl.py 2014-02-13 11:31:21 +0000
@@ -314,3 +314,21 @@
314@step('I delete it')314@step('I delete it')
315def impl(ctx):315def impl(ctx):
316 ctx.found_item.unlink()316 ctx.found_item.unlink()
317
318@step('I set the default value for "{modelname}"."{column}" to {value}')
319def impl(ctx, modelname, column, value):
320 """
321 Example:
322 Scenario: set default values for products, the list price is only set for company2
323 Given I set the default value for "product.product"."type" to 'product'
324 And I set the default value for "product.product"."cost_method" to 'average'
325 Given I am configuring the company with ref "scen.company2"
326 And I set the default value for "product.product"."list_price" to 12.4
327 """
328 if hasattr(ctx, 'company_id'):
329 company_id = ctx.company_id
330 else:
331 company_id = False
332 ir_value_obj = model('ir.values')
333 value = eval(value)
334 ir_value_obj.set_default(modelname, column, value, company_id=company_id)

Subscribers

People subscribed via source and target branches

to all changes: