| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
from odoo import fields, models |
| 5 |
|
| 6 |
|
| 7 |
class SaleOrder(models.Model): |
| 8 |
_inherit = 'sale.order' |
| 9 |
|
| 10 |
opportunity_id = fields.Many2one( |
| 11 |
'crm.lead', string='Opportunity', check_company=True, index='btree_not_null', |
| 12 |
domain="[('type', '=', 'opportunity'), '|', ('company_id', '=', False), ('company_id', '=', company_id)]") |
| 13 |
|
| 14 |
def action_confirm(self): |
| 15 |
res = super(SaleOrder, self.with_context({k: v for k, v in self.env.context.items() if k != 'default_tag_ids'})).action_confirm() |
| 16 |
for order in self: |
| 17 |
order.opportunity_id._update_revenues_from_so(order) |
| 18 |
return res |