Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
3577 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
srp 25
148
1
srp 25
428
2
čvc 25
566
1
čvc 25
700
2
čvc 25
801