Skip to content

Commit

Permalink
Merge PR #135 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by mikevhe18
  • Loading branch information
ssi-bot committed May 13, 2024
2 parents 0025a28 + 3eb80c1 commit 828cd75
Show file tree
Hide file tree
Showing 23 changed files with 800 additions and 0 deletions.
77 changes: 77 additions & 0 deletions ssi_voucher_bank_cash/models/bank_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def _default_type_id(self):
line_ids = fields.One2many(
comodel_name="account.bank_payment_line",
)
line_summary_ids = fields.One2many(
comodel_name="account.bank_payment_line_summary",
)
line_dr_ids = fields.One2many(
comodel_name="account.bank_payment_line",
)
Expand Down Expand Up @@ -76,3 +79,77 @@ class BankPaymentLineTax(models.Model):
related="voucher_line_id.company_currency_id",
store=True,
)


class BankPaymentLineSummary(models.Model):
_name = "account.bank_payment_line_summary"
_inherit = "mixin.account.voucher.line.summary"
_description = "Bank Payment Line Summary"
_auto = False

voucher_id = fields.Many2one(
comodel_name="account.bank_payment",
)

def _select(self):
select_str = """
SELECT
row_number() OVER() as id,
a.voucher_id AS voucher_id,
a.account_id AS account_id,
a.partner_id AS partner_id,
a.currency_id AS currency_id,
SUM(a.amount_before_tax) AS amount_before_tax,
SUM(a.amount_tax) AS amount_tax,
SUM(a.amount_after_tax) AS amount_after_tax
"""
return select_str

def _get_from_table(self):
return "account_bank_payment_line"

def _from(self):
from_str = """
%s AS a
""" % (
self._get_from_table()
)
return from_str

def _where(self):
where_str = """
WHERE 1 = 1
"""
return where_str

def _join(self):
join_str = """
"""
return join_str

def _group_by(self):
group_str = """
GROUP BY a.voucher_id,a.account_id,a.partner_id,a.currency_id
"""
return group_str

def init(self):
# tools.drop_view_if_exists(self._cr, self._table)
# pylint: disable=locally-disabled, sql-injection
self._cr.execute(
"""CREATE or REPLACE VIEW %s as (
%s
FROM %s
%s
%s
%s
)"""
% (
self._table,
self._select(),
self._from(),
self._join(),
self._where(),
self._group_by(),
)
)
77 changes: 77 additions & 0 deletions ssi_voucher_bank_cash/models/bank_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def _default_type_id(self):
line_ids = fields.One2many(
comodel_name="account.bank_receipt_line",
)
line_summary_ids = fields.One2many(
comodel_name="account.bank_receipt_line_summary",
)
line_dr_ids = fields.One2many(
comodel_name="account.bank_receipt_line",
)
Expand Down Expand Up @@ -76,3 +79,77 @@ class BankReceiptLineTax(models.Model):
related="voucher_line_id.company_currency_id",
store=True,
)


class BankReceiptLineSummary(models.Model):
_name = "account.bank_receipt_line_summary"
_inherit = "mixin.account.voucher.line.summary"
_description = "Bank Receipt Line Summary"
_auto = False

voucher_id = fields.Many2one(
comodel_name="account.bank_receipt",
)

def _select(self):
select_str = """
SELECT
row_number() OVER() as id,
a.voucher_id AS voucher_id,
a.account_id AS account_id,
a.partner_id AS partner_id,
a.currency_id AS currency_id,
SUM(a.amount_before_tax) AS amount_before_tax,
SUM(a.amount_tax) AS amount_tax,
SUM(a.amount_after_tax) AS amount_after_tax
"""
return select_str

def _get_from_table(self):
return "account_bank_receipt_line"

def _from(self):
from_str = """
%s AS a
""" % (
self._get_from_table()
)
return from_str

def _where(self):
where_str = """
WHERE 1 = 1
"""
return where_str

def _join(self):
join_str = """
"""
return join_str

def _group_by(self):
group_str = """
GROUP BY a.voucher_id,a.account_id,a.partner_id,a.currency_id
"""
return group_str

def init(self):
# tools.drop_view_if_exists(self._cr, self._table)
# pylint: disable=locally-disabled, sql-injection
self._cr.execute(
"""CREATE or REPLACE VIEW %s as (
%s
FROM %s
%s
%s
%s
)"""
% (
self._table,
self._select(),
self._from(),
self._join(),
self._where(),
self._group_by(),
)
)
77 changes: 77 additions & 0 deletions ssi_voucher_bank_cash/models/cash_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def _default_type_id(self):
line_ids = fields.One2many(
comodel_name="account.cash_payment_line",
)
line_summary_ids = fields.One2many(
comodel_name="account.cash_payment_line_summary",
)
line_dr_ids = fields.One2many(
comodel_name="account.cash_payment_line",
)
Expand Down Expand Up @@ -76,3 +79,77 @@ class CashPaymentLineTax(models.Model):
related="voucher_line_id.company_currency_id",
store=True,
)


