[IMP]pms: improvemente downpayment descriptions

This commit is contained in:
Darío Lodeiros
2022-11-17 07:36:19 +01:00
parent 95a585c69d
commit c00e2d09ba
3 changed files with 15 additions and 8 deletions

View File

@@ -996,10 +996,18 @@ class FolioSaleLine(models.Model):
should be added to the returned invoice line should be added to the returned invoice line
""" """
self.ensure_one() self.ensure_one()
if self.is_downpayment:
downpayment_invoice = self.folio_id.move_ids.filtered(
lambda x: x.payment_state != "reversed"
and x.line_ids.filtered(lambda l: l.folio_line_ids == self)
)
name = self.name + " (" + downpayment_invoice.name + ")"
else:
name = self.name
res = { res = {
"display_type": self.display_type, "display_type": self.display_type,
"sequence": self.sequence, "sequence": self.sequence,
"name": self.name, "name": name,
"product_id": self.product_id.id, "product_id": self.product_id.id,
"product_uom_id": self.product_uom.id, "product_uom_id": self.product_uom.id,
"quantity": qty if qty else self.qty_to_invoice, "quantity": qty if qty else self.qty_to_invoice,

View File

@@ -2070,7 +2070,7 @@ class PmsFolio(models.Model):
"transaction_ids": [(6, 0, self.transaction_ids.ids)], "transaction_ids": [(6, 0, self.transaction_ids.ids)],
"invoice_line_ids": [], "invoice_line_ids": [],
"company_id": self.company_id.id, "company_id": self.company_id.id,
"payment_reference": self.external_reference or self.reference, "payment_reference": self.name,
} }
return invoice_vals return invoice_vals
@@ -2129,8 +2129,8 @@ class PmsFolio(models.Model):
move._autoreconcile_folio_payments() move._autoreconcile_folio_payments()
# Automatic register payment in cash register # Automatic register payment in cash register
# TODO: no_cash_register to avoid flow in the new api (delete it in the future) # TODO: cash_register to avoid flow in the new api (delete it in the future)
if pay_type == "cash" and not self.env.context.get("no_cash_register"): if pay_type == "cash" and self.env.context.get("cash_register"):
line = self._get_statement_line_vals( line = self._get_statement_line_vals(
journal=journal, journal=journal,
receivable_account=receivable_account, receivable_account=receivable_account,
@@ -2215,8 +2215,8 @@ class PmsFolio(models.Model):
pay.action_post() pay.action_post()
# Automatic register refund in cash register # Automatic register refund in cash register
# TODO: no_cash_register to avoid flow in the new api (delete it in the future) # TODO: cash_register to avoid flow in the new api (delete it in the future)
if pay_type == "cash" and not self.env.context.get("no_cash_register"): if pay_type == "cash" and self.env.context.get("cash_register"):
line = self._get_statement_line_vals( line = self._get_statement_line_vals(
journal=journal, journal=journal,
receivable_account=receivable_account, receivable_account=receivable_account,

View File

@@ -1,6 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details. # Part of Odoo. See LICENSE file for full copyright and licensing details.
import time
from odoo import _, api, fields, models from odoo import _, api, fields, models
from odoo.exceptions import UserError from odoo.exceptions import UserError
@@ -220,7 +219,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
def _prepare_line(self, order, analytic_tag_ids, tax_ids, amount): def _prepare_line(self, order, analytic_tag_ids, tax_ids, amount):
context = {"lang": order.partner_id.lang} context = {"lang": order.partner_id.lang}
so_values = { so_values = {
"name": _("Down Payment: %s") % (time.strftime("%m %Y"),), "name": self.product_id.name,
"price_unit": amount, "price_unit": amount,
"product_uom_qty": 0.0, "product_uom_qty": 0.0,
"folio_id": order.id, "folio_id": order.id,