-
-
Notifications
You must be signed in to change notification settings - Fork 660
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
[9.0] stock_picking_invoice_link: redo migration from 8.0 to 9.0 #296
[9.0] stock_picking_invoice_link: redo migration from 8.0 to 9.0 #296
Conversation
This module fix the previous port here: #261 |
Can you recheck Travis status? |
@elicoidal I'm trying to get the test working which proves that the module does what is expected. That's why I kept the PR in WIP for now. I'll remove the WIP status and notify when it's working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some details on README and an important question on the SQL usage
@@ -44,6 +42,7 @@ Contributors | |||
* Unai Alkorta | |||
* Iñaki Zabala | |||
* Oihane Crucelaegui <[email protected]> | |||
* Jacques-Etienne Baudoux <[email protected]> | |||
|
|||
Maintainer | |||
---------- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update below to the newest README template
string='Related Pickings', readonly=True, | ||
copy=False, | ||
help="Related pickings " | ||
"(only when the invoice has been generated from the picking).") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/picking/pickings
comodel_name='stock.move', inverse_name='invoice_line_id', | ||
string='Related Stock Moves', readonly=True, | ||
help="Related stock moves " | ||
"(only when the invoice has been generated from the picking).") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/picking/pickings
@api.multi | ||
def _prepare_invoice_line(self, qty): | ||
vals = super(SaleOrderLine, self)._prepare_invoice_line(qty) | ||
# move_ids = self.procurement_ids.mapped('move_ids').filtered( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove dead code
# x.location_dest_id.usage == 'customer').ids | ||
|
||
# For performance reason, we compute the list of move in SQL | ||
self._cr.execute(""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I raise a strong warning here against this SQL statement!
This is bypassing all ACL (customer, multi-company etc.)
@pedrobaeza
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm sure this is not really needed to be in SQL. In previous version it doesn't.
Thanks for you comments. I'm not sure of the best approach to keep performance if you generate invoices end of month for thousands of sales orders. |
Well, the approach is always to make it work first, and then see performance bottlenecks to try to improve. |
@elicoidal @pedrobaeza Module is now working properly. I removed WIP status. |
some small details left on the README file. Other than that LGTM |
@elicoidal Can you explain what should be improved in the README file, I can see anything missing or wrong? |
one URL AFAICS. |
If I understand this right, this will break actual behavior and will only works for newly created pickings. A nice to have would be a post install script that could be used also in a upgrade script for actual v9 module that, at least, build a link for all invoices (actual v9 behavior). |
comodel_name='stock.picking', string='Related Pickings', readonly=True, | ||
copy=False, | ||
help="Related pickings " | ||
"(only when the invoice has been generated from the picking).") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinks this sould be "help="Related pickings " (only when the invoice has been generated from a sale order)".
readonly=True, | ||
copy=False, | ||
help="Related stock moves " | ||
"(only when the invoice has been generated from the picking).") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thinks this sould be "help="Related pickings " (only when the invoice has been generated from a sale order)".
groups="account.group_account_invoice" | ||
attrs="{'invisible':[('invoice_ids', '=', False)]}" | ||
widget="many2many_tags" | ||
context="{'tree_view_ref': 'account.invoice_tree', 'form_view_ref': 'invoice_form'}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As explain in this pr https://github.com/OCA/stock-logistics-workflow/pull/319/files , full reference is required so customer invoice form is correctly displayed. Use "stock_picking_invoice_link.invoice_form" instead of "invoice_form".
…ration did not keep the business functionnality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial deivery
50ec010
to
44f7bcf
Compare
Hello @jbaudoux I can't reproduce the problem:
Tab 'pickings' of the invoice contains only 1 picking
Tab 'pickings' of the invoice contains only 1 picking
Both invoices, in 'pickings' tab, contain only 1 picking |
@jbaudoux I looked at the tests and reproduced manually:
'pickings' tab of the invoice has 2 pickings, while it should only contain the 'done' one. I'm going to review the changes now. Thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@jjscarafia Fields I suspect they can't be correctly computed, as the information is lost at the moment of invoice creation (see methods We could write it in README, explaining how to retrieve the old (in some cases wrong) values, using the old version of the fields:
What do you think? |
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
…#296) Previous migration did not keep the business functionality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial delivery
Previous migration did not keep the business functionnality of the previous module. Link from invoice to picking must link only related delivery and not all deliveries in case of partial deivery.
The previous port of this module changed the purpose of the module that is to link invoice (and lines) to the related picking (moves) to allows to find out exactly what move is invoiced. This was broken as each invoice was linked to all deliveries of all related sales orders.
I reverted the code to the original functionality in v8.0 and performed again the migration to the v9.0.
From version 9.0, you invoice always from the sale order based on quantites to invoice. With this module, you can know exactly what delivery is in the invoice.