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

purchase_delivery_address #46

Merged
merged 7 commits into from
Nov 9, 2014
Merged

Conversation

lepistone
Copy link
Member

This module adds a delivery address to the purchase order, which is
automatically propagated to the generated picking.

Moreover, when a sale order generates a purchase in drop shipping mode, the
generated purchase has the delivery address set.

The idea is that this way dropshipping pickings have a trace of the desired
delivery address. The partner_id field of the picking is already used for the
supplier.

@yvaucher
Copy link
Member

yvaucher commented Nov 3, 2014

User res_users_giulia in tests needs some group assignation -> Purchases/Manager

2014-11-03 07:41:54,453 23678 INFO openerp_test openerp.modules.loading: loading purchase_delivery_address/test/test_propagate_address.yml

2014-11-03 07:41:55,562 23678 WARNING openerp_test openerp.addons.base.ir.ir_model: Access Denied by ACLs for operation: read, uid: 7, model: framework.agreement

@lepistone
Copy link
Member Author

@yvaucher she has not the right to read the framework agreement in the tests of purchase_delivery_address.

Being an interaction between the two, I split the modules in the travis config.

@yvaucher
Copy link
Member

yvaucher commented Nov 3, 2014

@lepistone green 👍

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling d8edd99 on lepistone:purchase_delivery_address into 0bb1c4a on OCA:8.0.

@rdeheele
Copy link

rdeheele commented Nov 3, 2014

as discussed, it seems that a "dest_address_id" field exists in purchase core.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.32%) when pulling 764dec0 on lepistone:purchase_delivery_address into 9de1586 on OCA:8.0.

@lepistone
Copy link
Member Author

We solved the conflict and the test, but I have to check @rdeheele's remark. He is probably right.

@lepistone
Copy link
Member Author

The field mentioned by @rdeheele exists but is hidden, see odoo/odoo/issues/2950. I adapted this module to use it, and extend/fix the existing functionality to get the same result as before. I updated the readme and the tests to reflect that.

Thanks!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) when pulling d7fc777 on lepistone:purchase_delivery_address into 9de1586 on OCA:8.0.

@lepistone
Copy link
Member Author

No, the partner address is already in the core, in a field called partner_id that is in the move (not in the picking). In the picking, partner_id is (clearly) the supplier. And no, the destination address is not visible in the picking view (it is visible in the move view).

I'm marking this one as WIP, and will see tomorrow that do to here. Thanks @rdeheele for the heads up.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) when pulling d7fc777 on lepistone:purchase_delivery_address into 9de1586 on OCA:8.0.

See the updated README for more infomation about the new logic. The idea
is to have in the picking information about both the supplier and the
customer address.
The test test_propagate_supplier_and_chosen_address_to_picking show also
clarify what is going on.
@lepistone
Copy link
Member Author

I uploaded version 47.8 of the pull request, with an update of the readme and tests. Thanks for the review!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) when pulling 941af33 on lepistone:purchase_delivery_address into 9de1586 on OCA:8.0.

@rdeheele
Copy link

rdeheele commented Nov 4, 2014

according to the readme explanation, it's 👍

new_picktype = self.env['stock.picking.type'].search([
('default_location_src_id.usage', '=', 'supplier'),
('default_location_dest_id.usage', '=', 'customer'),
], limit=1)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if for this one we shouldn't have stock_dropshipping in dependancies and search it by xml id as I did here:

https://github.com/OCA/purchase-workflow/pull/47/files#r19790441

In anyway we must be consistent between both modules.

Copy link
Member

Choose a reason for hiding this comment

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

A second opinion would be nice. To know in which PR we should change this part.

Copy link
Member

Choose a reason for hiding this comment

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

I have no real preference here. I may add that searching by xml id does not necessarily mean adding a dependency on sale_dropshipping (as long as the exception is handled correctly)

Copy link
Member

Choose a reason for hiding this comment

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

OTOH, since it is possible to get a dropshipping config without installing the sale_dropshipping module, this version is probably nicer.

Copy link
Member

Choose a reason for hiding this comment

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

and then again... there are a number of cases in the official addons where such things are handled with an xmlid lookup + a search as a backup in case the xmlid was not found.

Copy link
Member

Choose a reason for hiding this comment

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

If we don't use xmlid, thus stock_dropshipping poor little module will be sad as considered useless.

EDIT: adding poor and little before module 😿

Copy link
Member

Choose a reason for hiding this comment

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

I agree that we can't hardcode picking type. We should find it with this technique.

Copy link
Member

Choose a reason for hiding this comment

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

@pedrobaeza picking type dropshipping is a data created by an official module. And as said @gurneyalex on his last comment, for location in official addons customer and supplier locations are taken with xml id.

Copy link
Member

Choose a reason for hiding this comment

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

You can have multiple cases that doesn't apply the search by XML-ID:

  • You are in a multi-company environment and you define manually dropshipping picking type for that company.
  • You duplicate dropshipping picking type and remove the first one without updating module.
  • ...

So I think this must be this way, but adding company_id parameter.

Copy link
Member

Choose a reason for hiding this comment

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

@pedrobaeza

  • dropshipping picking type is not related to a company.
  • I agree there should be a mechanism to warn the user he is deleting a useful data.
  • ... <-- I didn't thought of this one 😁

@lepistone
Copy link
Member Author

I changed the domain as suggested by @pedrobaeza.

As for the visibility of the field, I think for the interface we have now we should always show it. The whole point of having the onchange is that the user can fill in the delivery address, and the system will find an appropriate picking type and destination for you.

Thanks!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) when pulling 4d1a782 on lepistone:purchase_delivery_address into 9de1586 on OCA:8.0.

@yvaucher
Copy link
Member

yvaucher commented Nov 7, 2014

To be clear, I argue with XML id lookup but as it will work this is still a 👍 for me

gurneyalex added a commit that referenced this pull request Nov 9, 2014
@gurneyalex gurneyalex merged commit 9af84c6 into OCA:8.0 Nov 9, 2014
@yvaucher yvaucher deleted the purchase_delivery_address branch November 9, 2014 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants