diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-28 16:24:18 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-28 16:24:18 +0700 |
| commit | 0b4ff36510d280e4eba623a6e02c61b59d6435bc (patch) | |
| tree | c7b42356da8d02beac6867f1dfa1330410180976 | |
| parent | 203feb6018c55c108c31f4c0e03d38a8f39af52e (diff) | |
add purchase representative on stock picking per po
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 11 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index d35cd9b8..0385566e 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -70,6 +70,17 @@ class StockPicking(models.Model): ('partial', 'Kirim Parsial') ], string='Note', help='jika field ini diisi maka tidak akan dihitung ke lead time') waybill_id = fields.One2many(comodel_name='airway.bill', inverse_name='do_id', string='Airway Bill') + purchase_representative = fields.Char(compute='_compute_purchase_representative') + + def _compute_purchase_representative(self): + for record in self: + po = self.env['purchase.order'].search([ + ('name', '=', record.group_id.name) + ]) + if po: + record.purchase_representative = po[0].user_id.name + else: + record.purchase_representative = False def action_create_invoice_from_mr(self): """Create the invoice associated to the PO. diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 99f0d7c0..4ecd484b 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -6,6 +6,9 @@ <field name="model">stock.picking</field> <field name="inherit_id" ref="stock.vpicktree"/> <field name="arch" type="xml"> + <tree position="attributes"> + <attribute name="default_order">create_date desc</attribute> + </tree> <field name="json_popover" position="after"> <field name="date_done" optional="hide"/> <field name="date_doc_kirim" optional="hide"/> @@ -13,6 +16,9 @@ <field name="driver_arrival_date" optional="hide"/> <field name="note_logistic" optional="hide"/> </field> + <field name="partner_id" position="after"> + <field name="purchase_representative"/> + </field> </field> </record> |
