-
Notifications
You must be signed in to change notification settings - Fork 20
Dev 19 feat ti #9422 migration stock configurations #375
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
Open
JacoBinaural
wants to merge
8
commits into
dev-19
Choose a base branch
from
dev-19_FEAT_ti_#9422_migration_stock_configurations
base: dev-19
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a551b56
FEAT #9422: l10n_ve_stock
9347536
fixing traducciones y formateando string
d6ab268
FEAT #9422: l10n_ve_stock
465b5e1
traducciones
e1e8873
fixing and manifest
394e885
FEAT #1063: 1l0n_ve_stock
a0fb49e
FEAT #59671: l10n_ve_stock
eda5b5d
FEAT #9422: l10n_ve_stock
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,4 +11,5 @@ | |
| stock_picking_type, | ||
| stock_quant, | ||
| stock_warehouse, | ||
| stock_scrap | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,11 +1,10 @@ | ||||||
| import logging | ||||||
|
|
||||||
| from odoo import _, api, fields, models | ||||||
| from odoo.exceptions import UserError | ||||||
| from odoo.exceptions import UserError, ValidationError | ||||||
| from odoo.fields import Domain | ||||||
| _logger = logging.getLogger(__name__) | ||||||
|
|
||||||
| from odoo.exceptions import UserError | ||||||
|
|
||||||
|
|
||||||
| class StockPicking(models.Model): | ||||||
|
|
@@ -242,3 +241,59 @@ def action_assign(self): | |||||
| self = self.with_context(skip_physical_location=True) | ||||||
| return super().action_assign() | ||||||
|
|
||||||
| def button_validate(self): | ||||||
| if self.env.company.not_allow_negative_stock_movement: | ||||||
| res = super(StockPicking, self).button_validate() | ||||||
| if isinstance(res, dict) and res.get('res_model') == 'stock.backorder.confirmation': | ||||||
| return res | ||||||
| else: | ||||||
| self._check_stock_availability_for_pickings() | ||||||
| return super().button_validate() | ||||||
|
|
||||||
| def _check_stock_availability_for_pickings(self): | ||||||
| if self.picking_type_id.code in ['internal', 'outgoing']: | ||||||
| group_product_location_lot = {} | ||||||
|
|
||||||
| all_move_lines_to_check = self.env['stock.move.line'] | ||||||
| for picking in self: | ||||||
| all_move_lines_to_check |= picking.move_line_ids | ||||||
|
|
||||||
| for line in all_move_lines_to_check: | ||||||
| if line.product_id.type == 'consu': | ||||||
| qty_done_line = line.quantity | ||||||
| if qty_done_line <= 0: | ||||||
| continue | ||||||
|
|
||||||
| key = (line.product_id.id, line.lot_id.id if line.lot_id else False, line.location_id.id) | ||||||
|
|
||||||
| group_product_location_lot[key] = \ | ||||||
| group_product_location_lot.get(key, 0.0) + qty_done_line | ||||||
|
|
||||||
| stock_msg = [] | ||||||
|
|
||||||
| for key, total_qty_to_move in group_product_location_lot.items(): | ||||||
| product_id, lot_id, location_id = key | ||||||
|
|
||||||
| product_obj = self.env['product.product'].browse(product_id) | ||||||
| location_obj = self.env['stock.location'].browse(location_id) | ||||||
| lot_obj = self.env['stock.lot'].browse(lot_id) if lot_id else False | ||||||
|
|
||||||
| context_to_stock = {'location': location_obj.id} | ||||||
| if lot_obj: | ||||||
| context_to_stock['lot_id'] = lot_obj.id | ||||||
|
|
||||||
| qty_real_allow = \ | ||||||
| product_obj.with_context(context_to_stock).qty_available - \ | ||||||
| total_qty_to_move | ||||||
|
|
||||||
| if qty_real_allow < 0: | ||||||
| info_lote_serial = f" ({_('Lot/Serial')}: {lot_obj.name})" if lot_obj else "" | ||||||
| stock_msg.append( | ||||||
| _("%s%s", product_obj.display_name, info_lote_serial) | ||||||
| ) | ||||||
|
|
||||||
| if stock_msg: | ||||||
| error_msg = _( | ||||||
| "Insufficient stock:\n%s\n\nAdjust quantitys or request stock for this location." | ||||||
|
||||||
| "Insufficient stock:\n%s\n\nAdjust quantitys or request stock for this location." | |
| "Insufficient stock:\n%s\n\nAdjust quantities or request stock for this location." |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Error de ortografía en el archivo de traducción: "quantitys" debería ser "quantities". Esta misma corrección debe aplicarse tanto en la cadena msgid como en la traducción msgstr correspondiente.