Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
6640 Переглядів

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
24222
1
груд. 18
19481
1
лип. 15
7058
2
бер. 15
5373
2
бер. 15
8622