Questo sito utilizza cookie per le proprie funzionalità e per inviarti pubblicità e servizi in linea con le tue preferenze. Chiudendo questo banner, scorrendo questa pagina o cliccando qualunque suo elemento acconsenti all’uso dei cookie.

Accedendo al link http://www.odoo-italia.org/index.php/home/cookie-policy puoi leggere in dettaglio le modalità di trattamento dei cookie da parte dell'Associazione Odoo Italia.

Benvenuto, Ospite
Nome utente: Password: Ricordami
  • Pagina:
  • 1
  • 2
  • 3

ARGOMENTO: Aggiungere campi custom nello stock picking

Aggiungere campi custom nello stock picking 4 Anni 11 Mesi fa #16131

  • Alessius80
  • Avatar di Alessius80
  • Offline
  • Gold Boarder
  • Messaggi: 193
  • Ringraziamenti ricevuti 1
  • Karma: 0
Grazie per la risposta,

Quindi la soluzione sarebbe estendere quell'oggetto e aggiungere il campo anche lì?
L\'Amministratore ha disattivato l\'accesso in scrittura al pubblico.

Aggiungere campi custom nello stock picking 4 Anni 11 Mesi fa #16134

  • Alessius80
  • Avatar di Alessius80
  • Offline
  • Gold Boarder
  • Messaggi: 193
  • Ringraziamenti ricevuti 1
  • Karma: 0
Ciao, perdona la mia totale ignoranza :sorry:

Allora ho trovato il modulo "l10_it_sale" e dentro "/stock/picking.py" ho trovato finalmente il codice che mi interessa ma adattandolo alle mie esigenze non funziona...

Questo è la mia classe:
from openerp.osv import fields, orm

class my_stock_picking_out(orm.Model):
	
	_inherit = 'stock.picking.out'
	_columns = {
		'x_supplier_code': fields.char('Codice Fornitore'),
	}

	def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None):
		res = super(my_stock_picking_out, self).action_invoice_create(cursor, user, ids, journal_id, group, type, context)
		for picking in self.browse(cursor, user, ids, context=context):
			self.pool.get('account.invoice').write(cursor, user, res[picking.id], {
				'x_shipping_id': picking.partner_id.id,
				})
		return res

	def copy(self, cr, uid, id, default=None, context=None):
		if default is None:
			default = {}
		default.update({'ddt_number': ''})
		return super(my_stock_picking_out, self).copy(cr, uid, id, default, context=context)

class my_stock_picking_out(orm.Model):
	_inherit = 'stock.picking'
	_columns = {
		'x_supplier_code': fields.char('Codice Fornitore'),
	}

my_stock_picking_out()

mentre questo è il file .xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
	<data>
          <record id="my_stock_picking_out_supplier" model="ir.ui.view">
            <field name="name">my.stock.picking.out.supplier</field>
            <field name="model">stock.picking.out</field>
            <field name="inherit_id" ref="stock.view_picking_out_form"/>
            <field name="type">form</field>
            <field name="arch" type="xml">
                <field name="number_of_packages" position="after">
                    <field name="x_supplier_code"/>
                </field>
            </field>
         </record>
	</data>
</openerp>

Quando carico tutto sul server ecco l'errore:
OpenERP Server Error

Client Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/http.py", line 204, in dispatch
    response["result"] = method(self, **self.params)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1125, in call_kw
    return self._call_kw(req, model, method, args, kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/controllers/main.py", line 1117, in _call_kw
    return getattr(req.session.model(model), method)(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 42, in proxy
    result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 30, in proxy_method
    result = self.session.send(self.service_name, method, *args)
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 103, in send
    raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)


Server Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/usr/lib/pymodules/python2.7/openerp/addons/stock/stock.py", line 637, in create
    new_id = super(stock_picking, self).create(cr, user, vals, context)
  File "/usr/lib/pymodules/python2.7/openerp/addons/mail/mail_thread.py", line 241, in create
    thread_id = super(mail_thread, self).create(cr, uid, values, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4501, in create
    self.pool.get(object)._store_set_values(cr, user, ids, fields2, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 4654, in _store_set_values
    result = self._columns[f].get(cr, self, ids, f, SUPERUSER_ID, context=context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/fields.py", line 1142, in get
    result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
  File "/usr/lib/pymodules/python2.7/openerp/osv/fields.py", line 1208, in _fnct_read
    value = value[field] or False
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 405, in __getitem__
    field_values = self._table.read(self._cr, self._uid, ids, field_names, context=self._context, load="_classic_write")
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3623, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3675, in _read_flat
    cr.execute(query, [tuple(sub_ids)] + rule_params)
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 161, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column stock_picking.x_supplier_code does not exist
LINE 1: ...tock_picking."date_done",stock_picking."ddt_date",stock_pick...
                                                             ^

Come mai non lo trova sto campo??

Grazie ancora
L\'Amministratore ha disattivato l\'accesso in scrittura al pubblico.
  • Pagina:
  • 1
  • 2
  • 3
Tempo creazione pagina: 0.113 secondi

Odoo Italia Associazione - C.F: 94200470485 - Sede: Viale dei Cadorna, 83 - Firenze - Italy

Protected by R Antispam