I have added a custom field to my purchase orders. Based on this field, I would like a specific field on new purchase order lines to automatically be populated. I would like this to work even if the purchase order hasn't been saved yet.
How can I achieve this? I've tried adding a default_get function to purchase order lines, but I have yet to find a way to access the field values of the current order.
@api.model
def default_get(self, fields_list):
I've tried a few different things:
active_po_id = self.env.context.get("active_id")
purchase_order_obj = self.env['purchase.order']
purchase_order_search = purchase_order_obj.search([('id', '=', active_po_id)], limit=1)and:
order = self.order_id
None of the things I have tried have given me any of the purchase order information. Can anyone help me figure out how to achieve this