Python Odoo 8-未为';触发on#u record_write();州';选股场
因此,我使用连接器根据Odoo中的stock.picking记录的状态向Magento发送状态 以下是我用于此目的的函数(开头):Python Odoo 8-未为';触发on#u record_write();州';选股场,python,openerp,odoo-8,connector,Python,Openerp,Odoo 8,Connector,因此,我使用连接器根据Odoo中的stock.picking记录的状态向Magento发送状态 以下是我用于此目的的函数(开头): @on_record_write(model_names = 'stock.picking') def change_status_sale_order_sp(session, model_name, record_id, vals): if session.context.get('connect
@on_record_write(model_names = 'stock.picking')
def change_status_sale_order_sp(session, model_name,
record_id, vals):
if session.context.get('connector_no_export'):
return
record = session.env['stock.picking'].browse(record_id)
if "IN" in record.name: #the stock pickings might be to receive products from the supplier, but we want the one for the deliveries to customers
return
origin = record.origin #String containing the sale order ID + the warehouse from where the order is shipped
so_name = origin.split(':')[0]
warehouse = origin.split(':')[1]
status = record.state
_logger.debug("STOCK PICKING --- Delivery order " + str(record_id) + " was modified : " + str(vals))
我希望在stock.picking记录发生更改时调用该函数,因此需要编写记录上的decorator
我的问题是:对stock.picking记录的每个写入操作(每次手动或在服务器端修改字段时)都会调用该函数,但状态字段除外。我从未将'vals'参数设置为{'state':whateverthestatus}。为什么,我错过了什么 on_record_write()每次调用时都会调用stock.picking的write方法
但状态字段是fields.function字段,它将根据股票走势进行设置,所以您不会在写入的VAL中获取状态字段