Skip to content

Commit

Permalink
Merge pull request #10 from MohmdFo/main
Browse files Browse the repository at this point in the history
fix(invoice): resolve total price calculation issue and refactor invoice processing logic
  • Loading branch information
sepehr-akbarzadeh authored Sep 6, 2024
2 parents 8e0fe88 + cd2d014 commit 00ab052
Show file tree
Hide file tree
Showing 30 changed files with 317 additions and 1,621 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install coverage codecov pytest poetry
pip install -r packages/requirements-dev.txt
pip install -r requirements/requirements-dev.txt
- name: Run tests with coverage
run: pytest --cov=iranian_cities --cov-report=xml
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ sphinx:
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: packages/requirements-dev.txt
- requirements: requirements/requirements-dev.txt
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Thank you for your interest in contributing to our package! This document outlin

12. **Export Dependencies**: Export dependencies for development and production.
```bash
poetry export -f requirements.txt --output packages/requirements.txt --without-hashes
poetry export -f requirements.txt --dev --output packages/requirements-dev.txt --without-hashes
poetry export -f requirements.txt --output requirements/requirements.txt --without-hashes
poetry export -f requirements.txt --dev --output requirements/requirements-dev.txt --without-hashes
```

## Commitizen Message Rule
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ Django Sage Invoice is a Django application for managing invoices. It provides a

### Django Settings

Add `django-sage-invoice` to your `INSTALLED_APPS` in the Django settings and configure the `MODEL_PREFIX` and `MODEL_TEMPLATE`:
Add `django-sage-invoice` to your `INSTALLED_APPS` in the Django settings and configure the `SAGE_MODEL_PREFIX` and `SAGE_MODEL_TEMPLATE`:

```python
INSTALLED_APPS = [
...
# other packages
"sage_tools",
"sage_invoice",
...
]
MODEL_PREFIX = "invoice"
MODEL_TEMPLATE = "sage_invoice"
SAGE_MODEL_PREFIX = "invoice"
SAGE_MODEL_TEMPLATE = "sage_invoice"
```
16 changes: 8 additions & 8 deletions docs/source/getting_started/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@ Django Settings Configuration
Installed Apps
~~~~~~~~~~~~~~

To use `django-sage-invoice`, add it to your `INSTALLED_APPS` in the Django settings and configure the `MODEL_PREFIX` and `MODEL_TEMPLATE`:
To use `django-sage-invoice`, add it to your `INSTALLED_APPS` in the Django settings and configure the `SAGE_MODEL_PREFIX` and `SAGE_MODEL_TEMPLATE`:

.. code-block:: python
INSTALLED_APPS = [
# other packages
"sage_invoice",
]
MODEL_PREFIX = "invoice"
MODEL_TEMPLATE = "sage_invoice"
SAGE_MODEL_PREFIX = "invoice"
SAGE_MODEL_TEMPLATE = "sage_invoice"
Explanation of `MODEL_PREFIX` and `MODEL_TEMPLATE`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation of `SAGE_MODEL_PREFIX` and `SAGE_MODEL_TEMPLATE`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- **MODEL_PREFIX**: This setting defines the prefix used to identify your models when searching for Jinja2 templates. By setting `MODEL_PREFIX = "invoice"`, the application will look for template files that start with "invoice" in the specified directory.
- **SAGE_MODEL_PREFIX**: This setting defines the prefix used to identify your models when searching for Jinja2 templates. By setting `SAGE_MODEL_PREFIX = "invoice"`, the application will look for template files that start with "invoice" in the specified directory.




- **MODEL_TEMPLATE**: This setting defines the directory where your model templates are stored. By setting `MODEL_TEMPLATE = "sage_invoice"`, the application will search for templates in the `sage_invoice` directory under the specified base directory.
- **SAGE_MODEL_TEMPLATE**: This setting defines the directory where your model templates are stored. By setting `SAGE_MODEL_TEMPLATE = "sage_invoice"`, the application will search for templates in the `sage_invoice` directory under the specified base directory.

.. warning::

The `django-sage-invoice` package will not function correctly without configuring both `MODEL_PREFIX` and `MODEL_TEMPLATE` in your Django settings. Make sure these settings are properly configured to avoid any issues.
The `django-sage-invoice` package will not function correctly without configuring both `SAGE_MODEL_PREFIX` and `SAGE_MODEL_TEMPLATE` in your Django settings. Make sure these settings are properly configured to avoid any issues.
10 changes: 5 additions & 5 deletions docs/source/getting_started/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ Fields
- `invoice`: The invoice associated with this custom column.
- `item`: The item associated with this custom column.

InvoiceTotal
Expense
------------

The `InvoiceTotal` model represents the total amount for an invoice, including calculations for tax, discounts, and the final total.
The `Expense` model represents the total amount for an invoice, including calculations for tax, discounts, and the final total.

Fields
^^^^^^
Expand All @@ -91,7 +91,7 @@ To integrate these models into the Django admin interface, register them in the
InvoiceCategory,
InvoiceItem,
InvoiceColumn,
InvoiceTotal,
Expense,
)
Expand All @@ -115,8 +115,8 @@ To integrate these models into the Django admin interface, register them in the
list_display = ["column_name", "priority", "value"]
@admin.register(InvoiceTotal)
class InvoiceTotalAdmin(admin.ModelAdmin):
@admin.register(Expense)
class ExpenseAdmin(admin.ModelAdmin):
list_display = ["subtotal", "tax_percentage", "discount_percentage", "total_amount"]
This will allow you to manage the different invoice models directly from the Django admin interface.
Loading

0 comments on commit 00ab052

Please sign in to comment.