Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pms_api_rest/datamodels/pms_folio_sale_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ class PmsFolioSaleInfo(Datamodel):
displayType = fields.String(required=False, allow_none=True)
defaultInvoiceTo = fields.Integer(required=False, allow_none=True)
isDownPayment = fields.Boolean(required=False, allow_none=True)
sectionId = fields.Integer(required=False, allow_none=True)
7 changes: 7 additions & 0 deletions pms_api_rest/services/pms_folio_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,7 @@ def get_folio_sale_lines(self, folio_id):
if sale_line.default_invoice_to
else None,
isDownPayment=sale_line.is_downpayment,
sectionId= sale_line.section_id.id
)
)

Expand Down Expand Up @@ -1528,6 +1529,12 @@ def create_folio_invoices(self, folio_id, invoice_info):
if line.section_id and line.section_id.id not in sale_lines_to_invoice.ids:
sale_lines_to_invoice |= line.section_id
lines_to_invoice_dict[line.section_id.id] = 0
line_notes = self.env["folio.sale.line"].sudo().search([
("display_type", "=", "line_note"),
]).filtered(lambda l: l.section_id in sale_lines_to_invoice)
for line_note in line_notes:
if line_note.id not in lines_to_invoice_dict:
lines_to_invoice_dict[line_note.id] = 0
folios_to_invoice = sale_lines_to_invoice.folio_id
invoices = folios_to_invoice._create_invoices(
lines_to_invoice=lines_to_invoice_dict,
Expand Down
3 changes: 1 addition & 2 deletions pms_api_rest/services/pms_invoice_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,6 @@ def _get_invoice_lines_commands(self, invoice, pms_invoice_info):
)
.mapped("section_id.id")
)
pms_api_check_access(user=self.env.user, records=new_section_ids)
if new_section_ids:
lines_to_invoice.update(
{section_id: 0 for section_id in new_section_ids}
Expand All @@ -650,7 +649,7 @@ def _get_invoice_lines_commands(self, invoice, pms_invoice_info):
)
][0]
# Update name of new invoice lines
for item in filter(lambda l: not l[2]["display_type"], new_invoice_lines):
for item in filter(lambda l: not l[2].get("display_type"), new_invoice_lines):
item[2]["name"] = [
line.name
for line in newInvoiceLinesInfo
Expand Down
Loading