|
|
@ -1,12 +1,15 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
from openerp import models, api, fields |
|
|
|
|
|
|
|
|
|
|
|
class PurchaseOrder(models.Model): |
|
|
|
_inherit = 'purchase.order' |
|
|
|
_inherit = "purchase.order" |
|
|
|
|
|
|
|
manual_date_planned = fields.Datetime(string='Scheduled Date', required=True) |
|
|
|
manual_date_planned = fields.Datetime( |
|
|
|
string="Scheduled Date", required=True |
|
|
|
) |
|
|
|
|
|
|
|
@api.onchange('order_line', 'order_line.date_planned') |
|
|
|
@api.onchange("order_line", "order_line.date_planned") |
|
|
|
def _on_change_manual_date_planned(self): |
|
|
|
""" |
|
|
|
Since we don't see the date planned on the line anymore |
|
|
@ -15,7 +18,7 @@ class PurchaseOrder(models.Model): |
|
|
|
for line in self.order_line: |
|
|
|
if line.date_planned and not self.manual_date_planned: |
|
|
|
self.manual_date_planned = line.date_planned |
|
|
|
break; |
|
|
|
break |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def button_confirm(self): |
|
|
@ -24,5 +27,7 @@ class PurchaseOrder(models.Model): |
|
|
|
hide them, we call the method to set the date planned on the line at the confirmation |
|
|
|
""" |
|
|
|
self.ensure_one() |
|
|
|
self.with_context(date_planned=self.manual_date_planned).action_set_date_planned() |
|
|
|
self.with_context( |
|
|
|
date_planned=self.manual_date_planned |
|
|
|
).action_set_date_planned() |
|
|
|
return super(PurchaseOrder, self).button_confirm() |