summaryrefslogtreecommitdiff
path: root/fixco_custom/models/shipment_group.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2026-01-02 21:12:05 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2026-01-02 21:12:05 +0700
commit622dbf1f8fd2b6306b147cf27b17be8e017fd2e8 (patch)
tree751a7e48cb12f1fabe748cba8c7bcad07da70023 /fixco_custom/models/shipment_group.py
parent96b1fcaace545021f446071bdd495ac810c0f5e7 (diff)
parent87b38e373002bdc0ed224bf71762536c0a4d1d85 (diff)
Merge branch 'main' of bitbucket.org:altafixco/fixco-addons
# Conflicts: # fixco_custom/models/stock_picking.py # fixco_custom/views/stock_picking.xml
Diffstat (limited to 'fixco_custom/models/shipment_group.py')
-rw-r--r--fixco_custom/models/shipment_group.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/fixco_custom/models/shipment_group.py b/fixco_custom/models/shipment_group.py
index 117de0b..2e2dffa 100644
--- a/fixco_custom/models/shipment_group.py
+++ b/fixco_custom/models/shipment_group.py
@@ -52,12 +52,26 @@ class ShipmentGroup(models.Model):
raise UserError(f"Pickings berikut telah dibatalkan:{cancelled_names}")
for picking_line in shipment.picking_lines:
+ if picking_line.picking_id:
+ # set shipment group ke stock.picking
+ picking_line.picking_id.write({
+ 'shipment_group_id': shipment.id
+ })
+ picking_line.picking_id.message_post(
+ body=_(
+ "📦 <b>Dispatched</b><br/>"
+ "Picking ini telah di-dispatch melalui "
+ "<b>Shipment Group %s</b>."
+ ) % shipment.number
+ )
+
shipment_lines = self.env['shipment.group.line'].search([
('shipment_id', '=', shipment.id),
('invoice_marketplace', '=', picking_line.invoice_marketplace),
('picking_id', '=', picking_line.picking_id.id)
])
+ # reset product shipment
picking_line.product_shipment_lines.unlink()
for sl in shipment_lines:
@@ -70,6 +84,35 @@ class ShipmentGroup(models.Model):
'order_reference': sl.order_reference,
})
+
+ # def sync_product_to_picking_line(self):
+ # for shipment in self:
+ # cancelled_picking = shipment.picking_lines.filtered(
+ # lambda picking: picking.status == 'CANCELLED'
+ # )
+ # if cancelled_picking:
+ # cancelled_names = "\n - " + "\n - ".join(cancelled_picking.mapped("name"))
+ # raise UserError(f"Pickings berikut telah dibatalkan:{cancelled_names}")
+
+ # for picking_line in shipment.picking_lines:
+ # shipment_lines = self.env['shipment.group.line'].search([
+ # ('shipment_id', '=', shipment.id),
+ # ('invoice_marketplace', '=', picking_line.invoice_marketplace),
+ # ('picking_id', '=', picking_line.picking_id.id)
+ # ])
+
+ # picking_line.product_shipment_lines.unlink()
+
+ # for sl in shipment_lines:
+ # self.env['product.shipment.line'].create({
+ # 'picking_line_id': picking_line.id,
+ # 'product_id': sl.product_id.id,
+ # 'carrier': sl.carrier or picking_line.carrier,
+ # 'invoice_marketplace': sl.invoice_marketplace,
+ # 'picking_id': sl.picking_id.id,
+ # 'order_reference': sl.order_reference,
+ # })
+
def _compute_related_count(self):
for record in self:
record.related_count = len(record.picking_lines)