addons-cm/purchase_collective/models/sale_order.py

22 lines
650 B
Python

import random
from odoo import models, api, fields
from odoo.exceptions import ValidationError, Warning
class SaleOrder(models.Model):
_inherit = "sale.order"
cp_order_id = fields.Many2one(
'purchase_collective.order',
string='Parent Collective Purchase',
help='The collective purchase wich this order belongs',
ondelete='restrict'
)
is_cp = fields.Boolean(string="Is part of a Collective Purchase")
def action_confirm(self):
for order in self:
order.warehouse_id = order.partner_id.node_id.wh_id
return super(SaleOrder, self).action_confirm()