Skip to content

Commit

Permalink
Add converter from qbd_mixin_model to qbd_task
Browse files Browse the repository at this point in the history
  • Loading branch information
bedilbek committed Feb 27, 2020
1 parent e978b63 commit 6ad683b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.

### ADDED

- Add converter from qbd_mixin_model to qbd_task
- Add signal to handle post_process after realm is authenticated successfully

## [0.6.3] - 2020-02-14
Expand Down
18 changes: 18 additions & 0 deletions django_quickbooks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,21 @@ def get_xml_meta_info():
def random_string(length=10):
letters = string.ascii_lowercase + string.ascii_uppercase
return ''.join(random.choice(letters) for i in range(length))


def convert_qbd_model_to_qbdtask(obj, qb_resource, qb_operation=None, **kwargs):
from django_quickbooks import QUICKBOOKS_ENUMS
from django.contrib.contenttypes.models import ContentType

if not qb_operation:
if obj.is_qbd_obj_created:
qb_operation = QUICKBOOKS_ENUMS.OPP_MOD
else:
qb_operation = QUICKBOOKS_ENUMS.OPP_ADD

return dict(
qb_operation=qb_operation,
qb_resource=qb_resource,
object_id=obj.id,
content_type=ContentType.objects.get_for_model(obj),
)

0 comments on commit 6ad683b

Please sign in to comment.