Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2503 มุมมอง

Hello,


How would I inherit the _get_commitment_date function? Do the parameters need to be the same or what? I've tried every variation, not sure what I am missing here. (odoo9e)


Original:

class sale_order_dates(osv.osv):
"""Add several date fields to Sale Orders, computed or user-entered"""
_inherit = 'sale.order'
 def _get_commitment_date(self, cr, uid, ids, name, arg, context=None):
"""Compute the commitment date"""
res = {}
dates_list = []
for order in self.browse(cr, uid, ids, context=context):
dates_list = []
order_datetime = datetime.strptime(order.date_order, DEFAULT_SERVER_DATETIME_FORMAT)
for line in order.order_line:
if line.state == 'cancel':
continue
dt = order_datetime + timedelta(days=line.customer_lead or 0.0)
dt_s = dt.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
dates_list.append(dt_s)
if dates_list:
res[order.id] = min(dates_list)
return res

My test function (which does not do anything):

class test_sale_order(models.Model):    
_inherit = 'sale.order'
@api.model
def _get_commitment_date(self, cr, uid, ids, name, arg, context=None):



อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
4
ก.พ. 25
2700
1
ส.ค. 24
2233
2
พ.ย. 24
3370
3
ต.ค. 23
14903
2
ก.พ. 23
2504