[FIX] contract: Fix invoice creation and salesperson assignment

In v13, the `user_id` field is a related field to `invoice_user_id`, that defaults to the environment user (`self.env.user`).
Therefore, if we try to create an invoice just by passing `user_id`, it would be overwritten by the default computation of `invoice_user_id`.
This fixes it by passing the correct field and data.

TT31715
This commit is contained in:
João Marques
2021-09-10 12:06:47 +01:00
parent bc401793ca
commit 02df26cd6e
2 changed files with 13 additions and 1 deletions

View File

@@ -411,7 +411,7 @@ class ContractContract(models.Model):
"invoice_date": date_invoice,
"journal_id": journal.id,
"invoice_origin": self.name,
"user_id": self.user_id.id,
"invoice_user_id": self.user_id.id,
}
)
return invoice_vals, move_form