diff options
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 1 | ||||
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/shipment_group.py | 55 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/mail_template_efaktur.xml | 3 | ||||
| -rw-r--r-- | indoteknik_custom/views/shipment_group.xml | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 4 |
7 files changed, 54 insertions, 19 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 4a029441..32ddf1e5 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -487,7 +487,6 @@ class PurchaseOrder(models.Model): for purchasing_job in purchasing_job_state: purchasing_job.unlink() - def _send_po_not_sync(self): # Mengirim data ke model Po Sync Price jika harga po dan purchase pricelist tidak singkron for line in self.order_line: diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index ac81737d..0d28e677 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -201,6 +201,10 @@ class SaleOrder(models.Model): @api.model def action_multi_update_state(self): for sale in self: + for picking_ids in sale.picking_ids: + if not picking_ids.state == 'cancel': + raise UserError('DO harus cancel terlebih dahulu') + sale.update({ 'state': 'cancel', }) diff --git a/indoteknik_custom/models/shipment_group.py b/indoteknik_custom/models/shipment_group.py index bc593437..92f76db7 100644 --- a/indoteknik_custom/models/shipment_group.py +++ b/indoteknik_custom/models/shipment_group.py @@ -13,6 +13,7 @@ class ShipmentGroup(models.Model): number = fields.Char(string='Document No', index=True, copy=False, readonly=True, tracking=True) shipment_line = fields.One2many('shipment.group.line', 'shipment_id', string='Shipment Group Lines', auto_join=True) + partner_id = fields.Many2one('res.partner', string='Customer') @api.model def create(self, vals): @@ -29,30 +30,52 @@ class ShipmentGroupLine(models.Model): partner_id = fields.Many2one('res.partner', string='Customer') picking_id = fields.Many2one('stock.picking', string='Picking') sale_id = fields.Many2one('sale.order', string='Sale Order') - state = fields.Char(string='Status', readonly=True, compute='_get_state') + state = fields.Char(string='Status', readonly=True, compute='_compute_state') - def _get_state(self): + @api.depends('picking_id.state') + def _compute_state(self): for rec in self: - if rec.picking_id.state == 'assigned': - rec.state = 'Ready' - elif rec.picking_id.state == 'done': - rec.state = 'Done' - elif rec.picking_id.state == 'cancel': - rec.state = 'Cancelled' - elif rec.picking_id.state == 'confirmed': - rec.state = 'Waiting' - elif rec.picking_id.state == 'waiting': - rec.state = 'Waiting Another Operation' + if rec.picking_id: + if rec.picking_id.state == 'assigned': + rec.state = 'Ready' + elif rec.picking_id.state == 'done': + rec.state = 'Done' + elif rec.picking_id.state == 'cancel': + rec.state = 'Cancelled' + elif rec.picking_id.state == 'confirmed': + rec.state = 'Waiting' + elif rec.picking_id.state == 'waiting': + rec.state = 'Waiting Another Operation' + else: + rec.state = 'draft' else: rec.state = 'draft' @api.onchange('picking_id') def onchange_picking_id(self): - picking = self.env['stock.picking'].search([('id', '=', self.picking_id.id)], limit=1) + if self.picking_id: + picking = self.env['stock.picking'].browse(self.picking_id.id) + + if self.shipment_id.partner_id and self.shipment_id.partner_id != picking.partner_id: + raise UserError('Partner must be same as shipment group') + + self.partner_id = picking.partner_id - self.partner_id = picking.partner_id + if not self.shipment_id.partner_id: + self.shipment_id.partner_id = picking.partner_id - self.state = picking.state + self.sale_id = picking.sale_id + + @api.model + def create(self, vals): + record = super(ShipmentGroupLine, self).create(vals) + if record.picking_id: + record.onchange_picking_id() + return record - self.sale_id = picking.sale_id + def write(self, vals): + res = super(ShipmentGroupLine, self).write(vals) + if 'picking_id' in vals: + self.onchange_picking_id() + return res diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 62d86911..daa05c14 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -82,6 +82,8 @@ class StockPicking(models.Model): ('not_printed', 'Belum Print'), ('printed', 'Printed') ], string='Printed?', copy=False, tracking=True) + date_printed_sj = fields.Datetime(string='Status Printed Surat Jalan', copy=False, tracking=True) + date_printed_list = fields.Datetime(string='Status Printed Picking List', copy=False, tracking=True) date_unreserve = fields.Datetime(string="Date Unreserved", copy=False, tracking=True) date_availability = fields.Datetime(string="Date Availability", copy=False, tracking=True) sale_order = fields.Char(string='Matches SO', copy=False) diff --git a/indoteknik_custom/views/mail_template_efaktur.xml b/indoteknik_custom/views/mail_template_efaktur.xml index 0b646e7c..3856b591 100644 --- a/indoteknik_custom/views/mail_template_efaktur.xml +++ b/indoteknik_custom/views/mail_template_efaktur.xml @@ -6,7 +6,8 @@ <field name="model_id" ref="model_account_move" /> <field name="subject">Your Invoice ${object.name}</field> <field name="email_from">pajak@indoteknik.co.id</field> - <field name="email_cc">sales@indoteknik.com</field> + <field name="reply_to">pajak@indoteknik.co.id</field> + <field name="email_cc">sales@indoteknik.com, pajak@indoteknik.co.id</field> <field name="email_to">${object.partner_id.email|safe}</field> <field name="body_html" type="html"> <p>Dengan Hormat Bpk/Ibu ${object.partner_id.name},</p> diff --git a/indoteknik_custom/views/shipment_group.xml b/indoteknik_custom/views/shipment_group.xml index 33d08920..b66bda3c 100644 --- a/indoteknik_custom/views/shipment_group.xml +++ b/indoteknik_custom/views/shipment_group.xml @@ -6,6 +6,7 @@ <field name="arch" type="xml"> <tree default_order="create_date desc"> <field name="number"/> + <field name="partner_id"/> </tree> </field> </record> @@ -33,6 +34,9 @@ <group> <field name="number" readonly="1"/> </group> + <group> + <field name="partner_id" readonly="1"/> + </group> </group> <notebook> <page string="Line"> diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 90f662cc..4de1ac91 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -59,7 +59,6 @@ <field name="real_shipping_id"/> </field> <field name="origin" position="after"> - <field name="status_printed"/> <field name="purchase_id"/> <field name="sale_order"/> <field name="date_doc_kirim"/> @@ -75,6 +74,9 @@ </field> <field name="group_id" position="before"> <field name="date_reserved"/> + <field name="status_printed"/> + <field name="date_printed_sj"/> + <field name="date_printed_list"/> <field name="is_internal_use" string="Internal Use" type="object" |
