Invoice Payment

Added in version 2.4.0.

Requires Pro Edition and Invoices plugin >= 4.1.3.

Manager

All operations on the InvoicePayment resource are provided by its manager. To get access to it you have to call redmine.invoice_payment where redmine is a configured redmine object. See the Configuration about how to configure redmine object.

Create methods

create

redminelib.managers.ResourceManager.create(**fields)

Creates new InvoicePayment resource with given fields and saves it to the Invoices plugin.

Parameters:
  • invoice_id (int) – (required). Invoice id.

  • amount (string) – (required). Payment amount.

  • payment_date (string or date object) – (required). Payment date.

  • description (string) – (optional). Payment description.

  • uploads (list) – (optional). Uploads as [{'': ''}, ...], accepted keys are:

    • path (required). Absolute file path or file-like object that should be uploaded.

    • filename (optional). Name of the file after upload.

    • description (optional). Description of the file.

    • content_type (optional). Content type of the file.

Returns:

Resource object

>>> payment = redmine.invoice_payment.create(
...     invoice_id=6,
...     amount='12.34',
...     payment_date='2023-01-11',
...     description='description',
...     uploads=[{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
... )
>>> payment
<redminelib.resources.InvoicePayment #123>

new

redminelib.managers.ResourceManager.new()

Creates new empty InvoicePayment resource, but saves it to the Invoices plugin only when save() is called, also calls pre_create() and post_create() methods of the Resource object. Valid attributes are the same as for create() method above.

Returns:

Resource object

>>> payment = redmine.invoice_payment.new()
>>> payment.invoice_id = 6
>>> payment.amount = '12.34'
>>> payment.payment_date = '2023-01-11'
>>> payment.description = 'description'
>>> payment.uploads = [{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
>>> payment.save()
<redminelib.resources.InvoicePayment #123>

Read methods

get

redminelib.managers.ResourceManager.get(resource_id, **params)

Returns single InvoicePayment resource from the Invoices plugin by its id.

Parameters:

resource_id (int) – (required). Id of the payment.

Returns:

Resource object

>>> payment = redmine.invoice_payment.get(123)
>>> payment
<redminelib.resources.InvoicePayment #123>

all

redminelib.managers.ResourceManager.all(**params)

Returns all InvoicePayment resources from the Invoices plugin.

Parameters:
  • limit (int) – (optional). How much resources to return.

  • offset (int) – (optional). Starting from what resource to return the other resources.

Returns:

ResourceSet object

>>> payments = redmine.invoice_payment.all(limit=50)
>>> payments
<redminelib.resultsets.ResourceSet object with InvoicePayment resources>

filter

redminelib.managers.ResourceManager.filter(**filters)

Returns InvoicePayment resources that match the given lookup parameters.

Parameters:
  • invoice_id (int) – (optional). Get payments for the given invoice id.

  • contact_id (int) – (optional). Get payments for the given contact id.

  • limit (int) – (optional). How much resources to return.

  • offset (int) – (optional). Starting from what resource to return the other resources.

Returns:

ResourceSet object

>>> payments = redmine.invoice_payment.filter(invoice_id=1, contact_id=1)
>>> payments
<redminelib.resultsets.ResourceSet object with InvoicePayment resources>

Hint

You can also get payments from an Invoice and Contact resource objects directly using payments relation:

>>> invoice = redmine.invoice.get(123)
>>> invoice.payments
<redminelib.resultsets.ResourceSet object with InvoicePayment resources>

Update methods

Not supported by Invoices plugin

Delete methods

delete

redminelib.managers.ResourceManager.delete(resource_id)

Deletes single InvoicePayment resource from the Invoices plugin by its id.

Parameters:
  • resource_id (int) – (required). Payment id.

  • invoice_id (int) – (required). Invoice id which payment belongs to.

Returns:

True

>>> redmine.invoice_payment.delete(123, invoice_id=1)
True
redminelib.resources.InvoicePayment.delete()

Deletes current InvoicePayment resource object from the Invoices plugin.

Returns:

True

>>> payment = redmine.invoice_payment.get(123)
>>> payment.delete()
True

Export

Not supported by Invoices plugin