本文整理汇总了Python中pyavatax.base.Document.new_return_invoice方法的典型用法代码示例。如果您正苦于以下问题:Python Document.new_return_invoice方法的具体用法?Python Document.new_return_invoice怎么用?Python Document.new_return_invoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyavatax.base.Document
的用法示例。
在下文中一共展示了Document.new_return_invoice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_return
# 需要导入模块: from pyavatax.base import Document [as 别名]
# 或者: from pyavatax.base.Document import new_return_invoice [as 别名]
def test_return():
random_doc_code = uuid.uuid4().hex # you can't post/cancel the same doc code over and over
api = get_api()
doc = Document.new_sales_invoice(DocCode=random_doc_code, DocDate=datetime.date.today(), CustomerCode='[email protected]')
to_address = Address(Line1="435 Ericksen Avenue Northeast", Line2="#250", PostalCode="98110")
from_address = Address(Line1="100 Ravine Lane NE", Line2="#220", PostalCode="98110")
doc.add_from_address(from_address)
doc.add_to_address(to_address)
line = Line(Amount=10.00)
doc.add_line(line)
tax = api.post_tax(doc)
assert tax.is_success
assert tax.total_tax > 0
# and return invoice
doc = Document.new_return_invoice(DocCode=random_doc_code, DocDate=datetime.date.today(), CustomerCode='[email protected]')
to_address = Address(Line1="435 Ericksen Avenue Northeast", Line2="#250", PostalCode="98110")
from_address = Address(Line1="100 Ravine Lane NE", Line2="#220", PostalCode="98110")
doc.add_from_address(from_address)
doc.add_to_address(to_address)
line = Line(Amount=-10.00)
doc.add_line(line)
tax_date = datetime.date.today() - datetime.timedelta(days=5)
doc.add_override(TaxOverrideType=TaxOverride.OVERRIDE_DATE, TaxDate=tax_date, Reason="Tax Date change",)
tax = api.post_tax(doc)
assert tax.is_success
assert float(tax.total_tax) < 0