cybermaggedon / gnucash-uk-vat Goto Github PK
View Code? Open in Web Editor NEWA bridge between GnuCash and UK HMRC VAT return MTD APIs for automating VAT returns
License: GNU General Public License v3.0
A bridge between GnuCash and UK HMRC VAT return MTD APIs for automating VAT returns
License: GNU General Public License v3.0
setup.py modifies config.py which the installer thinks is suspicious
pip3 install of gnucash-uk-vat doesn't leave a working gnucash-uk-vat command
Found an unexpected bug, the "Gov-Client-Local-IPs" header is populated with the loopback address ("127.x") on Linux, and not the local IP address.
This is because Python's socket.getbyhostname() returns the value in /etc/hosts, which usually has the loopback address.
On Win and Mac OS the behaviour seems to be correct, but I haven't tested for myself.
After a bit of searching, I found a solution like this (which doesn't add extra dep's):
def get_ip_address():
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
s.connect(("192.168.1.1", 80))
return s.getsockname()[0]
Unfortunately I don't know how to get the gateway IP, so the code above uses my default (the example used 8.8.8.8, but I don't want to open connections externally if it's not needed).
I'm getting the following error when running with the --assist resulting in the next button being disabled after selecting a gnucash file.
Does anyone know how to resolve this?
$ gnucash-uk-vat --assist
Traceback (most recent call last):
File "/.local/lib/python3.10/site-packages/gnucash_uk_vat/assist.py", line 708, in prepare/.local/lib/python3.10/site-packages/gnucash_uk_vat/assist.py", line 614, in check_file
self.check_file()
File "
raise e
File "~/.local/lib/python3.10/site-packages/gnucash_uk_vat/assist.py", line 609, in check_file
accts = accounts.Accounts(self.vat.config)
AttributeError: module 'gnucash_uk_vat.accounts' has no attribute 'Accounts'
Due to the use of dmidecode in device.py, --init-config only works on Linux. Once the config.json file has been setup (which involves taking a valid config file and modifying device information manually), most other functionality seems to work: fetching obligations.
device.py can be modified to use Windows / MacOS native equivalents to dmidecode.
Add tabulate to setup.py
Some time ago I started on the self employed part of MTD, then gave up. It's at https://github.com/EvansMike/hmrc_self_submit if any of that code is useful, if it's still compatible with the API , then please use it for integration into GnuCash. I don't pay VAT so I never got into the VAT part.
e..g spot negative values in returns, or numbers that look massively out by comparing sales with VAT.
I just found some time to look at this again so I have resumed attempting to get this working in the sandbox so I can request a production id, but I am unable to proceed past the authenticate step.
When I go to the provided url (I have omitted the client id):
I get the response:
{"error":"invalid_request","error_description":"redirect_uri is invalid"}
Do you have any idea how I can proceed?
People have reported negative numbers turning up in VAT returns, which then fail to file (negative numbers are invalid). Caused by using the 'wrong' asset vs liability account for recording VAT.
The documentation should explain the impact of using asset vs liability accounts which cause these negative values.
Thanks for this, looks like just what I need now I'm being forced onto MTD.
Is the software still working with the latest changes from HMRC? Is it being actively kept up to date?
Once the --init-config problem is worked around (#13), get event loop problems on Windows. Looks like all operations work (fetching obligations, fetching VAT returns, computing data), but the event loop throws an exception on exit. This is using Python 3.10 as installed from VS on Win 10.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000029F6404F0A0>
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\[proactor_events.py](http://proactor_events.py/)", line 116, in __del__
self.close()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\[proactor_events.py](http://proactor_events.py/)", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\[base_events.py](http://base_events.py/)", line 750, in call_soon
self._check_closed()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\asyncio\[base_events.py](http://base_events.py/)", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Hi cybermaggedon, thank you very much for this library!
My setup:
-Debian 10 Buster
-gnucash/oldstable,now 1:3.4-1+b10
(Version: 3.4, Build ID: 3.4+ (2018-12-30))
I'm trying to get the sandbox test working, and I'm hitting an exception when gnucash-uk-vat is trying to get the session mode:
(see accounts_gnucash.py#l42)
mode = gnucash.SessionOpenMode.SESSION_READ_ONLY
Exception: module 'gnucash' has no attribute 'SessionOpenMode'
From a different issue (MatzeB/pygnucash#12), I tried a different strategy
I imported "gnucash" in interactive shell, and indeed there was no SessionOpenMode object.
Saw no enums of similar name either. Doing print(gnucash.__file__)
did point me to the lib file, here:
/usr/lib/python3/dist-packages/gnucash
And grep'ing for SESSION_READ_ONLY
, found no matches.
Checking the file headers, gnucash_core_c.py
is of the Version 3.0.10, and latest copyright date I saw was 2010.
So I'm guessing I don't have the right lib, or my gnucash is too old.
Also tried installing pygnucash
from pypi, however that lib is completely different (at least the one I have seems to be the right one, but perhaps outdated).
Have you had a similar issue before?
Again, thanks for your efforts (it's amazing to not have to proprietary software for tax).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.