from openerp import models, fields, api
from odooclient
import client
from datetime
import datetime, timedelta
class WizardShipLate(models.TransientModel):
_name = 'wizard.ship.late'
_description = 'Ship
Late Wizard'
reason_id = fields.Many2one('ineco.ship.late.reason', string='Reason', required=True)
name = fields.Char(string='Description', required=True)
date_expected = fields.Date(string='New Delivery Date', required=True)
date_expected_old = fields.Date(string='Old Delivery Date')
@api.multi
def update_data(self):
active_ids = self._context.get('active_ids', [])
order = self.env['sale.order'].search([('id', '=', active_ids[0])])
new_data = {
'name': self.name,
'reason_id': self.reason_id.id,
'date_expected': self.date_expected,
'date_expected_old': order.requested_date,
'sale_order_id':
active_ids[0]
}
self.env['ineco.ship.late'].create(new_data)
order.write({'requested_date': self.date_expected+' 00:00:00'})
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
1
ตอบกลับ
2860
มุมมอง
Hello,
I'm not sure of what you wanna really want, but if you want to call this function you need to create a button in the xml related to this python code like this :
<button string="Update Data" type="object" name="update_data" />
Make sure that you put the name of the function in the attribute "name".
I hope this can help you.
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
2
ธ.ค. 24
|
1961 | ||
|
1
พ.ย. 22
|
3310 | ||
|
2
ก.พ. 22
|
5415 | ||
|
1
ก.พ. 22
|
3808 | ||
|
1
ก.พ. 22
|
6664 |
Do you want to call in xmlrpx / jsonrpc API ?