Skip to content

Commit 8ac4fad

Browse files
committed
add related documents
1 parent b36afb5 commit 8ac4fad

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
python-version: [3.7, 3.8, 3.9, '3.10']
23+
python-version: [3.8, 3.9, '3.10']
2424
steps:
2525
- uses: actions/checkout@v2
2626
- name: Set up Python ${{ matrix.python-version }}

facturapi/resources/invoices.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class to create the resource and a class to represent an
1717
ItemPart,
1818
Namespace,
1919
ProductBasicInfo,
20+
RelatedDocument,
2021
)
2122
from ..types.queries import InvoiceQuery
2223
from .base import Creatable, Deletable, Downloadable, Queryable, Retrievable
@@ -101,8 +102,7 @@ class InvoiceRequest(BaseModel):
101102
exchange: Optional[float] = 1.0
102103
conditions: Optional[str]
103104
foreign_trade: Optional[Dict]
104-
related: Optional[List[str]]
105-
relation: Optional[InvoiceRelation]
105+
related_documents: Optional[List[RelatedDocument]]
106106
pdf_custom_section: Optional[str]
107107
addenda: Optional[str]
108108
namespaces: Optional[Namespace]
@@ -182,7 +182,9 @@ def create(cls, data: InvoiceRequest) -> 'Invoice':
182182
return cast('Invoice', cls._create(**cleaned_data))
183183

184184
@classmethod
185-
def cancel(cls, invoice_id: str, motive: str, substitution: Optional[str] = None) -> 'Invoice':
185+
def cancel(
186+
cls, invoice_id: str, motive: str, substitution: Optional[str] = None
187+
) -> 'Invoice':
186188
"""Cancel an invoice.
187189
188190
Calls a DELETE request on invoice resource.

facturapi/types/exc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from typing import Any, Dict
33

44

5-
class FacturapiException(Exception): ...
5+
class FacturapiException(Exception):
6+
...
67

78

89
class NoResultFound(FacturapiException):

facturapi/types/general.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pydantic import BaseModel
44

5+
from ..types.enums import InvoiceRelation
56
from .validators import sanitize_dict
67

78

@@ -71,3 +72,8 @@ class SanitizedDict(dict):
7172
def __init__(self, *args, **kwargs):
7273
super().__init__(*args, **kwargs)
7374
sanitize_dict(self)
75+
76+
77+
class RelatedDocument(BaseModel):
78+
relationship: InvoiceRelation
79+
documents: List[str] = []

facturapi/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = '0.1.2.dev2' # pragma: no cover
1+
__version__ = '0.1.2.dev3' # pragma: no cover
22
CLIENT_VERSION = __version__

0 commit comments

Comments
 (0)