Note that there are some explanatory texts on larger screens.

plurals
  1. PORelating Custom module field - Products - OpenErp
    primarykey
    data
    text
    <p>I need to relate a field from a custom module to a button to be placed in the <code>Purchase Order</code> form of OpenErp.</p> <p>When a product picking is confirmed this button will "discharge" the quantity of this product filled in the "quantity" field of my custom module.</p> <p>For example:</p> <pre><code>class certificados_line(osv.osv): _name = 'certificados.line' _description = "Items del Certificado" def multi_a_b(self, cr, uid, ids, name, arg, context=None): res = {} for record in self.browse(cr, uid, ids,context): res[record.id] = record.Cantidad * record.Precio_Unitario_Declarado return res _columns = { 'codigo_n' : fields.related( 'product_id', 'codigo_n', type='char', size=64, string='Codigo Arancelario', store=True, readonly=True, ), 'product_id' : fields.many2one( 'product.product', 'Material', ), 'Descripcion_Arancelaria' : fields.many2one( 'product.category', 'Descripcion Arancelaria', change_default=True, domain="[('type','=','normal')]", ), 'tec_esp': fields.related( 'product_id', 'tec_esp', type='char', size=64, string='Especificaciones tecnicas', store=True, readonly=True, ), 'Cantidad' : fields.float( 'Cantidad', ), 'Unidad_de_Medida': fields.many2one( 'product.uom', 'Unidad de Medida', ), 'Precio_Unitario_Declarado' : fields.float( 'Precio Unitario Declarado', ), 'Moneda' : fields.many2one( 'res.currency', 'Moneda', ), 'Valor_En_Divisas' : fields.function( multi_a_b, type='integer', string='Valor En Divisas', ), 'requisicion_id' : fields.many2one( 'certificados.certificados', 'Certificados de No Produccion', ondelete='cascade', ), 'Cantidad_Consumida' : fields.related( 'product_id', 'outgoing_qty', type='float', string='Cantidad Consumida', store=True, readonly=True, ), 'Cantidad_Disponible' : fields.related( 'product_id', 'qty_available', type='float', string='Cantidad Disponible', store=True, readonly=True, ), } certificados_line() </code></pre> <p>Here, <code>Cantidad</code> should be the field to be automatically related to the purchase order, I mean, in the "Request for Quotation" and "Purchase Order" in OpenErp, when the picking is confirmed the <code>Product</code> stock in the warehouse gets automatically updated, "<code>product_qty</code>".</p> <p>I need to do the same but not with the stock or warehouse in OpenErp but just to this <code>Cantidad</code> field in my custom module, because some items could be bought and are managed from the warehouse and others from this module.</p> <p>I've seen the buttons in the <code>Purchase Order</code> form, I could create a new one for this task, but my problem is, how to relate this field to the <code>Purchase Order</code>in my custom module, while keeping the conventional relationship with stock?</p> <p>For further understanding, it will not be an automatic update, just an independent update, depending on when this button is clicked or not.</p> <p>I hope I've explained myself.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload