Skip to Content
Menu
This question has been flagged
1806 Views

I am new to programming and odoo. I have been able to understand some of it for the most part. Right now I am having an issue of trying to get purchase orders to be automatically added to my projects task. I have a many2one field in my purchase orders to choose which project it is for and then a one2many in the task to allow me to choose the purchase order. But how would i make it look for the correct project number and then grab the purchase order and add it to the task?

class ProjectTaskOrder(models.Model):
    _name = "project.task.Order"
    _description = "Task PO Used"
    task_id = fields.Many2one(
        comodel_name='project.task', string='Task', ondelete='cascade',
        required=True)
    purchase_order_id = fields.Many2one(
        comodel_name='purchase.order', string='Product', required=True)

    date = fields.Datetime('Order Date',)
Avatar
Discard