Not sure my experience with real estate limited partnerships (LP)is applicable to your partnership (you never mentioned limited or real estate)……but for what it’s worth…….
I always got the impression that the capital account numbers in box L were not used for tax prep. In the final K1 instructions in bold is the statement “The items in section L are not reported on your tax return“. Perhaps this was true because the general partner
calculated the necessary numbers for the limited partners. Perhaps it was just my ignorance but I could never figure out the relationship between the Box L Capital account info , the gains that were reported, and the cash that was distributed.
In your case, the K-1 instructions seem to suggest a path to calculating
the basis. Perhaps you could confirm w/ whoever is issuing those K-1s
that your approach is correct for calculating the basis to be used for the final gain/loss. If it is, your method in the last paragraph sounds reasonable.
CA has a Sch D-1 that is used if the CA gain is different than the Fed gain https://www.ftb.ca.gov/forms/2018/18_540d1.pdf
There is also a Sch D that is used for CA CG adjustment. The end result seems to be an adjustment that you use on Sch CA to adjust the capital gains as you suggest.
The key seems to be how to calculate the basis and what you use for the sale proceeds. In my case I was spoon fed the gain so I didn’t have to figure that out but your adjustment process seems reasonable.