Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
3512 Vistas

I need to access the sale.order an account.move originated from (because I want to put some custom attributes of the sale.order on the invoice report)

Is there already an attribute for this, if so, how can I access it 

and If not what do I have to do to get this connection?

Avatar
Descartar
Mejor respuesta

You can create a field in account.move and update its value from sale.order then after you can easily access its value in invoice report. i.e: 

class AccountMove(models.Model):
        _inherit = "account.move"
        delivery_date = fields.Datetime("Delivery Date")


class SaleOrder(models.Model):
        _inherit = "sale.order"
        def _prepare_invoice(self):
                invoice_vals = super(SaleOrder, self)._prepare_invoice()
                invoice_vals['delivery_date'] = self.commitment_date
                return invoice_vals


In this example: i am updating the custom field delivery_date of account.move by using _prepare_invoice() method.



Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
ago 25
103
2
jul 25
419
1
jul 25
575
2
jul 25
652
2
jun 25
813