class CashPaymentLineSummary(models.Model):
_name = "account.cash_payment_line_summary"
_inherit = "mixin.account.voucher.line.summary"
_description = "Cash Payment Line Summary"
_auto = False

voucher_id = fields.Many2one(
comodel_name="account.cash_payment",
)

def _select(self):
select_str = """
SELECT
row_number() OVER() as id,
a.voucher_id AS voucher_id,
a.account_id AS account_id,
a.partner_id AS partner_id,
a.currency_id AS currency_id,
SUM(a.amount_before_tax) AS amount_before_tax,
SUM(a.amount_tax) AS amount_tax,
SUM(a.amount_after_tax) AS amount_after_tax
"""
return select_str

def _get_from_table(self):
return "account_cash_payment_line"

def _from(self):
from_str = """
%s AS a
""" % (
self._get_from_table()
)
return from_str

def _where(self):
where_str = """
WHERE 1 = 1
"""
return where_str

def _join(self):
join_str = """
"""
return join_str

def _group_by(self):
group_str = """
GROUP BY a.voucher_id,a.account_id,a.partner_id,a.currency_id
"""
return group_str

def init(self):
# tools.drop_view_if_exists(self._cr, self._table)
# pylint: disable=locally-disabled, sql-injection
self._cr.execute(
"""CREATE or REPLACE VIEW %s as (
%s
FROM %s
%s
%s
%s
)"""
% (
self._table,
self._select(),
self._from(),
self._join(),
self._where(),
self._group_by(),
)
)
77 changes: 77 additions & 0 deletions ssi_voucher_bank_cash/models/cash_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def _default_type_id(self):
line_ids = fields.One2many(
comodel_name="account.cash_receipt_line",
)
line_summary_ids = fields.One2many(
comodel_name="account.cash_receipt_line_summary",
)
line_dr_ids = fields.One2many(
comodel_name="account.cash_receipt_line",
)
Expand Down Expand Up @@ -75,3 +78,77 @@ class CashReceiptLineTax(models.Model):
related="voucher_line_id.company_currency_id",
store=True,
)


class CashReceiptLineSummary(models.Model):
_name = "account.cash_receipt_line_summary"
_inherit = "mixin.account.voucher.line.summary"
_description = "Cash Receipt Line Summary"
_auto = False

voucher_id = fields.Many2one(
comodel_name="account.cash_receipt",
)

def _select(self):
select_str = """
SELECT
row_number() OVER() as id,
a.voucher_id AS voucher_id,
a.account_id AS account_id,
a.partner_id AS partner_id,
a.currency_id AS currency_id,
SUM(a.amount_before_tax) AS amount_before_tax,
SUM(a.amount_tax) AS amount_tax,
SUM(a.amount_after_tax) AS amount_after_tax
"""
return select_str

def _get_from_table(self):
return "account_cash_receipt_line"

def _from(self):
from_str = """
%s AS a
""" % (
self._get_from_table()
)
return from_str

def _where(self):
where_str = """
WHERE 1 = 1
"""
return where_str

def _join(self):
join_str = """
"""
return join_str

def _group_by(self):
group_str = """
GROUP BY a.voucher_id,a.account_id,a.partner_id,a.currency_id
"""
return group_str

