-
Notifications
You must be signed in to change notification settings - Fork 17
[12.0][ADD] stock_picking_mail_incorrect_qty: Send an e-mail when a stock picking is incomplete #192
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
base: 12.0
Are you sure you want to change the base?
Conversation
1fa2aac to
991dcfd
Compare
|
@robinkeunen Added your suggestions. A few questions also:
Upstream def action_done(self):
# TDE FIXME: remove decorator when migration the remaining
todo_moves = self.mapped('move_lines').filtered(lambda self: self.state in ['draft', 'waiting', 'partially_available', 'assigned', 'confirmed'])
# Check if there are ops not linked to moves yet
for pick in self:
# # Link existing moves or add moves when no one is related
for ops in pick.move_line_ids.filtered(lambda x: not x.move_id):
# Search move with this product
moves = pick.move_lines.filtered(lambda x: x.product_id == ops.product_id)
moves = sorted(moves, key=lambda m: m.quantity_done < m.product_qty, reverse=True)
if moves:
ops.move_id = moves[0].id
else:
new_move = self.env['stock.move'].create({
'name': _('New Move:') + ops.product_id.display_name,
'product_id': ops.product_id.id,
'product_uom_qty': ops.qty_done,
'product_uom': ops.product_uom_id.id,
'location_id': pick.location_id.id,
'location_dest_id': pick.location_dest_id.id,
'picking_id': pick.id,
'picking_type_id': pick.picking_type_id.id,
})
ops.move_id = new_move.id
new_move = new_move._action_confirm()
todo_moves |= new_move
#'qty_done': ops.qty_done})
todo_moves._action_done()
self.write({'date_done': fields.Datetime.now()})
return TrueThe entire for-loop that handles a corner case (move.lines unlinked to moves, but linked to stock.picking) is not executed by our module. There may therefore be moves that are invisible to us. Ideally upstream would have SoC'd this and extracted the for-loop into a separate function
Thoughts? |
7d31162 to
991dcfd
Compare
|
Better late than never auto_delete is currently set to True in the template. Is this a correct default?class MailMail(models.Model):
""" Model holding RFC2822 email messages to send. This model also provides
facilities to queue and send new email messages. """
_name = 'mail.mail'
...
auto_delete = fields.Boolean(
'Auto Delete',
help="Permanently delete this email after sending it, to save space")Yes, we don't need to keep the history of these warning emails. Is there anything I need to do for translations?No, translations are managed by analysts and customers. From time to time, they ask us to bring back the terms they translated in the GUI to the VCS. There's a chance that the code may not run correctly. Summarised below…
Unfortunatly, this is the way to go because :
Odoo will not indeed patch odoo 12, and
OCB will only take fixes that were submitted to odoo/odoo but refused. This is not really a fix you're suggesting. And we don't patch OCB ourselves, we prefer to keep open branches and merge them with gitaggregate. But do put your PR comment in the comments of your |
22ba940 to
7c8fc46
Compare
c38ae3b to
c971b7d
Compare
|
@robinkeunen Would love a review on the refactor commit. (Never mind the ugly formatting; it's |
robinkeunen
left a comment
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 have questions about the copied code bit.
Also, I'd name the module stock_picking_mail_unexpected_incorrect_qty
c971b7d to
8f3f4dd
Compare
I think unexpected is superfluous here, if we generously interpret 'I received a pizza when I asked for salad' to be an incorrect delivery. |
bc4d037 to
c3b6396
Compare
|
TODO: Tidy up the commits. Remove the reverted commit entirely. Also run pre-commit again. |
1fa9b4b to
fc48c7a
Compare
Codecov Report
@@ Coverage Diff @@
## 12.0 #192 +/- ##
==========================================
- Coverage 69.98% 69.14% -0.84%
==========================================
Files 124 126 +2
Lines 1639 1679 +40
Branches 318 333 +15
==========================================
+ Hits 1147 1161 +14
- Misses 458 484 +26
Partials 34 34
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
…icking is incomplete Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
…ent bug Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
…f stock.move For some reason---on some databases---there is a discrepancy between the two when manually adding items to the picking. stock.move.line would contain the new item, but stock.move wouldn't. Using stock.move.line here seems like a decent enough work-around. Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
…nstead of stock.move" This reverts commit 5a64ef3.
Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
…kings Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca Bakker <carmen@coopiteasy.be>
ecd8291 to
fabe203
Compare
Task: https://gestion.coopiteasy.be/web#id=7745&view_type=form&model=project.task&action=479
Formerly coopiteasy/cie-custom#40