[IMP] pre-commit: first run on whole repo
This commit is contained in:
@@ -7,22 +7,22 @@ from odoo.tools import float_round
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_inherit = 'account.payment'
|
||||
_inherit = "account.payment"
|
||||
|
||||
sale_id = fields.Many2one('sale.order', string='Sale Order')
|
||||
sale_id = fields.Many2one("sale.order", string="Sale Order")
|
||||
|
||||
def action_validate_invoice_payment(self):
|
||||
if self.sale_id:
|
||||
self.post()
|
||||
else:
|
||||
return super(AccountPayment, self).\
|
||||
action_validate_invoice_payment()
|
||||
return super(AccountPayment, self).action_validate_invoice_payment()
|
||||
|
||||
def _get_counterpart_move_line_vals(self, invoice=False):
|
||||
res = super(AccountPayment, self)._get_counterpart_move_line_vals(
|
||||
invoice=invoice)
|
||||
invoice=invoice
|
||||
)
|
||||
if self.sale_id:
|
||||
res['sale_id'] = self.sale_id.id
|
||||
res["sale_id"] = self.sale_id.id
|
||||
return res
|
||||
|
||||
|
||||
@@ -31,29 +31,33 @@ class AccountAbstractPayment(models.AbstractModel):
|
||||
|
||||
def default_get(self, fields_list):
|
||||
res = super(AccountAbstractPayment, self).default_get(fields_list)
|
||||
if (
|
||||
self._context.get('active_model') == 'sale.order' and
|
||||
self._context.get('active_id')):
|
||||
so = self.env['sale.order'].browse(self._context['active_id'])
|
||||
res.update({
|
||||
'amount': so.amount_total,
|
||||
'currency_id': so.currency_id.id,
|
||||
'payment_type': 'inbound',
|
||||
'partner_id': so.partner_invoice_id.commercial_partner_id.id,
|
||||
'partner_type': 'customer',
|
||||
'communication': so.name,
|
||||
'sale_id': so.id,
|
||||
})
|
||||
if self._context.get("active_model") == "sale.order" and self._context.get(
|
||||
"active_id"
|
||||
):
|
||||
so = self.env["sale.order"].browse(self._context["active_id"])
|
||||
res.update(
|
||||
{
|
||||
"amount": so.amount_total,
|
||||
"currency_id": so.currency_id.id,
|
||||
"payment_type": "inbound",
|
||||
"partner_id": so.partner_invoice_id.commercial_partner_id.id,
|
||||
"partner_type": "customer",
|
||||
"communication": so.name,
|
||||
"sale_id": so.id,
|
||||
}
|
||||
)
|
||||
return res
|
||||
|
||||
def _compute_payment_amount(self, invoices=None, currency=None):
|
||||
amount = super(AccountAbstractPayment, self)._compute_payment_amount(
|
||||
invoices=invoices, currency=currency)
|
||||
invoices=invoices, currency=currency
|
||||
)
|
||||
if self.sale_id:
|
||||
payment_currency = currency
|
||||
if not payment_currency:
|
||||
payment_currency = self.sale_id.currency_id
|
||||
amount = float_round(
|
||||
self.sale_id.amount_total - self.sale_id.amount_down_payment,
|
||||
precision_rounding=payment_currency.rounding)
|
||||
precision_rounding=payment_currency.rounding,
|
||||
)
|
||||
return amount
|
||||
|
||||
Reference in New Issue
Block a user