Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6774 Lượt xem

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

Ảnh đại diện
Huỷ bỏ

Yes overrride the write method of sale.order.

Tác giả

Hi Gopakumar, how can I do this?

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

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

Tác giả

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"
Tác giả

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),
Tác giả

"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,
}
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
17
thg 12 21
24690
1
thg 12 18
19756
1
thg 7 15
7247
2
thg 3 15
5588
2
thg 3 15
8918