Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
3207 Lượt xem

I will like to read the production order that is planned for today comparing the date and extract all the info for an autonomous line .


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I’m using a raspberry pi ( card size computer) which is connected to all sensors and actuators of the production line, so the rasp needs to read the production orders before initiating the process  reading which product comes next and quantities  

def search(self, object=None, domain=None):
    if not object or not domain:
        return -1
    fiter = [domain]
    try:
        result = self.FLECTRA_OBJECT.execute_kw(
            self.DATA
            , self.UID
            , self.PASS
            , object
            , 'search'
            , domain)
    except:
        return -2
    return result
def read(self, object=None, ids=None, fields=None):
    if not object or not ids or not fields:
        return -1
    result = self.FLECTRA_OBJECT.execute_kw(
        self.DATA
        , self.UID
        , self.PASS
        , object
        , 'read'
        , ids
        , {"fields": ["name", "id", "website"]})
    return result
def searchread(self, object=None, domain=None, fields=None):
    return self.read(object, self.search(object, domain), fields)

'''This is how I'm trying to call it
data = f.searchread('mrp.production', [], ['id', 'name', 'date_planned_start'])

Ảnh đại diện
Huỷ bỏ

Not entirely clear. In raspi you can write python script to do XML-RPC or REST call with Odoo and take the MO data. Not sure what exactly you are trying to get solved

Tác giả

i post the code on xml-roc I'm trying to use but with no luck, the connection to server is working the only thing missing is to read the last production order

Câu trả lời hay nhất

There are modules available on appstore which make Odoo REST enabled. Once Odoo is REST enabled you can use external python scripts to do search or update operations in Odoo

Ảnh đại diện
Huỷ bỏ

You can literally do anything he asks without needing third part REST apps. XML-RPC works just fine out of the box.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 9 23
2280
5
thg 5 25
33747
0
thg 12 24
1382
2
thg 9 23
2725
1
thg 3 23
2193