mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: add report proforma routes
This commit is contained in:
@@ -353,3 +353,38 @@ class AccountMove(models.Model):
|
||||
self.folio_ids.message_post(body=mens)
|
||||
raise ValidationError(mens)
|
||||
return True
|
||||
|
||||
def _proforma_access_url(self):
|
||||
self.ensure_one()
|
||||
if self.is_invoice(include_receipts=True):
|
||||
return "/my/invoices/proforma/%s" % (self.id)
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_proforma_portal_url(
|
||||
self,
|
||||
suffix=None,
|
||||
report_type=None,
|
||||
download=None,
|
||||
query_string=None,
|
||||
anchor=None,
|
||||
):
|
||||
"""
|
||||
Get a proforma portal url for this model, including access_token.
|
||||
The associated route must handle the flags for them to have any effect.
|
||||
- suffix: string to append to the url, before the query string
|
||||
- report_type: report_type query string, often one of: html, pdf, text
|
||||
- download: set the download query string to true
|
||||
- query_string: additional query string
|
||||
- anchor: string to append after the anchor #
|
||||
"""
|
||||
self.ensure_one()
|
||||
url = self._proforma_access_url() + "%s?access_token=%s%s%s%s%s" % (
|
||||
suffix if suffix else "",
|
||||
self._portal_ensure_token(),
|
||||
"&report_type=%s" % report_type if report_type else "",
|
||||
"&download=true" if download else "",
|
||||
query_string if query_string else "",
|
||||
"#%s" % anchor if anchor else "",
|
||||
)
|
||||
return url
|
||||
|
||||
@@ -1896,6 +1896,7 @@ class PmsFolio(models.Model):
|
||||
else partner_invoice.invoicing_policy
|
||||
)
|
||||
|
||||
invoice_date = False
|
||||
if date:
|
||||
invoice_date = date
|
||||
if partner_invoice_policy == "checkout":
|
||||
@@ -1926,8 +1927,9 @@ class PmsFolio(models.Model):
|
||||
datetime.date.today().month + 1,
|
||||
month_day,
|
||||
)
|
||||
for vals in invoice_vals_list:
|
||||
vals["invoice_date"] = invoice_date
|
||||
if invoice_date:
|
||||
for vals in invoice_vals_list:
|
||||
vals["invoice_date"] = invoice_date
|
||||
|
||||
# 3) Create invoices.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user