Conversation
255c306 to
094e165
Compare
41bb440 to
8e88f74
Compare
|
@maq-adhoc you may want to rebuild or fix this PR as it has failed CI. |
|
I'm sorry, @maq-adhoc: you are not allowed to override this status. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for "massive COT" (Código de Operación de Transporte) processing in the Argentinian stock localization module, enabling users to process COT operations for multiple stock pickings simultaneously through batch processing.
Key changes:
- Enhanced the ARBA COT wizard to support both individual stock pickings and batch operations
- Added new action buttons for batch COT processing in the UI
- Modified the COT presentation method to handle multiple records instead of single records
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| l10n_ar_stock/wizards/arba_cot_wizard.py | Enhanced wizard to support batch processing and handle multiple picking contexts |
| l10n_ar_stock/views/stock_picking_views.xml | Added new UI actions for batch COT processing on stock pickings and picking batches |
| l10n_ar_stock/models/stock_picking.py | Modified COT presentation method to iterate over multiple records instead of single record processing |
| <record id="action_arba_cot_wizard_batch" model="ir.actions.act_window"> | ||
| <field name="name">Obtener COT para múltiples remitos</field> | ||
| <field name="res_model">arba.cot.wizard</field> | ||
| <field name="view_mode">form</field> | ||
| <field name="target">new</field> | ||
| <field name="context">{'active_ids': active_ids, 'active_model': 'stock.picking'}</field> | ||
| </record> | ||
|
|
||
| <record id="stock_picking_action_arba_cot_wizard_batch" model="ir.actions.act_window"> | ||
| <field name="name">Obtener COT para múltiples remitos</field> | ||
| <field name="res_model">arba.cot.wizard</field> | ||
| <field name="view_mode">form</field> | ||
| <field name="target">new</field> | ||
| <field name="context">{'active_ids': active_ids, 'active_model': 'stock.picking'}</field> | ||
| <field name="binding_model_id" ref="stock.model_stock_picking"/> | ||
| <field name="binding_view_types">list</field> | ||
| </record> | ||
|
|
There was a problem hiding this comment.
This action record appears to be a duplicate of the previous one (action_arba_cot_wizard_batch) with only minor differences. Consider consolidating these into a single action or renaming them to reflect their distinct purposes.
| <record id="action_arba_cot_wizard_batch" model="ir.actions.act_window"> | |
| <field name="name">Obtener COT para múltiples remitos</field> | |
| <field name="res_model">arba.cot.wizard</field> | |
| <field name="view_mode">form</field> | |
| <field name="target">new</field> | |
| <field name="context">{'active_ids': active_ids, 'active_model': 'stock.picking'}</field> | |
| </record> | |
| <record id="stock_picking_action_arba_cot_wizard_batch" model="ir.actions.act_window"> | |
| <field name="name">Obtener COT para múltiples remitos</field> | |
| <field name="res_model">arba.cot.wizard</field> | |
| <field name="view_mode">form</field> | |
| <field name="target">new</field> | |
| <field name="context">{'active_ids': active_ids, 'active_model': 'stock.picking'}</field> | |
| <field name="binding_model_id" ref="stock.model_stock_picking"/> | |
| <field name="binding_view_types">list</field> | |
| </record> | |
| <record id="stock_picking_action_arba_cot_wizard_batch" model="ir.actions.act_window"> | |
| <field name="name">Obtener COT para múltiples remitos</field> | |
| <field name="res_model">arba.cot.wizard</field> | |
| <field name="view_mode">form</field> | |
| <field name="target">new</field> | |
| <field name="context">{'active_ids': active_ids, 'active_model': 'stock.picking'}</field> | |
| <field name="binding_model_id" ref="stock.model_stock_picking"/> | |
| <field name="binding_view_types">list</field> | |
| </record> |
| elif ctx.get("active_model") == "stock.picking": | ||
| picking_ids = ctx.get("active_ids", []) | ||
| pickings = self.env["stock.picking"].browse(picking_ids) | ||
| else: | ||
| picking_ids = ctx.get("active_ids", []) | ||
| pickings = self.env["stock.picking"].browse(picking_ids) | ||
|
|
There was a problem hiding this comment.
The else clause duplicates the logic from the 'stock.picking' case above. This redundancy could be simplified by handling the default case more explicitly or removing the else clause entirely since the stock.picking case already handles this scenario.
| elif ctx.get("active_model") == "stock.picking": | |
| picking_ids = ctx.get("active_ids", []) | |
| pickings = self.env["stock.picking"].browse(picking_ids) | |
| else: | |
| picking_ids = ctx.get("active_ids", []) | |
| pickings = self.env["stock.picking"].browse(picking_ids) | |
| else: | |
| picking_ids = ctx.get("active_ids", []) | |
| pickings = self.env["stock.picking"].browse(picking_ids) |
| for rec in self: | ||
| COT = rec.company_id.arba_cot_connect() | ||
|
|
||
| if not carrier_partner: | ||
| raise UserError( | ||
| 'Debe vincular una "Empresa transportista" a la forma de envío' | ||
| " seleccionada o elegir otra forma de envío" | ||
| if not carrier_partner: | ||
| raise UserError( | ||
| 'Debe vincular una "Empresa transportista" a la forma de envío' | ||
| " seleccionada o elegir otra forma de envío" | ||
| ) |
There was a problem hiding this comment.
The indentation is inconsistent after the for loop. The validation logic should be properly indented to be inside the loop, or moved outside if it should apply to all records collectively.
| for rec in self: | |
| COT = rec.company_id.arba_cot_connect() | |
| if not carrier_partner: | |
| raise UserError( | |
| 'Debe vincular una "Empresa transportista" a la forma de envío' | |
| " seleccionada o elegir otra forma de envío" | |
| if not carrier_partner: | |
| raise UserError( | |
| 'Debe vincular una "Empresa transportista" a la forma de envío' | |
| " seleccionada o elegir otra forma de envío" | |
| ) | |
| if not carrier_partner: | |
| raise UserError( | |
| 'Debe vincular una "Empresa transportista" a la forma de envío' | |
| " seleccionada o elegir otra forma de envío" | |
| ) | |
| for rec in self: | |
| COT = rec.company_id.arba_cot_connect() |
0af30e0 to
62558b6
Compare
62558b6 to
d3caef9
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@roboadhoc r+ |
|
@roboadhoc check |
|
@roboadhoc r- |
|
@jcadhoc I didn't know about this PR and had to retrieve its information, you may have to re-approve it as I didn't see previous commands. |
|
Updated message. No update to pr head. |
2 similar comments
|
Updated message. No update to pr head. |
|
Updated message. No update to pr head. |
|
@roboadhoc rebase-ff r+ |
Part-of: #246 Signed-off-by: Nicolas Mac Rouillon <nmr@adhoc.inc>
|
Merge method set to rebase and fast-forward. |

No description provided.