diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-08-13 09:48:41 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-08-13 09:48:41 +0700 |
| commit | 7644260c8b660c71aa1f9232cb50acea551798c2 (patch) | |
| tree | bdbad5e360bd7d638b340c6d96d19dc8c7912d00 /indoteknik_custom/models/stock_picking.py | |
| parent | d1e55b12466b6c93cc4a3e23dab59d3ce3795d45 (diff) | |
| parent | a2d087032e5b14901f4128c81b58143bcff4286f (diff) | |
<hafid> merging odoo-backup
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index f2f5f52a..eb1c7085 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -19,10 +19,10 @@ import re _logger = logging.getLogger(__name__) _biteship_url = "https://api.biteship.com/v1" -biteship_api_key = "biteship_live.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiaW5kb3Rla25payIsInVzZXJJZCI6IjY3MTViYTJkYzVkMjdkMDAxMjRjODk2MiIsImlhdCI6MTc0MTE1NTU4M30.pbFCai9QJv8iWhgdosf8ScVmEeP3e5blrn33CHe7Hgo" +# biteship_api_key = "biteship_live.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiaW5kb3Rla25payIsInVzZXJJZCI6IjY3MTViYTJkYzVkMjdkMDAxMjRjODk2MiIsImlhdCI6MTc0MTE1NTU4M30.pbFCai9QJv8iWhgdosf8ScVmEeP3e5blrn33CHe7Hgo" -# biteship_api_key = "biteship_test.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSW5kb3Rla25payIsInVzZXJJZCI6IjY3MTViYTJkYzVkMjdkMDAxMjRjODk2MiIsImlhdCI6MTcyOTQ5ODAwMX0.L6C73couP4-cgVEfhKI2g7eMCMo3YOFSRZhS-KSuHNA" +biteship_api_key = "biteship_test.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSW5kb3Rla25payIsInVzZXJJZCI6IjY3MTViYTJkYzVkMjdkMDAxMjRjODk2MiIsImlhdCI6MTcyOTQ5ODAwMX0.L6C73couP4-cgVEfhKI2g7eMCMo3YOFSRZhS-KSuHNA" class StockPicking(models.Model): @@ -1060,16 +1060,23 @@ class StockPicking(models.Model): self.sale_id.date_doc_kirim = self.date_doc_kirim def action_assign(self): - res = super(StockPicking, self).action_assign() - for move in self: - # if not move.sale_id.hold_outgoing and move.location_id.id != 57 and move.location_dest_id.id != 60: - # TODO cant skip hold outgoing cause of not singleton method - current_time = datetime.datetime.utcnow() - move.real_shipping_id = move.sale_id.real_shipping_id - move.date_availability = current_time - # self.check_state_reserve() + if self.env.context.get('default_picking_type_id'): + pickings_to_assign = self.filtered( + lambda p: not (p.sale_id and p.sale_id.hold_outgoing) + ) + else: + pickings_to_assign = self + + res = super(StockPicking, pickings_to_assign).action_assign() + + current_time = datetime.datetime.utcnow() + for picking in pickings_to_assign: + picking.real_shipping_id = picking.sale_id.real_shipping_id + picking.date_availability = current_time + return res + def ask_approval(self): if self.env.user.is_accounting: raise UserError("Bisa langsung Validate") @@ -1707,7 +1714,9 @@ class StockPicking(models.Model): if move_line.qty_done > 0: product_shipped.append({ 'name': move_line.product_id.name, - 'qty': move_line.qty_done + 'code': move_line.product_id.default_code, + 'qty': move_line.qty_done, + 'image': self.env['ir.attachment'].api_image('product.template', 'image_128', move_line.product_id.product_tmpl_id.id), }) response = { |
