如何在odoo 7中调用方法?

时间:2017-10-09 10:37:25

标签: python python-2.7 openerp

我已经创建了一个方法,我正在使用字段函数来调用该方法。但是,该方法永远不会执行 这是我的代码:

def _get_data_from_puchase_order(self, cr, ids, field, arg, context=None):
    print "SUCCESS"
    print ":::::::::::::::::"
    result = {}
    for row in self.browse(cr, uid, ids):
        print row
        print "::::::::::::"

_columns = {
        "data_purchase_product" : fields.function(_get_data_from_puchase_order, method=True, string='origin', type='char', strore=False)
    }

我补充道:

for data in self.pool.get('purchase.order').browse(cr, uid, ids):
    print data.name
    print "++++++++++++++++++"

我得到了错误:

MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')

1 个答案:

答案 0 :(得分:0)

这个帮助,

ids:对象的id列表,

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(final HttpSecurity http) throws Exception {
        // @formatter:off
        http
            .csrf().disable()
            .authorizeRequests()
            .antMatchers("/login*", "/logout*").permitAll()
            .antMatchers("/user/updatePassword*", "/user/savePassword*").hasRole("ROLE_USER")
            .antMatchers("/admin/**").hasRole("ROLE_ADMIN")
            .and()
            .formLogin()
            .loginPage("/login")
            .defaultSuccessUrl("/homepage.html")
            .permitAll()
            .and()
            .logout()
            .logoutSuccessUrl("/logout.html")
            .permitAll();
        // @formatter:on
    }

}