Initial tables and importer stubs, mostly for invoice exports to QB
This commit is contained in:
commit
9394171ba5
18 changed files with 1087 additions and 0 deletions
27
rattail_quickbooks/importing/__init__.py
Normal file
27
rattail_quickbooks/importing/__init__.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
# Rattail is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
"""
|
||||
rattail-quickbooks importing
|
||||
"""
|
||||
|
||||
from . import model
|
70
rattail_quickbooks/importing/model.py
Normal file
70
rattail_quickbooks/importing/model.py
Normal file
|
@ -0,0 +1,70 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
# Rattail is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
"""
|
||||
rattail-quickbooks model importers
|
||||
"""
|
||||
|
||||
from rattail import importing
|
||||
|
||||
|
||||
##############################
|
||||
# core importer overrides
|
||||
##############################
|
||||
|
||||
class DepartmentImporter(importing.model.DepartmentImporter):
|
||||
|
||||
extension_attr = '_quickbooks'
|
||||
extension_fields = [
|
||||
'quickbooks_expense_account',
|
||||
'quickbooks_expense_class',
|
||||
]
|
||||
|
||||
|
||||
class VendorImporter(importing.model.VendorImporter):
|
||||
|
||||
extension_attr = '_quickbooks'
|
||||
extension_fields = [
|
||||
'quickbooks_name',
|
||||
'quickbooks_bank_account',
|
||||
'quickbooks_terms',
|
||||
]
|
||||
|
||||
|
||||
##############################
|
||||
# custom models
|
||||
##############################
|
||||
|
||||
class QuickbooksExportableInvoiceImporter(importing.model.ToRattail):
|
||||
|
||||
def get_model_class(self):
|
||||
return self.model.QuickbooksExportableInvoice
|
||||
|
||||
def cache_query(self):
|
||||
query = super(QuickbooksExportableInvoiceImporter, self).cache_query()
|
||||
model = self.model
|
||||
# TODO: possibly should filter this way only if config says so?
|
||||
if self.start_date:
|
||||
query = query.filter(model.QuickbooksExportableInvoice.invoice_date >= self.start_date)
|
||||
if self.end_date:
|
||||
query = query.filter(model.QuickbooksExportableInvoice.invoice_date <= self.end_date)
|
||||
return query
|
41
rattail_quickbooks/importing/versions.py
Normal file
41
rattail_quickbooks/importing/versions.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
################################################################################
|
||||
#
|
||||
# Rattail -- Retail Software Framework
|
||||
# Copyright © 2010-2022 Lance Edgar
|
||||
#
|
||||
# This file is part of Rattail.
|
||||
#
|
||||
# Rattail is free software: you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation, either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# Rattail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
################################################################################
|
||||
"""
|
||||
Rattail -> Rattail "versions" import w/ Quickbooks schema
|
||||
"""
|
||||
|
||||
from rattail.importing import versions as base
|
||||
|
||||
|
||||
class QuickbooksVersionMixin(object):
|
||||
|
||||
def add_quickbooks_importers(self, importers):
|
||||
importers['QuickbooksExportableInvoiceImporter'] = QuickbooksExportableInvoiceImporter
|
||||
return importers
|
||||
|
||||
|
||||
class QuickbooksExportableInvoiceImporter(base.VersionImporter):
|
||||
|
||||
@property
|
||||
def host_model_class(self):
|
||||
return self.model.QuickbooksExportableInvoice
|
Loading…
Add table
Add a link
Reference in a new issue