I resolve the problem, thanks Ivan and Med Said, thanks for the help and remind.
model.py
class Facturacion(models.Model):
_name = 'openacademy.factura'
numeroFactura = fields.Char(string="No. Factura")
serieFactura = fields.Char(string="Serie")
fechaFactura = fields.Date(string="Fecha")
cantidadFactura = fields.Float('Cantidad')
sin_iva = fields.Integer(string="Sin Iva", readonly=True)
iva = fields.Integer(string="Con Iva", readonly=True)
totales = fields.Integer(string="Totales", readonly=True)
balance = fields.Integer(string="Balance", readonly=True)
#keys
empresa_ids = fields.Many2one('openacademy.empresa', 'Empresa', store=True)
producto_box = fields.One2many('openacademy.detalle', 'name', 'Order Lines')
pago_ids = fields.Many2one('openacademy.pago', 'Tipo de Pago', store=True)
partner_ids = fields.Many2one('res.partner', 'Cliente', store=True)
class DetalleFactura(models.Model):
_name = "openacademy.detalle"
name = fields.Char(string="Titulo")
producto_id = fields.Many2one('product.product', 'Producto')
precio = fields.Float(string="Precio")
my.xml
<record model="ir.ui.view" id="facturasform_list">
<field name="name">Form View</field>
<field name="model">openacademy.factura</field>
<field name="arch" type="xml">
<form string="Factura Form">
<sheet>
<group string="Factura">
<h2>No.<field name="numeroFactura" class="oe_inline"/></h2>
<h2 class="oe_right">Serie<field name="serieFactura" class="oe_inline oe_right"/></h2>
<br />
<br />
<h3 class="oe_left">Nombre de la Empresa:</h3><br />
<h3><field name="empresa_ids" class="oe_right"/></h3><h3 class="oe_left">Fecha: <field name="fechaFactura" class="oe_inline oe_right"/> </h3>
<br />
<br />
<h3 class="oe_left">Cliente<field name="partner_ids" class="oe_inline" domain="[('customer','=',True)]"/> </h3><br />
<!--<field name="sales_ids"/>-->
</group>
<group string="Opciones de Pago">
<field name="pago_ids"/>
</group>
<notebook>
<page string="Compras">
<group string="Compras">
<field name="producto_box">
<tree editable="bottom">
<field name="producto_id"/>
<field name="precio"/>
</tree>
</field>
<group class="oe_subtotal_footer">
<field name="sin_iva"/>
<field name="iva"/>
<field name="totales" class="oe_subtotal_footer_separator"/>
<field name="balance" style="margin-top: -5px"/>
</group>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
I have only been two weeks learning, thank you very much.
Image of results: https://db.tt/7zDYHOfT
If you want to post code, please do it a a more descriptive manner. If the lines you quote in my.py is sequenced exactly like that, no wonder that it would fail. Also, my.xml does not have the context of what model this view is for.
You're right (sorry for the comment in this, I need 50 karma to comment your answer) I try to obtain products in 'producto_box' but I try to do the same as module 'Sale' in 'Sale Order'. With Many2many I only obtain one product, and I need obtain more products of the same product.
@Juan Many2many allow you to have multiple entries, just like One2many. Many2one only allow you to have one entry. The reason I propose to use Many2many is that you may want to a product to multiple bills as well. If you specify it as One2many, then one product can only be linked to only one bill. @Med Said: it is true that in the official OpenERP most of the many2one fields are named with _id, but the naming for many2many and one2many are more varied: Invoice lines in account.invoice is invoice_line, sale order lines is order_line in sale.order, Physical Inventory lines is inventory_line_id in stock.inventory.
Thanks very much, I edit my answer.