diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-11-14 10:05:08 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-11-14 10:05:08 +0700 |
| commit | 9365e1bb72a34eb17cbb25536d9e2dbb843e7fe8 (patch) | |
| tree | 116638f4118cc3e5ed095be899f5af1206659c5f | |
| parent | 769d986194421f04b1ac06309d9a8cb64bcc6144 (diff) | |
note so line on stock picking
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 28 | ||||
| -rw-r--r-- | indoteknik_custom/models/sale_order_line.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 1 |
4 files changed, 15 insertions, 17 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 75332996..e90ca995 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -491,8 +491,8 @@ class SaleOrder(models.Model): raise UserError('Phone Real Delivery Address harus diisi') if not real_delivery_address.kecamatan_id: raise UserError('Kecamatan Real Delivery Address harus diisi') - # if not real_delivery_address.kelurahan_id: - # raise UserError('Kelurahan Real Delivery Address harus diisi') + if not real_delivery_address.kelurahan_id: + raise UserError('Kelurahan Real Delivery Address harus diisi') def generate_payment_link_midtrans_sales_order(self): # midtrans_url = 'https://app.sandbox.midtrans.com/snap/v1/transactions' # dev - sandbox @@ -626,20 +626,6 @@ class SaleOrder(models.Model): # return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)] - # def check_data_real_delivery_address(self): - # real_delivery_address = self.real_shipping_id - - # if not real_delivery_address.state_id: - # raise UserError('State Real Delivery Address harus diisi') - # if not real_delivery_address.zip: - # raise UserError('Zip code Real Delivery Address harus diisi') - # if not real_delivery_address.mobile: - # raise UserError('Mobile Real Delivery Address harus diisi') - # if not real_delivery_address.phone: - # raise UserError('Phone Real Delivery Address harus diisi') - # if not real_delivery_address.kecamatan_id: - # raise UserError('Kecamatan Real Delivery Address harus diisi') - @api.onchange('partner_id') def onchange_partner_contact(self): parent_id = self.partner_id.parent_id @@ -980,6 +966,16 @@ class SaleOrder(models.Model): # order.order_line.get_reserved_from() res = super(SaleOrder, self).action_confirm() + for order in self: + note = [] + for line in order.order_line: + if line.display_type == 'line_note': + note.append(line.name) + + if order.picking_ids: + # Sort picking_ids by date and get the most recent one + latest_picking = order.picking_ids.sorted(key=lambda p: p.scheduled_date, reverse=True)[0] + latest_picking.notee = '\n'.join(note) return res def action_cancel(self): diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 5a6640ec..f4469117 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -372,5 +372,5 @@ class SaleOrderLine(models.Model): continue if not line.product_id.product_tmpl_id.sale_ok: raise UserError('Product %s belum bisa dijual, harap hubungi finance' % line.product_id.display_name) - if not line.vendor_id or not line.purchase_price: + if not line.vendor_id or not line.purchase_price and not line.display_type == 'line_note': raise UserError(_('Isi Vendor dan Harga Beli sebelum Request Approval'))
\ No newline at end of file diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 50e9304b..ee1dd68c 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -112,6 +112,7 @@ class StockPicking(models.Model): ('done', 'Done'), ('cancel', 'Cancelled'), ], string='Status Reserve', readonly=True, tracking=True, help="The current state of the stock picking.") + notee = fields.Text(string="Note") def action_send_to_biteship(self): url = "https://api.biteship.com/v1/orders" diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index c230bc7b..1893fcaf 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -129,6 +129,7 @@ <page string="Delivery" name="delivery_order"> <group> <group> + <field name="notee"/> <field name="note_logistic"/> <field name="responsible" /> <field name="carrier_id"/> |
