Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
6791 Представления

Hello I created a custom module with their columns in database. I would like to execute a custom function, in my module, when I create a new sale.order. For example, when you save a new sale.order, it has to execute my function that it will save some information of this sale in my table. Is it possible?

Thanks

Аватар
Отменить

Yes overrride the write method of sale.order.

Автор

Hi Gopakumar, how can I do this?

Лучший ответ

you can see this link : https://accounts.openerp.com/forum/Help-1/question/38847

Аватар
Отменить
Автор

I got an error and I don't know why. I have this code:

Автор

class moodle_alumno(osv.osv): _name = "moodle.alumno" _inherit = "sale.order"

def create(self, cr, uid, vals, context=None):
    vals['IdAlumno'] = 8
    vals['Nombre'] = "Hola"
    vals['Apellido1'] = "Hola"
    vals['Apellido2'] = "Hola"
    vals['Email'] = "Hola"
    vals['DNI'] = "Hola"
    vals['FechaNac'] = "Hola"
    vals['Telefono1'] = "Hola"
    vals['Telefono2'] = "Hola"
    vals['Ciudad'] = "Hola"
    vals['Pais'] = "Hola"
    vals['Usuario'] = "Hola"
    vals['Password'] = "Hola"
Автор

id_alumno = super(moodle_alumno, self).create(cr, uid, vals, context=context) return id_alumno

_columns = {
        "IdAlumno": fields.many2one("res.partner","Id Alumno"),
        "Nombre": fields.char("Nombre", required=True),
        "Apellido1": fields.char("Primer apellido", required=True),
        "Apellido2": fields.char("Segundo apellido", required=True),
        "Email": fields.char("Email", required=True),
        "DNI": fields.char("DNI", required=True),
        "FechaNac": fields.date("Fecha nacimiento", required=True),
Автор

"Telefono1": fields.char("Teléfono 1", required=True), "Telefono2": fields.char("Teléfono 2", required=True), "Ciudad": fields.char("Ciudad", required=True), "Pais": fields.char("Pais", required=True), "Usuario": fields.char("Usuario Moodle", required=True), "Password": fields.char("Contraseña Moodle", required=True), "active": fields.boolean('Active'), }

_defaults = {
    "active" : True,
}
Автор

(sorry for putting this in some comments) I got this error: AttributeError: 'Field pricelist_id not found in browse_record(moodle.alumno, 92)'

Related Posts Ответы Просмотры Активность
17
дек. 21
24701
1
дек. 18
19759
1
июл. 15
7249
2
мар. 15
5591
2
мар. 15
8924