[GNC] unable to iterate accounts with API Python bindings
pudgier_fruit.0v at icloud.com
pudgier_fruit.0v at icloud.com
Sun Oct 27 16:29:33 EDT 2024
I can confirm that added the session.load() step allowed me to start accessing my account data! Thank you for that suggestion!
I’ll look into an updated build and test the fix. I had a messy experience getting to a successful build. I mean to make a post about that to gnucash-devel.
With regard to the session remaining open (destructor not called), I find that I had a misconception about Python and quit(). After a little reading, I see that destructors on objects in the interpreter are not guaranteed to be called.
I’m quite happy I have something to meaningfully experiment with now. Thanks again.
Cheers,
Noah
> On Oct 26, 2024, at 19:44, gnucash-user-request at gnucash.org <gnucash-user-request_at_gnucash_org_6r6jr9qybm4741_5faa19e2 at icloud.com> wrote:
>
> Send gnucash-user mailing list submissions to
> gnucash-user at gnucash.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> or, via email, send a message with subject or body 'help' to
> gnucash-user-request at gnucash.org
>
> You can reach the person managing the list at
> gnucash-user-owner at gnucash.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gnucash-user digest..."
>
>
> Today's Topics:
>
> 1. Re: Printing checks (Michael or Penny Novack)
> 2. Transaction Report: Table for Exporting (Fred Tydeman)
> 3. Re: unable to iterate accounts with API Python bindings
> (Jon Schewe)
> 4. Re: Transaction Report: Table for Exporting (Jim DeLaHunt)
> 5. Re: Transaction Report: Table for Exporting (David H)
> 6. Re: unable to iterate accounts with API Python bindings
> (John Ralls)
> 7. Re: unable to iterate accounts with API Python bindings
> (John Ralls)
> 8. FW: gnucash-user Digest,new question (Eric Hammond)
> 9. Re: FW: gnucash-user Digest,new question (David Cousens)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 26 Oct 2024 12:16:14 -0400
> From: Michael or Penny Novack <stepbystepfarm at comcast.net>
> To: gnucash-user at gnucash.org
> Subject: Re: [GNC] Printing checks
> Message-ID: <f6302e1b-278b-41e0-9486-04bf8eed8cba at comcast.net>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> On 10/25/2024 8:34 PM, Sherman Yoder wrote:
>> Hello,
>>
>> You can find instructions how to create and modify checks in the
>> Tutorial and Concepts Guide. On gnucash.org, click on Documentation,
>> then The Tutorial and Concepts Guide. Appendix B describes how to
>> create a check form.
>>
>> If you need help after reading that, please ask.
>>
>> Sherman
>
> Strong suggestion? ------ if you are printing checks or invoices for a
> business and intend to mail these in window envelopes do NOT attempt to
> do final editing within gnucash. In stead, "print to file" so a final
> formatting program has a chance to modify before printing. Then when the
> "unexpected" happens and it will << example -- new batch of envelopes,
> supposedly the same as the previous, has window a couple mm higher,
> lower, left, or right >> you can quickly make the adjustment in that
> final editing program instead of in gnucash (and the having to rerun).
>
> Initially, your final edit program can be "do nothing" (pass through
> unaltered)
>
> Michael D Novack????? ex senior systems analyst/senior business analyst
> who in working days often had to field emergency calls from the print
> room to quickly write an edit to make stuffing fit with address properly
> centered in window. The suppliers of window envelopes rarely inform
> their customers that they made a slight change to model XYZ envelope.
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Sat, 26 Oct 2024 17:39:41 +0100
> From: Fred Tydeman <tydeman.fred at gmail.com>
> To: Gnucash Users <gnucash-user at gnucash.org>
> Subject: [GNC] Transaction Report: Table for Exporting
> Message-ID:
> <CAK1r+o29htYvQaYd0Oj_Qv4Y1jJk22ie+TCLpVh+y+R7nu3weg at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> I am running Gnucash 5.9 on Fedora Linux 40
>
> I have done a Transaction Report
> In the General Options
> I have checked Table for Exporting
> I do not see any table
> in either the report (at the bottom)
> or in ~/Documents/ folder
>
> Is this
> a bug
> a limitation
> user error
>
> I recall seeing a table at the bottom of some other reports.
>
>
> ------------------------------
>
> Message: 3
> Date: Sat, 26 Oct 2024 12:21:09 -0500
> From: Jon Schewe <jpschewe at mtu.net>
> To: pudgier_fruit.0v at icloud.com, gnucash-user at gnucash.org
> Subject: Re: [GNC] unable to iterate accounts with API Python bindings
> Message-ID: <ef13978f34ce3dac424c61d2b77a4bd2cf118cf3.camel at mtu.net>
> Content-Type: text/plain; charset="UTF-8"
>
> Noah and I traded a couple of messages directly about this off-list. I
> tried reading Noah's file and and it worked just fine, get_children
> showed the accounts; on their computer it did not. I was using the
> python bindings for GNuCash 5.5 that are shipped with Ubuntu 24.04. I
> don't know how to get the version of the gnucash bindings from inside
> python, so I'm not sure what version Noah was using, however they are
> on mac OS.?
> Does anyone have suggestions why I would see the list of accounts and
> Noah would not?
>
> Example output from my system. Noah gets an empty list when calling
> get_children().
>
>> python3
> Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import gnucash
>>>> filename = 'gnucash_localSave.gnucash'
>>>> session = gnucash.Session(filename,
> gnucash.SessionOpenMode.SESSION_NORMAL_OPEN)
>>>> root_account = session.book.get_root_account()
>>>> root_account.get_children()
> [<gnucash.gnucash_core.Account object at 0x70e7709b6330>,
> <gnucash.gnucash_core.Account object at 0x70e7709b7d10>,
> <gnucash.gnucash_core.Account object at 0x70e7709b7e90>]
>>>> session.end()
>>>> quit()
>
> Jon
>
> On Fri, 2024-10-25 at 19:59 -0500, Jon Schewe wrote:
>> You want "get_children" instead of "get_descendents".
>>
>> On Thu, 2024-10-24 at 21:51 -0700, Noerr via gnucash-user wrote:
>>> Hi,
>>>
>>> ???? I've been trying to get started with the GnuCash API Python
>>> bindings
>>> after just using the main desktop app for the last 12 years.
>>> I built GnuCash app (Build ID: 5.9+(2024-09-28) along with API and
>>> Python
>>> bindings enabled for my system (MacOS 15.0 , M1 Arm)
>>>
>>> My problem is that I haven't been able to interact with my GnuCash
>>> data in
>>> a useful way yet.? Namely, I can't seem to access any existing
>>> accounts,
>>> and thus no transactions either.? Nor any entries in the price
>>> database.
>>>
>>> First I used the desktop app to save-as a copy of my GnuCash data
>>> in
>>> the
>>> XML format.
>>> Next I use python and? commands generally like the following.? I do
>>> not see
>>> any output that is expected when iterating over the descendants of
>>> root_account.? ( I never see the text output, 'checking a
>>> descendant...' )
>>>
>>>
>>> from gnucash import (Session, Account, Transaction, Split,
>>> GncNumeric,
>>> SessionOpenMode, gnucash_core)
>>> uri="file:///Users/me/Downloads/gnucash_localSave.gnucash"
>>> session = Session(book_uri=uri,
>>> mode=gnucash_core.SessionOpenMode.SESSION_NORMAL_OPEN )
>>> book = session.book
>>> table = book.get_table()
>>> currency_code = 'USD'
>>> currency = table.lookup('ISO4217', currency_code)
>>> root_account = book.get_root_account()
>>> for acc in root_account.get_descendants():
>>> ??? print('checking a descendant...')
>>> ??? if acc.GetType() == ACCT_TYPE_STOCK:
>>> ??????? print('found a stock')
>>>
>>>
>>> **So why is root_account.get_descendants() returning an empty
>>> container?**
>>>
>>> The Bindings/API aren't completely dead though.? With the same
>>> session and
>>> book open above, I was playing around with some of the ideas
>>> Eberhard
>>> demonstrated in this thread [
>>> https://lists.gnucash.org/pipermail/gnucash-user/2024-September/113402.html
>>> ]
>>> and I called
>>>>>> create_accounts(session, book, root_acct)
>>>>>> quit()
>>>
>>> To my suprise, when I used the desktop app to open
>>> gnucash_localSave.gnucash, my real accounts and transactions are
>>> gone, but
>>> I have three accounts: Expenses, Opening Balance, and Savings in
>>> CAD
>>> currency, and with the specified opening balances.
>>> So the Bindings and API worked to create stuff.
>>>
>>> As an aside, the file did flag as locked upon open in the desktop
>>> app.? I
>>> suspect there's a missing unlock somewhere in Python Bindings /
>>> destructor
>>> code.
>>>
>>> Cheers,
>>>
>>> Noah
>>> _______________________________________________
>>> gnucash-user mailing list
>>> gnucash-user at gnucash.org
>>> To update your subscription preferences or to unsubscribe:
>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>> -----
>>> Please remember to CC this list on all your replies.
>>> You can do this by using Reply-To-List or Reply-All.
>>
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>
>
>
> ------------------------------
>
> Message: 4
> Date: Sat, 26 Oct 2024 15:10:22 -0700
> From: Jim DeLaHunt <list+gnucash at jdlh.com>
> To: tydeman.fred at gmail.com
> Cc: Gnucash Users <gnucash-user at gnucash.org>
> Subject: Re: [GNC] Transaction Report: Table for Exporting
> Message-ID: <bf4b0a1c-1ac8-4b37-9967-c3ee51d3f3f3 at jdlh.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Fred:? Pa
>
> Sometimes things are hidden in plain sight.
>
> On 2024-10-26 09:39, Fred Tydeman wrote:
>> I am running Gnucash 5.9 on Fedora Linux 40
>>
>> I have done a Transaction Report
>> In the General Options
>> I have checked Table for Exporting
>> I do not see any table
>> in either the report (at the bottom)
>> or in ~/Documents/ folder
>>
>> Is this
>> a bug
>> a limitation
>> user error
>
> In the transaction report, do you see a row with column headers,
> followed by line after line of transaction listings?? That is the table.
>
> Try selecting the headers and the lines of date, doing an Edit? Copy,
> then opening a blank spreadsheet, and do an Edit? Paste. I expect that
> you will see the headers and the lines of the transaction report in the
> spreadsheet.
>
> This is not very well documented, but have a look at the /GnuCash
> Manual/, section 9.3.1.3. *Transaction Report*
> <https://gnucash.org/viewdoc.phtml?rev=5&lang=C&doc=help>. It says,
>
>> *Table for Exporting*: Formats the table for cut & paste exporting
>> with extra cells
>>
> The manual does not say what "the table" is, but I understand it to mean
> the list of transactions itself.
>
> Does this work for you?
>
> Best regards,
> ??? ?Jim DeLaHunt
>
>
> ------------------------------
>
> Message: 5
> Date: Sun, 27 Oct 2024 08:17:35 +1000
> From: David H <hellvee at gmail.com>
> To: tydeman.fred at gmail.com
> Cc: Gnucash Users <gnucash-user at gnucash.org>
> Subject: Re: [GNC] Transaction Report: Table for Exporting
> Message-ID:
> <CA+5xQdpQLmda18opP=McFJLBDxCMSMOVhAi6uDf-611mwvfbAw at mail.gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
> Fred,
>
> No real idea on this, but I think it only affects the report out display
> format so that when you click the export button after running the report to
> export the results it's more suited to displaying in a web browser or
> pasting into spreadsheet. Run your report with it unchecked and run the
> same report with it checked on in another tab and you'll see the formatting
> has changed.
>
> Cheers David H.
>
>
> On Sun, 27 Oct 2024 at 02:40, Fred Tydeman <tydeman.fred at gmail.com> wrote:
>
>> I am running Gnucash 5.9 on Fedora Linux 40
>>
>> I have done a Transaction Report
>> In the General Options
>> I have checked Table for Exporting
>> I do not see any table
>> in either the report (at the bottom)
>> or in ~/Documents/ folder
>>
>> Is this
>> a bug
>> a limitation
>> user error
>>
>> I recall seeing a table at the bottom of some other reports.
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>>
>
>
> ------------------------------
>
> Message: 6
> Date: Sat, 26 Oct 2024 16:59:48 -0700
> From: John Ralls <jralls at ceridwen.us>
> To: Jon Schewe <jpschewe at mtu.net>
> Cc: "D. via gnucash-user" <gnucash-user at gnucash.org>
> Subject: Re: [GNC] unable to iterate accounts with API Python bindings
> Message-ID: <54598AAC-7030-493F-98E1-303E1E88C45E at ceridwen.us>
> Content-Type: text/plain; charset=utf-8
>
> Jon,
>
> Thanks for digging into it. Reporting that Noah's script works for you in GnuCash 5.5 was very helpful because there's been only one change to the bindings since then: I removed a load call from the Session constructor to fix bug 799308. That wasn't exactly the right thing to do, but it's a surmountable problem: Load the session in the script.
>
> Noah's other problem, that the lock file is left, is because `session` never goes out of scope before the script ends, preventing the destructor from being called. Use Python's RAII keyword `with?;` to ensure that `session` is destroyed. There's one other problem, ACCT_TYPE_STOCK isn't explicitly imported so it needs its package prefix. The following diff fixes all three problems:
> --- test.py~ 2024-10-26 16:15:09.000000000 -0700
> +++ test.py 2024-10-26 16:30:06.000000000 -0700
> @@ -2,14 +2,15 @@
> from gnucash import (Session, Account, Transaction, Split, GncNumeric,
> SessionOpenMode, gnucash_core)
> uri="file:///Users/me/Downloads/gnucash_localSave.gnucash"
> -session = Session(book_uri=uri,
> -mode=gnucash_core.SessionOpenMode.SESSION_NORMAL_OPEN )
> -book = session.book
> -table = book.get_table()
> -currency_code = 'USD'
> -currency = table.lookup('ISO4217', currency_code)
> -root_account = book.get_root_account()
> -for acc in root_account.get_descendants():
> - print('checking a descendant...')
> - if acc.GetType() == ACCT_TYPE_STOCK:
> - print('found a stock')
> +with Session(book_uri=uri,
> + mode=gnucash_core.SessionOpenMode.SESSION_NORMAL_OPEN) as session:
> + session.load()
> + book = session.book
> + table = book.get_table()
> + currency_code = 'USD'
> + currency = table.lookup('ISO4217', currency_code)
> + root_account = book.get_root_account()
> + for acc in root_account.get_descendants():
> + print('checking a descendant...')
> + if acc.GetType() == gnucash_core.ACCT_TYPE_STOCK:
> + print('found a stock')
>
> Note that I didn't change get_descendants() to get_children(). get_children() returns only the immediate children of the account, get_descendants() recursively calls get_children() to return all of the account's descendants. Since Noah is looking for a Stock account and it's rare that a stock account would be at the top level, get_descendants() is the right function.
>
> Now to revisit getting the Session constructor to load xml files since I obviously got that wrong.
>
> Regards,
> John Ralls
>
>> On Oct 26, 2024, at 10:21 AM, Jon Schewe <jpschewe at mtu.net> wrote:
>>
>> Noah and I traded a couple of messages directly about this off-list. I
>> tried reading Noah's file and and it worked just fine, get_children
>> showed the accounts; on their computer it did not. I was using the
>> python bindings for GNuCash 5.5 that are shipped with Ubuntu 24.04. I
>> don't know how to get the version of the gnucash bindings from inside
>> python, so I'm not sure what version Noah was using, however they are
>> on mac OS.
>> Does anyone have suggestions why I would see the list of accounts and
>> Noah would not?
>>
>> Example output from my system. Noah gets an empty list when calling
>> get_children().
>>
>>> python3
>> Python 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import gnucash
>>>>> filename = 'gnucash_localSave.gnucash'
>>>>> session = gnucash.Session(filename,
>> gnucash.SessionOpenMode.SESSION_NORMAL_OPEN)
>>>>> root_account = session.book.get_root_account()
>>>>> root_account.get_children()
>> [<gnucash.gnucash_core.Account object at 0x70e7709b6330>,
>> <gnucash.gnucash_core.Account object at 0x70e7709b7d10>,
>> <gnucash.gnucash_core.Account object at 0x70e7709b7e90>]
>>>>> session.end()
>>>>> quit()
>>
>> Jon
>>
>> On Fri, 2024-10-25 at 19:59 -0500, Jon Schewe wrote:
>>> You want "get_children" instead of "get_descendents".
>>>
>>> On Thu, 2024-10-24 at 21:51 -0700, Noerr via gnucash-user wrote:
>>>> Hi,
>>>>
>>>> I've been trying to get started with the GnuCash API Python
>>>> bindings
>>>> after just using the main desktop app for the last 12 years.
>>>> I built GnuCash app (Build ID: 5.9+(2024-09-28) along with API and
>>>> Python
>>>> bindings enabled for my system (MacOS 15.0 , M1 Arm)
>>>>
>>>> My problem is that I haven't been able to interact with my GnuCash
>>>> data in
>>>> a useful way yet. Namely, I can't seem to access any existing
>>>> accounts,
>>>> and thus no transactions either. Nor any entries in the price
>>>> database.
>>>>
>>>> First I used the desktop app to save-as a copy of my GnuCash data
>>>> in
>>>> the
>>>> XML format.
>>>> Next I use python and commands generally like the following. I do
>>>> not see
>>>> any output that is expected when iterating over the descendants of
>>>> root_account. ( I never see the text output, 'checking a
>>>> descendant...' )
>>>>
>>>>
>>>> from gnucash import (Session, Account, Transaction, Split,
>>>> GncNumeric,
>>>> SessionOpenMode, gnucash_core)
>>>> uri="file:///Users/me/Downloads/gnucash_localSave.gnucash"
>>>> session = Session(book_uri=uri,
>>>> mode=gnucash_core.SessionOpenMode.SESSION_NORMAL_OPEN )
>>>> book = session.book
>>>> table = book.get_table()
>>>> currency_code = 'USD'
>>>> currency = table.lookup('ISO4217', currency_code)
>>>> root_account = book.get_root_account()
>>>> for acc in root_account.get_descendants():
>>>> print('checking a descendant...')
>>>> if acc.GetType() == ACCT_TYPE_STOCK:
>>>> print('found a stock')
>>>>
>>>>
>>>> **So why is root_account.get_descendants() returning an empty
>>>> container?**
>>>>
>>>> The Bindings/API aren't completely dead though. With the same
>>>> session and
>>>> book open above, I was playing around with some of the ideas
>>>> Eberhard
>>>> demonstrated in this thread [
>>>> https://lists.gnucash.org/pipermail/gnucash-user/2024-September/113402.html
>>>> ]
>>>> and I called
>>>>>>> create_accounts(session, book, root_acct)
>>>>>>> quit()
>>>>
>>>> To my suprise, when I used the desktop app to open
>>>> gnucash_localSave.gnucash, my real accounts and transactions are
>>>> gone, but
>>>> I have three accounts: Expenses, Opening Balance, and Savings in
>>>> CAD
>>>> currency, and with the specified opening balances.
>>>> So the Bindings and API worked to create stuff.
>>>>
>>>> As an aside, the file did flag as locked upon open in the desktop
>>>> app. I
>>>> suspect there's a missing unlock somewhere in Python Bindings /
>>>> destructor
>>>> code.
>>>>
>>>> Cheers,
>>>>
>>>> Noah
>>>> _______________________________________________
>>>> gnucash-user mailing list
>>>> gnucash-user at gnucash.org
>>>> To update your subscription preferences or to unsubscribe:
>>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>>> -----
>>>> Please remember to CC this list on all your replies.
>>>> You can do this by using Reply-To-List or Reply-All.
>>>
>>> _______________________________________________
>>> gnucash-user mailing list
>>> gnucash-user at gnucash.org
>>> To update your subscription preferences or to unsubscribe:
>>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>>> -----
>>> Please remember to CC this list on all your replies.
>>> You can do this by using Reply-To-List or Reply-All.
>>
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>
>
>
> ------------------------------
>
> Message: 7
> Date: Sat, 26 Oct 2024 18:02:09 -0700
> From: John Ralls <jralls at ceridwen.us>
> To: Jon Schewe <jpschewe at mtu.net>
> Cc: "D. via gnucash-user" <gnucash-user at gnucash.org>
> Subject: Re: [GNC] unable to iterate accounts with API Python bindings
> Message-ID: <814F27D4-863F-4040-8D37-EF36A857FD9A at ceridwen.us>
> Content-Type: text/plain; charset=us-ascii
>
>
>
>> On Oct 26, 2024, at 4:59 PM, John Ralls <jralls at ceridwen.us> wrote:
>>
>> Now to revisit getting the Session constructor to load xml files since I obviously got that wrong.
>>
>
> Which I've now done, and pushed the result. Noah, if you built GnuCash from git, please pull and rebuild. The added `session.load()` should no longer be needed.
>
> Regards,
> John Ralls
>
>
>
>
> ------------------------------
>
> Message: 8
> Date: Sun, 27 Oct 2024 01:06:30 +0000
> From: Eric Hammond <eric at jehammond.net>
> To: "gnucash-user at gnucash.org" <gnucash-user at gnucash.org>
> Cc: Eric Hammond <eric at jehammond.net>
> Subject: [GNC] FW: gnucash-user Digest,new question
> Message-ID:
> <BLAPR19MB45646C8D05E7FC756A2C95DED5492 at BLAPR19MB4564.namprd19.prod.outlook.com>
>
> Content-Type: text/plain; charset="us-ascii"
>
> -----Original Message-----
> From: gnucash-user <gnucash-user-bounces+eric=jehammond.net at gnucash.org> On Behalf Of gnucash-user-request at gnucash.org
> Sent: Friday, October 25, 2024 7:11 PM
> To: gnucash-user at gnucash.org
> Subject: gnucash-user Digest, Vol 259, Issue 61
>
> Send gnucash-user mailing list submissions to
> gnucash-user at gnucash.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> or, via email, send a message with subject or body 'help' to
> gnucash-user-request at gnucash.org
>
> You can reach the person managing the list at
> gnucash-user-owner at gnucash.org
>
> When replying, please edit your Subject line so it is more specific than "Re: Contents of gnucash-user digest..."
>
> ----------------------------------------------------------------------
>
> Question: correct debit account for labor:
>
> I have completely replaced my defunct Quicken with GnuCash, and now trying to get the details fine-tuned:
> I am using Job cost accounting for my business, my main resource is the OpenStax book - "Principles of Accounting, Volume 2: Managerial Accounting" page224 - 226
> And a lot of internet searches...
>
> Entering my labor, parts/supplies would look like this:
> Assets:Jobs:xxxxxx:WIP 500.00
> ________:Direct Labor 120.00
> Assets: Stock 20.00
> ________:Direct Labor 360.00
>
> 1. If I use "Expenses:Direct Labor" as the credit account then those account balances are all negative (which, at least, looks weird in an expense journal)
> 2. If i use "Income:Direct Labor" the balances are positive.
>
> With settings #2 all the tax reports look correct. I didn't check during #1 settings.
>
> Which one is correct? Does GnuCash care about the negative balance? Is there a better way log it?
>
> Thank you for a great accounting tool, and all your help.
>
> Eric Hammond
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
>
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
>
>
> ------------------------------
>
> End of gnucash-user Digest, Vol 259, Issue 61
> *********************************************
>
>
> ------------------------------
>
> Message: 9
> Date: Sun, 27 Oct 2024 12:44:33 +1000
> From: David Cousens <davidcousens49 at gmail.com>
> To: Eric Hammond <eric at jehammond.net>, "gnucash-user at gnucash.org"
> <gnucash-user at gnucash.org>
> Subject: Re: [GNC] FW: gnucash-user Digest,new question
> Message-ID: <f575778b1f1b67b53c621ab5045060cc2068d216.camel at gmail.com>
> Content-Type: text/plain; charset="UTF-8"
>
>
> Eric
>
> This is really a Cost Management Accounting issue which is usually
> beyond basic books on principles of Accounting so if you can find a
> book on Cost Management Accounting it may give a better understanding
> of the process.?
>
> An outline of the basic process for dealing with direct maerials and
> labour costs would be for the purchase of materials and application of
> direct labour to production
>
> on purchase
>
> Assets:WIP Inventory Dr xxxx
> Liabilities:Accounts Payable Cr xxx
>
> payments for purchase
>
> Assets:Bank Account Cr zzzz
> Liabilities::Accounts Payable Dr zzzz
>
> here zzzz may not be for a single purchase but for multiple purchases.
>
> when the labour is performed
> Assets:WiP Inventory Dr yyyy
> Liabilities:Wages Payable Cr yyyy
>
> when wages are paid
> Assets:Bank Cr pppp
> Liabilities:Wages Payable Dr pppp
> and again pppp may be the sum of several such entries.
>
> at the completion of the production process os a batch of product you
> would prepare a report of the costs of production for that batch and
> calculate a unit cost of the product. Your costs may for example
> include materials purchases at different times with a differnt unit
> cost.
>
> Then you would transfer the product from the Work in Progress Inventory
> to the Stock Inventory at that unit cost.
>
> (n widgets at unit cost ccc =n*ccc )=qqqq
> Asset:Inventory WiP Cr qqqq?
> Asset: Inventory:Stock Dr qqqq
>
> These costs are usually expensed at the time of sale, not at the time
> they are incurred, through entries which decrease the inventory an
> expense through cost of goods sold.
>
> Similarly they don't affect income until they are sold. A typical sale
> entry would be
>
> Asset:Bank Dr xxxx
> Income Sales Cr xxxx
> Asset:Inventory:Stock Cr yyyy
> Expenses:COGS Dr yyyy
>
> There are a lot of complex parts of complex accounting for
> manufacturing processes (allowances for spoilage etc etc, overhead
> costs and many more) and whether using FIFO or some other basis for
> managing inventory.
>
> Often there will be standard treatments in your jurisdiction for
> particular industries approved by the tax authorities which make
> consulting a practising accountant in your jurisdiction with relevant
> experience a very good idea.
>
> The process above is generic and meant to be illustrative and does not
> constitute accounting advice which may be relevant to your situation.
> You will likely have to maintain many aspects of the cost management
> accounting outside GnuCash (e.g. spreadshetts or other software) as
> GnuCash does not have inventory and cost management programmed in and
> can only handle the accounts aspects of it.
>
> David Cousens
>
>
> On Sun, 2024-10-27 at 01:06 +0000, Eric Hammond wrote:
>> -----Original Message-----
>> From: gnucash-user
>> <gnucash-user-bounces+eric=jehammond.net at gnucash.org> On Behalf Of
>> gnucash-user-request at gnucash.org
>> Sent: Friday, October 25, 2024 7:11 PM
>> To: gnucash-user at gnucash.org
>> Subject: gnucash-user Digest, Vol 259, Issue 61
>>
>> Send gnucash-user mailing list submissions to
>> gnucash-user at gnucash.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> or, via email, send a message with subject or body 'help' to
>> gnucash-user-request at gnucash.org
>>
>> You can reach the person managing the list at
>> gnucash-user-owner at gnucash.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of gnucash-user digest..."
>>
>> ---------------------------------------------------------------------
>> -
>>
>> Question: correct debit account for labor:
>>
>> I have completely replaced my defunct Quicken with GnuCash, and now
>> trying to get the details fine-tuned:
>> I am using Job cost accounting for my business, my main resource is
>> the OpenStax book - "Principles of Accounting, Volume 2: Managerial
>> Accounting" page224 - 226
>> ??????? And a lot of internet searches...
>>
>> Entering my labor, parts/supplies would look like this:
>> Assets:Jobs:xxxxxx:WIP???????? 500.00
>> ________:Direct Labor?????????????????????????? 120.00
>> Assets: Stock?????????????????????????????????????????????? 20.00
>> ________:Direct Labor??????????????????????????? 360.00
>>
>> 1. If I use "Expenses:Direct Labor" as the credit account then those
>> account balances are all negative (which, at least, looks weird in an
>> expense journal)
>> 2. If i use "Income:Direct Labor" the balances are positive.
>>
>> With settings #2 all the tax reports look correct. I didn't check
>> during #1 settings.
>>
>> Which one is correct? Does GnuCash care about the negative balance?
>> Is there a better way log it?
>>
>> Thank you for a great accounting tool, and all your help.
>>
>> Eric Hammond
>>
>> ------------------------------
>>
>> Subject: Digest Footer
>>
>> _______________________________________________
>>
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>>
>>
>> ------------------------------
>>
>> End of gnucash-user Digest, Vol 259, Issue 61
>> *********************************************
>> _______________________________________________
>> gnucash-user mailing list
>> gnucash-user at gnucash.org
>> To update your subscription preferences or to unsubscribe:
>> https://lists.gnucash.org/mailman/listinfo/gnucash-user
>> -----
>> Please remember to CC this list on all your replies.
>> You can do this by using Reply-To-List or Reply-All.
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
>
> gnucash-user mailing list
> gnucash-user at gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -----
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
>
>
> ------------------------------
>
> End of gnucash-user Digest, Vol 259, Issue 62
> *********************************************
More information about the gnucash-user
mailing list