Skip to content

[ADD]l10n_ar_stock: massive COT#246

Closed
jcadhoc wants to merge 2 commits intoingadhoc:18.0from
adhoc-dev:18.0-t-49579-jc
Closed

[ADD]l10n_ar_stock: massive COT#246
jcadhoc wants to merge 2 commits intoingadhoc:18.0from
adhoc-dev:18.0-t-49579-jc

Conversation

@jcadhoc
Copy link
Copy Markdown
Contributor

@jcadhoc jcadhoc commented Jun 27, 2025

No description provided.

@roboadhoc
Copy link
Copy Markdown
Contributor

@jcadhoc jcadhoc force-pushed the 18.0-t-49579-jc branch 3 times, most recently from 255c306 to 094e165 Compare June 27, 2025 16:52
@jcadhoc jcadhoc force-pushed the 18.0-t-49579-jc branch 3 times, most recently from 41bb440 to 8e88f74 Compare August 1, 2025 16:37
@roboadhoc
Copy link
Copy Markdown
Contributor

@maq-adhoc you may want to rebuild or fix this PR as it has failed CI.

@roboadhoc
Copy link
Copy Markdown
Contributor

I'm sorry, @maq-adhoc: you are not allowed to override this status.

@jcadhoc jcadhoc requested a review from Copilot August 5, 2025 13:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Comment on lines +28 to +45
<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>

Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
<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>

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +85
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)

Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
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)

Copilot uses AI. Check for mistakes.
Comment on lines +356 to +363
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"
)
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
Comment thread l10n_ar_stock/models/stock_picking.py Outdated
@jcadhoc jcadhoc force-pushed the 18.0-t-49579-jc branch 2 times, most recently from 0af30e0 to 62558b6 Compare August 15, 2025 16:59
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@maq-adhoc
Copy link
Copy Markdown
Contributor

@roboadhoc r+

@maq-adhoc
Copy link
Copy Markdown
Contributor

@roboadhoc check

2 similar comments
@nicomacr
Copy link
Copy Markdown
Contributor

@roboadhoc check

@nicomacr
Copy link
Copy Markdown
Contributor

@roboadhoc check

@nicomacr
Copy link
Copy Markdown
Contributor

@roboadhoc r-

@ingadhoc ingadhoc deleted a comment from maq-adhoc Aug 19, 2025
@roboadhoc
Copy link
Copy Markdown
Contributor

Pull request status dashboard

@roboadhoc
Copy link
Copy Markdown
Contributor

@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.

@roboadhoc
Copy link
Copy Markdown
Contributor

Updated message. No update to pr head.

2 similar comments
@roboadhoc
Copy link
Copy Markdown
Contributor

Updated message. No update to pr head.

@roboadhoc
Copy link
Copy Markdown
Contributor

Updated message. No update to pr head.

@nicomacr
Copy link
Copy Markdown
Contributor

@roboadhoc rebase-ff r+

roboadhoc pushed a commit that referenced this pull request Aug 19, 2025
Part-of: #246
Signed-off-by: Nicolas Mac Rouillon <nmr@adhoc.inc>
@roboadhoc
Copy link
Copy Markdown
Contributor

Merge method set to rebase and fast-forward.

@roboadhoc roboadhoc closed this in 8988a29 Aug 19, 2025
@roboadhoc roboadhoc added the 17.1 label Aug 19, 2025
@fw-bot-adhoc fw-bot-adhoc deleted the 18.0-t-49579-jc branch August 26, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants