How to amend Purchase Invoice to post to new account

Hello

I’m relatively new to ERPnext so I’m hoping this will be an easy answer.

At the moment all Purchase Orders/Purchase Invoices post the costs into the “Cost of Goods Sold” account, however I would like to set up a Purchase Invoice template(s) that post into a different cost account. For example if I’m putting through Purchase Invoice for marketing costs, to select a template that will instead post into the “Marketing Costs” account. At the moment I have to manually journal the cost from the “Cost of Goods Sold” into the “Marketing Costs” account, and I would prefer something more automatic.

Could someone please advise how I would set thing kind of thing up? Or point me in the direction of where I can find the solution?

Thanks

Ross

Hello… Welcome… You can automate this using https://erpnext.org/docs/user/manual/en/customize-erpnext/custom-scripts
Based on certain criteria

Thanks for your reply. Do you know where I could find example scripts for this kind of transaction? Or is there a way to view the existing scripts so I can make the amendment?