diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-29 09:37:02 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-29 09:37:02 +0700 |
| commit | 2676aa95c7c37a8a798675ca58cd2263b2dfcee3 (patch) | |
| tree | 60d2530f45da03f65892fbc923728ce6327c5c10 | |
| parent | 0b4ff36510d280e4eba623a6e02c61b59d6435bc (diff) | |
add purchase representative on stock picking
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 13 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 3 |
2 files changed, 4 insertions, 12 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 0385566e..1ffb9aef 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -70,17 +70,8 @@ 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 + purchase_representative_id = fields.Many2one('res.users', related='move_lines.purchase_line_id.order_id.user_id', + string="Purchase Representative", readonly=True) 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 4ecd484b..7aa66a6a 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -17,7 +17,7 @@ <field name="note_logistic" optional="hide"/> </field> <field name="partner_id" position="after"> - <field name="purchase_representative"/> + <field name="purchase_representative_id"/> </field> </field> </record> @@ -57,6 +57,7 @@ <field name="real_shipping_id"/> </field> <field name="origin" position="after"> + <field name="purchase_representative_id"/> <field name="date_doc_kirim"/> <field name="summary_qty_operation"/> <field name="count_line_operation"/> |
