Change "Cost Center" and "Project" fields in sales invoice and sales invoice item table

I’ve created a doctype “Container” with fields “container_number”, " container_owner", “cost center” and “project”

In sales invoice item table I added a link field of above mentioned doctype “Container”.

Now, in custom scripts, I want to change the “Cost Center” and “Project” values, in sales invoice and sales invoice item table (all rows), same as entered in “Container” doctype.

And in sales invoice item table container should only include container only of one owner. E.g if someone selects 47 in container field in sales invoice table’s first row and 48 in second row. And owner of both containers are different then it’s entry shouldn’t be allow.

Thanks in advance guys.

Anyone figured this out?