Skip to content

Commit

Permalink
[FIX] manifest website string
Browse files Browse the repository at this point in the history
[IMP] converted query to orm in get_receivable_line_ids()

[IMP] check if split payment with related field

[FIX] missing contributor name

[ADD] depends to _compute_amount()
  • Loading branch information
ruben-tonetto authored and Borruso committed Sep 7, 2023
1 parent ef93406 commit f2271ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
4 changes: 3 additions & 1 deletion l10n_it_split_payment/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2015 Davide Corio <davide.corio@abstract.it>
# Copyright 2015-2018 Lorenzo Battistini - Agile Business Group
# Copyright 2016 Alessio Gerace - Agile Business Group
# Copyright 2018 Ruben Tonetto (Associazione PNLUG - Gruppo Odoo)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
Expand All @@ -10,7 +11,8 @@
'summary': 'Split Payment',
'author': 'Abstract, Agile Business Group, '
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/l10n-italy/tree/11.0/l10n_it_split_payment',
'website': 'https://github.com/OCA/l10n-italy/tree/11.0/'
'l10n_it_split_payment',
'license': 'AGPL-3',
'depends': [
'account',
Expand Down
21 changes: 6 additions & 15 deletions l10n_it_split_payment/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class AccountInvoice(models.Model):
@api.one
@api.depends(
'invoice_line_ids.price_subtotal', 'tax_line_ids.amount',
'currency_id', 'company_id', 'date_invoice'
'tax_line_ids.amount_rounding',
'currency_id', 'company_id', 'date_invoice', 'type'
)
def _compute_amount(self):
super(AccountInvoice, self)._compute_amount()
Expand Down Expand Up @@ -62,16 +63,9 @@ def _build_debit_line(self):
@api.multi
def get_receivable_line_ids(self):
# return the move line ids with the same account as the invoice self
if not self.id:
return []
query = (
"SELECT l.id "
"FROM account_move_line l, account_invoice i "
"WHERE i.id = %s AND l.move_id = i.move_id "
"AND l.account_id = i.account_id"
)
self._cr.execute(query, (self.id,))
return [row[0] for row in self._cr.fetchall()]
self.ensure_one()
return self.move_id.line_ids.filtered(
lambda r: r.account_id.id == self.account_id.id).ids

@api.multi
def _compute_split_payments(self):
Expand Down Expand Up @@ -101,10 +95,7 @@ def _compute_split_payments(self):
def action_move_create(self):
res = super(AccountInvoice, self).action_move_create()
for invoice in self:
if (
invoice.fiscal_position_id and
invoice.fiscal_position_id.split_payment
):
if invoice.split_payment:
if invoice.type in ['in_invoice', 'in_refund']:
raise UserError(
_("Can't handle supplier invoices with split payment"))
Expand Down

0 comments on commit f2271ba

Please sign in to comment.