def init(self):
# tools.drop_view_if_exists(self._cr, self._table)
# pylint: disable=locally-disabled, sql-injection
self._cr.execute(
"""CREATE or REPLACE VIEW %s as (
%s
FROM %s
%s
%s
%s
)"""
% (
self._table,
self._select(),
self._from(),
self._join(),
self._where(),
self._group_by(),
)
)
16 changes: 16 additions & 0 deletions ssi_voucher_bank_cash/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ access_bank_receipt_line_tax_all,account.bank_receipt_line_tax - all,model_accou
access_bank_receipt_line_tax_viewer,account.bank_receipt_line_tax - viewer,model_account_bank_receipt_line_tax,bank_receipt_viewer_group,1,0,0,0
access_bank_receipt_line_tax_user,account.bank_receipt_line_tax - user,model_account_bank_receipt_line_tax,bank_receipt_user_group,1,1,1,1
access_bank_receipt_line_tax_validator,account.bank_receipt_line_tax – validator,model_account_bank_receipt_line_tax,bank_receipt_validator_group,1,1,1,1
access_bank_receipt_line_summary_all,account.bank_receipt_line_summary - all,model_account_bank_receipt_line_summary,,1,0,0,0
access_bank_receipt_line_summary_viewer,account.bank_receipt_line_summary - viewer,model_account_bank_receipt_line_summary,bank_receipt_viewer_group,1,0,0,0
access_bank_receipt_line_summary_user,account.bank_receipt_line_summary - user,model_account_bank_receipt_line_summary,bank_receipt_user_group,1,1,1,1
access_bank_receipt_line_summary_validator,account.bank_receipt_line_summary – validator,model_account_bank_receipt_line_summary,bank_receipt_validator_group,1,1,1,1
access_bank_payment_all,account.bank_payment - all,model_account_bank_payment,,1,0,0,0
access_bank_payment_viewer,account.bank_payment - viewer,model_account_bank_payment,bank_payment_viewer_group,1,0,0,0
access_bank_payment_user,account.bank_payment - user,model_account_bank_payment,bank_payment_user_group,1,1,1,1
Expand All @@ -23,6 +27,10 @@ access_bank_payment_line_tax_all,account.bank_payment_line_tax - all,model_accou
access_bank_payment_line_tax_viewer,account.bank_payment_line_tax - viewer,model_account_bank_payment_line_tax,bank_payment_viewer_group,1,0,0,0
access_bank_payment_line_tax_user,account.bank_payment_line_tax - user,model_account_bank_payment_line_tax,bank_payment_user_group,1,1,1,1
access_bank_payment_line_tax_validator,account.bank_payment_line_tax – validator,model_account_bank_payment_line_tax,bank_payment_validator_group,1,1,1,1
access_bank_payment_line_summary_all,account.bank_payment_line_summary - all,model_account_bank_payment_line_summary,,1,0,0,0
access_bank_payment_line_summary_viewer,account.bank_payment_line_summary - viewer,model_account_bank_payment_line_summary,bank_payment_viewer_group,1,0,0,0
access_bank_payment_line_summary_user,account.bank_payment_line_summary - user,model_account_bank_payment_line_summary,bank_payment_user_group,1,1,1,1
access_bank_payment_line_summary_validator,account.bank_payment_line_summary – validator,model_account_bank_payment_line_summary,bank_payment_validator_group,1,1,1,1
access_cash_receipt_all,account.cash_receipt - all,model_account_cash_receipt,,1,0,0,0
access_cash_receipt_viewer,account.cash_receipt - viewer,model_account_cash_receipt,cash_receipt_viewer_group,1,0,0,0
access_cash_receipt_user,account.cash_receipt - user,model_account_cash_receipt,cash_receipt_user_group,1,1,1,1
Expand All @@ -35,6 +43,10 @@ access_cash_receipt_line_tax_all,account.cash_receipt_line_tax - all,model_accou
access_cash_receipt_line_tax_viewer,account.cash_receipt_line_tax - viewer,model_account_cash_receipt_line_tax,cash_receipt_viewer_group,1,0,0,0
access_cash_receipt_line_tax_user,account.cash_receipt_line_tax - user,model_account_cash_receipt_line_tax,cash_receipt_user_group,1,1,1,1
access_cash_receipt_line_tax_validator,account.cash_receipt_line_tax – validator,model_account_cash_receipt_line_tax,cash_receipt_validator_group,1,1,1,1
access_cash_receipt_line_summary_all,account.cash_receipt_line_summary - all,model_account_cash_receipt_line_summary,,1,0,0,0
access_cash_receipt_line_summary_viewer,account.cash_receipt_line_summary - viewer,model_account_cash_receipt_line_summary,cash_receipt_viewer_group,1,0,0,0
access_cash_receipt_line_summary_user,account.cash_receipt_line_summary - user,model_account_cash_receipt_line_summary,cash_receipt_user_group,1,1,1,1
access_bank_payment_line_summary_validator,account.cash_receipt_line_summary – validator,model_account_cash_receipt_line_summary,cash_receipt_validator_group,1,1,1,1
access_cash_payment_all,account.cash_payment - all,model_account_cash_payment,,1,0,0,0
access_cash_payment_viewer,account.cash_payment - viewer,model_account_cash_payment,cash_payment_viewer_group,1,0,0,0
access_cash_payment_user,account.cash_payment - user,model_account_cash_payment,cash_payment_user_group,1,1,1,1
Expand All @@ -47,3 +59,7 @@ access_cash_payment_line_tax_all,account.cash_payment_line_tax - all,model_accou
access_cash_payment_line_tax_viewer,account.cash_payment_line_tax - viewer,model_account_cash_payment_line_tax,cash_payment_viewer_group,1,0,0,0
access_cash_payment_line_tax_user,account.cash_payment_line_tax - user,model_account_cash_payment_line_tax,cash_payment_user_group,1,1,1,1
access_cash_payment_line_tax_validator,account.cash_payment_line_tax – validator,model_account_cash_payment_line_tax,cash_payment_validator_group,1,1,1,1
access_cash_payment_line_summary_all,account.cash_payment_line_summary - all,model_account_cash_payment_line_summary,,1,0,0,0
access_cash_payment_line_summary_viewer,account.cash_payment_line_summary - viewer,model_account_cash_payment_line_summary,cash_payment_viewer_group,1,0,0,0
access_cash_payment_line_summary_user,account.cash_payment_line_summary - user,model_account_cash_payment_line_summary,cash_payment_user_group,1,1,1,1
access_cash_payment_line_summary_validator,account.cash_payment_line_summary – validator,model_account_cash_payment_line_summary,cash_payment_validator_group,1,1,1,1
Loading

0 comments on commit 828cd75

Please sign in to comment.