Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set picking type on PO generated from sourcing with FA #86

Merged
merged 3 commits into from
Dec 11, 2014

Conversation

yvaucher
Copy link
Member

@yvaucher yvaucher commented Dec 1, 2014

This bridge with onchanges on purchase_delivery_address
and make it consistant with purchase_requisition_delivery_address

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) when pulling 4c7a964 on yvaucher:8.0-fix-fa-po-picking-type into 06c60b1 on OCA:8.0.

@gurneyalex
Copy link
Member

please add a couple of automated tests

This bridge with onchanges on purchase_delivery_address
and make it consistant with purchase_requisition_delivery_address
@coveralls
Copy link

Coverage Status

Coverage increased (+0.16%) when pulling f4262c8 on yvaucher:8.0-fix-fa-po-picking-type into f157daa on OCA:8.0.

@yvaucher
Copy link
Member Author

yvaucher commented Dec 2, 2014

@gurneyalex Tests added

@@ -52,9 +52,80 @@ def setUp(self):
self.other_source = next(x for x in self.source_lines
if x.procurement_method == 'other')

def test_01_transform_source_to_agreement(self):
def test_01_transform_source_to_agreement_wh_dest(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think good practices advices to have small tests with one scenrio/case by test method

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@foutoucour can you please elaborate more?

IMO we can have both

  • "real" isolated unit tests (setup - run one method - assert on the result)
  • integration/story-like tests

In the core there are only integration ones, but that doesn't mean we shouldn't write isolated ones. I personally am for isolation wherever possible, but I'd rather avoid that big debate between isolation and integration and accept both styles.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is parts we can reuse we should at lest split the block. It will ease redability

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nbessi indeed nesting helper methods helps to DRY, but sometimes I personally find it hard to follow and somewhat verbose (less repetition but more boilerplate).

Instead often I prefer to have shorter, more expressive test by splitting them in functionally significant parts (small realistic scenarios instead of pages-long stories), and avoiding data irrelevant to the test (sometimes with help from Model.new() and mocks). A bit of functionally relevant repetition in an expressive, short test is fine by me.

This is 100% subjective preference, of course: we all just want to make our tests readable and maintainable.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant if it is a unittest I prefer to have one test by assert. The tests might be long at the end of the day but it is really helpful during debug I found.

I didn't realised that was not the case here and I understand why the test has so many asserts.

@lepistone
Copy link
Member

There are two tests numbered 01. Each one is run in its own transaction, so I don't think we need to number them at all.

Otherwise 👍 thanks!

@lepistone
Copy link
Member

@foutoucour do you think we can merge this one? If not, what do you suggest? Thanks!

@gurneyalex
Copy link
Member

👍

# if destination is not for a warehouse address,
# we set dropshipping picking type
ref = 'stock_dropshipping.picking_type_dropship'
picking_type_id = self.env['ir.model.data'].xmlid_to_res_id(ref)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to use env.ref and return a record directly?

@foutoucour
Copy link

👍

yvaucher added a commit that referenced this pull request Dec 11, 2014
Set picking type on PO generated from sourcing with FA
@yvaucher yvaucher merged commit 1c9732a into OCA:8.0 Dec 11, 2014
@yvaucher yvaucher deleted the 8.0-fix-fa-po-picking-type branch December 11, 2014 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants