summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-05-06 13:55:37 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-05-06 13:55:37 +0700
commit08fb1ce211c3bc11e6ff0ea6ff37e0be8b7c2b31 (patch)
treebd2c2e21a70d69a423dde1069161ddf1b1c9e2ac
parent5b78ec72f001ad0d5ccde1269d1ec86418fb7339 (diff)
qty hold outgoing and ask cancel purchasing
-rwxr-xr-xindoteknik_custom/models/sale_order.py15
-rwxr-xr-xindoteknik_custom/views/sale_order.xml5
2 files changed, 7 insertions, 13 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 8af34c75..aa4ece13 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -281,17 +281,10 @@ class SaleOrder(models.Model):
}
def hold_unhold_qty_outgoing_so(self):
- pickings = self.env['stock.picking'].search([('sale_id', '=', self.id), ('state', 'not in', ['cancel','done']), ('name', 'ilike', 'BU/PICK/%')])
- products = self.order_line.mapped('product_id')
- for picking in pickings:
- for line in picking.move_ids_without_package:
- if line.product_id in products:
- if line.hold_outgoingg == True:
- line.hold_outgoingg = False
- self.hold_outgoing = False
- else:
- line.hold_outgoingg = True
- self.hold_outgoing = True
+ if self.hold_outgoing == True:
+ self.hold_outgoing = False
+ else:
+ self.hold_outgoing = True
def _validate_uniform_taxes(self):
for order in self:
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 40a57203..30047558 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -19,10 +19,10 @@
<button name="hold_unhold_qty_outgoing_so"
string="Hold/Unhold Outgoing"
type="object"
- attrs="{'invisible': [('state', 'not in', ['sale','done'])]}"
+ attrs="{'invisible': [('state', 'in', ['cancel'])]}"
/>
<button name="ask_retur_cancel_purchasing"
- string="Ask Retur Purchasing"
+ string="Ask Cancel Purchasing"
type="object"
attrs="{'invisible': [('state', 'in', ['cancel'])]}"
/>
@@ -394,6 +394,7 @@
<field name="payment_status" optional="hide" />
<field name="pareto_status" optional="hide" />
<field name="shipping_method_picking" optional="hide" />
+ <field name="hold_outgoing" optional="hide" />
</field>
</field>
</record>