def reset(self, browse_record): """Cancel all changes made locally on the `browse_record`. No request to the server is executed to perform this operation. Therefore, values restored may be outdated. """ return osv.Model(self, browse_record.__osv__['name'])._reset( browse_record)
def get(self, model): """.. versionadded:: 0.5 Return a proxy of the `model` built from the server (see :class:`oerplib.service.osv.Model`). :return: an instance of :class:`oerplib.service.osv.Model` """ return osv.Model(self, model)
def refresh(self, browse_record, context=None): """Restore original values on `browse_record` with data fetched on the server. As a result, all changes made locally on the record are canceled. :raise: :class:`oerplib.error.RPCError` """ return osv.Model(self, browse_record.__osv__['name'])._refresh( browse_record, context)
def unlink_record(self, browse_record, context=None): """.. versionadded:: 0.4 Delete the record corresponding to `browse_record` from the server. >>> partner = oerp.browse('res.partner', 1) >>> oerp.unlink_record(partner) # unlink('res.partner', [1]) :return: `True` :raise: :class:`oerplib.error.RPCError` """ if not isinstance(browse_record, osv.BrowseRecord): raise ValueError("An instance of BrowseRecord is required") return osv.Model(self, browse_record.__osv__['name'])._unlink_record( browse_record, context)
def write_record(self, browse_record, context=None): """.. versionadded:: 0.4 Update the record corresponding to `browse_record` by sending its values to the server (only field values which have been changed). >>> partner = oerp.browse('res.partner', 1) >>> partner.name = "Test" >>> oerp.write_record(partner) # write('res.partner', [1], {'name': "Test"}) :return: `True` :raise: :class:`oerplib.error.RPCError` """ if not isinstance(browse_record, osv.BrowseRecord): raise ValueError("An instance of BrowseRecord is required") return osv.Model(self, browse_record.__osv__['name'])._write_record( browse_record, context)