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

Help, please. This is my code.

my.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')
    #keys
    empresa_ids = fields.Many2one('openacademy.empresa', 'Empresa')
    producto_box = fields.One2many('openacademy.detalle', 'name')
    pago_ids = fields.Many2one('openacademy.pago', 'Tipo de Pago')
    partner_ids = fields.Many2one('res.partner', 'Cliente')
    totales = fields.Float(string="Totales", readonly=True)

class DetalleFactura(models.Model):
    _name = "openacademy.detalle"

    @api.onchange('producto_id')
    def _onchange_producto_id(self):
        if self.producto_id:
            self.precio = 100.00

    name = fields.Char(string="Titulo")
    producto_id = fields.Many2one('product.product', 'Producto')
    precio = fields.Float(string="Precio")

my.xml

<notebook>
                            <page string="Compras">
                                    <group string="Compras">
                                        <field name="producto_box" nolabel="1">
                                            <tree editable="bottom">
                                                <field name="producto_id"/>
                                                <field name="precio" />
                                            </tree>
                                        </field>
                                    </group >
                                    <br />
                                    <group>
                                        <group class="oe_subtotal_footer">
                                            <field name="totales" class="oe_subtotal_footer_separator"/>
                                        </group>
                                    </group>
                            </page>
                        </notebook>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Refer Invoice object or Sale Order object etc, to achieve your requirement

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
4924
0
thg 4 24
1066
2
thg 4 24
1070
3
thg 10 19
4921
2
thg 12 22
21702