diff --git a/account_check/__manifest__.py b/account_check/__manifest__.py index e70caf743..c6beef221 100644 --- a/account_check/__manifest__.py +++ b/account_check/__manifest__.py @@ -30,6 +30,7 @@ 'views/account_chart_template_view.xml', 'security/ir.model.access.csv', 'security/account_check_security.xml', + 'views/account_check_operation_view.xml', ], 'installable': True, 'auto_install': False, diff --git a/account_check/models/account_bank_statement_line.py b/account_check/models/account_bank_statement_line.py index 11d8e5fa4..3cfda15f1 100644 --- a/account_check/models/account_bank_statement_line.py +++ b/account_check/models/account_bank_statement_line.py @@ -12,17 +12,17 @@ class AccountBankStatementLine(models.Model): _inherit = "account.bank.statement.line" - def button_cancel_reconciliation(self): + def action_undo_reconciliation(self): """Delete operation of checks that are debited from statement""" - for st_line in self.filtered("move_name"): - if st_line.journal_entry_ids.filtered( - lambda x: x.payment_id.payment_reference == st_line.move_name + for st_line in self.filtered("payment_ref"): + if st_line.move_id.line_ids.filtered( + lambda x: x.payment_id.ref == st_line.payment_ref ): check_operation = self.env["account.check.operation"].search( [("origin", "=", "account.bank.statement.line,%s" % st_line.id)] ) check_operation.check_id._del_operation(st_line) - return super(AccountBankStatementLine, self).button_cancel_reconciliation() + return super(AccountBankStatementLine, self).action_undo_reconciliation() def process_reconciliation( self, counterpart_aml_dicts=None, payment_aml_rec=None, new_aml_dicts=None diff --git a/account_check/models/account_chart_template.py b/account_check/models/account_chart_template.py index 5334fdfb7..edc868616 100644 --- a/account_check/models/account_chart_template.py +++ b/account_check/models/account_chart_template.py @@ -76,8 +76,8 @@ def _create_bank_journals(self, company, acc_template_ref): "name": "Cheques de Terceros", "type": "cash", "company_id": company.id, - "inbound_payment_method_ids": [(4, received_third_check.id, None)], - "outbound_payment_method_ids": [(4, delivered_third_check.id, None)], + "inbound_payment_method_line_ids": [(4, received_third_check.id, None)], + "outbound_payment_method_line_ids": [(4, delivered_third_check.id, None)], } ) diff --git a/account_check/models/account_check.py b/account_check/models/account_check.py index 3347c55c7..eac02d2f2 100644 --- a/account_check/models/account_check.py +++ b/account_check/models/account_check.py @@ -290,7 +290,7 @@ def _add_operation(self, operation, origin, partner=None, date=False): "* Operation Date: %s\n" "* Last Operation Date: %s" ) - % (rec.id, rec.name, operation, date, rec.operation_ids[-1].date) + % (rec.id, rec.number, operation, date, rec.operation_ids[-1].date) ) vals = { "operation": operation, @@ -457,10 +457,16 @@ def get_third_check_account(self): # hacemos esa verificación account = self.env["account.account"] for rec in self: - credit_account = rec.journal_id.default_credit_account_id - debit_account = rec.journal_id.default_debit_account_id - inbound_methods = rec.journal_id["inbound_payment_method_ids"] - outbound_methods = rec.journal_id["outbound_payment_method_ids"] + credit_account = rec.journal_id.default_account_id.account_type in [ + "liability_payable", + "asset_receivable", + ] + debit_account = rec.journal_id.default_account_id.account_type in [ + "liability_payable", + "asset_receivable", + ] + inbound_methods = rec.journal_id["inbound_payment_method_line_ids"] + outbound_methods = rec.journal_id["outbound_payment_method_line_ids"] # si hay cuenta en diario y son iguales, y si los metodos de pago # y cobro son solamente uno, usamos el del diario, si no, usamos el # de la compañía @@ -615,7 +621,7 @@ def action_create_debit_note(self, operation, partner_type, partner, account): vals["journal_id"] = journal.id or False vals["date"] = action_date move = self.env["account.move"].create(vals) - move.post() + move.action_post() self._add_operation(operation, move, partner, date=action_date) return True @@ -626,9 +632,16 @@ def prepare_new_operation_move_values( self.ensure_one() ref = name amount = self.amount - debit, credit, amount_currency, currency_id = self.env[ - "account.move.line" - ]._compute_amount_fields(amount, self.currency_id, self.company_currency_id) + if self.currency_id == self.company_currency_id: + debit = amount if amount > 0.0 else 0.0 + credit = -amount if amount < 0.0 else 0.0 + amount_currency = 0.0 + currency_id = False + else: + debit = amount > 0.0 and self.company_currency_id.round(amount) or 0.0 + credit = amount < 0.0 and self.company_currency_id.round(-amount) or 0.0 + amount_currency = amount + currency_id = self.currency_id.id if self.company_currency_id != self.currency_id: currency_id = self.currency_id.id else: diff --git a/account_check/models/account_journal.py b/account_check/models/account_journal.py index a5a4f8274..b5326613b 100644 --- a/account_check/models/account_journal.py +++ b/account_check/models/account_journal.py @@ -24,7 +24,6 @@ def create(self, vals_list): issue_checks = self.env.ref("account_check.account_payment_method_issue_check") for r in rec: if issue_checks in r.outbound_payment_method_ids and not r.checkbook_ids: - r._create_checkbook() return rec def _create_checkbook(self): @@ -53,7 +52,7 @@ def _enable_issue_check_on_bank_journals(self): bank_journal._create_checkbook() bank_journal.write( { - "outbound_payment_method_ids": [(4, issue_checks.id, None)], + "outbound_payment_method_line_ids": [(4, issue_checks.id, None)], } ) @@ -90,10 +89,10 @@ def get_journal_dashboard_datas(self): num_checks_to_numerate=num_checks_to_numerate, num_holding_third_checks=len(holding_checks), show_third_checks=( - "received_third_check" in self.inbound_payment_method_ids.mapped("code") + "received_third_check" in self.inbound_payment_method_line_ids.mapped("code") ), show_issue_checks=( - "issue_check" in self.outbound_payment_method_ids.mapped("code") + "issue_check" in self.outbound_payment_method_line_ids.mapped("code") ), num_handed_issue_checks=len(handed_checks), handed_amount=formatLang( diff --git a/account_check/models/account_payment.py b/account_check/models/account_payment.py index 58f17c88e..4b53598e2 100644 --- a/account_check/models/account_payment.py +++ b/account_check/models/account_payment.py @@ -283,7 +283,7 @@ def cancel(self): # de asientos ni cheques if rec.state in ["confirmed", "posted"]: rec.do_checks_operations(cancel=True) - res = super(AccountPayment, self).cancel() + res = super(AccountPayment, self).action_cancel() return res def create_check(self, check_type, operation, bank): @@ -299,13 +299,13 @@ def create_check(self, check_type, operation, bank): "type": self.check_type, "journal_id": self.journal_id.id, "amount": self.amount, - "payment_date": self.check_payment_date, + "date": self.check_payment_date, "currency_id": self.currency_id.id, } check = self.env["account.check"].create(check_vals) self.check_ids = [(4, check.id, False)] - check._add_operation(operation, self, self.partner_id, date=self.payment_date) + check._add_operation(operation, self, self.partner_id, date=self.date) return check def do_checks_operations(self, vals=None, cancel=False): @@ -339,7 +339,7 @@ def do_checks_operations(self, vals=None, cancel=False): # si el cheque es entregado en una transferencia tenemos tres # opciones # TODO we should make this method selectable for transfers - inbound_method = rec.destination_journal_id.inbound_payment_method_ids + inbound_method = rec.destination_journal_id.inbound_payment_method_line_ids # si un solo inbound method y es received third check # entonces consideramos que se esta moviendo el cheque de un diario # al otro @@ -360,10 +360,10 @@ def do_checks_operations(self, vals=None, cancel=False): # get the account before changing the journal on the check vals["account_id"] = rec.check_ids.get_third_check_account().id rec.check_ids._add_operation( - "transfered", rec, False, date=rec.payment_date + "transfered", rec, False, date=rec.date ) rec.check_ids._add_operation( - "holding", rec, False, date=rec.payment_date + "holding", rec, False, date=rec.date ) rec.check_ids.write({"journal_id": rec.destination_journal_id.id}) vals["name"] = _("Transfer checks %s") % ", ".join( @@ -376,7 +376,7 @@ def do_checks_operations(self, vals=None, cancel=False): return None _logger.info("Sold Check") - rec.check_ids._add_operation("sold", rec, False, date=rec.payment_date) + rec.check_ids._add_operation("sold", rec, False, date=rec.date) vals["account_id"] = rec.check_ids.get_third_check_account().id vals["name"] = _("Sell check %s") % ", ".join( rec.check_ids.mapped("name") @@ -390,7 +390,7 @@ def do_checks_operations(self, vals=None, cancel=False): _logger.info("Deposited Check") rec.check_ids._add_operation( - "deposited", rec, False, date=rec.payment_date + "deposited", rec, False, date=rec.date ) vals["account_id"] = rec.check_ids.get_third_check_account().id vals["name"] = _("Deposit checks %s") % ", ".join( @@ -410,7 +410,7 @@ def do_checks_operations(self, vals=None, cancel=False): _logger.info("Delivered Check") rec.check_ids._add_operation( - "delivered", rec, rec.partner_id, date=rec.payment_date + "delivered", rec, rec.partner_id, date=rec.date ) vals["account_id"] = rec.check_ids.get_third_check_account().id vals["name"] = _("Deliver checks %s") % ", ".join( @@ -497,7 +497,7 @@ def post(self): _("Please be sure that check number or name is filled!") ) - res = super(AccountPayment, self).post() + res = super(AccountPayment, self).action_post() return res def _get_liquidity_move_line_vals(self, amount): diff --git a/account_check/views/account_check_operation_view.xml b/account_check/views/account_check_operation_view.xml new file mode 100644 index 000000000..7cc839595 --- /dev/null +++ b/account_check/views/account_check_operation_view.xml @@ -0,0 +1,46 @@ + + + + + account.check.operation.tree + account.check.operation + + + + + + + + + account.check.operation.form + account.check.operation + +
+ + + + + + + + + + + +
+
+
+ + + Çek Operasyonları + account.check.operation + tree,form + + + + +
diff --git a/account_check/views/account_check_view.xml b/account_check/views/account_check_view.xml index f815ceb78..6818554df 100644 --- a/account_check/views/account_check_view.xml +++ b/account_check/views/account_check_view.xml @@ -201,6 +201,8 @@ + + Third Checks @@ -211,11 +213,11 @@ - + parent="menu_account_check_root"/> @@ -226,11 +228,11 @@ {'default_type':'issue_check'} - + parent="menu_account_check_root"/> diff --git a/account_check/views/account_payment_view.xml b/account_check/views/account_payment_view.xml index 113a9b505..c3793acaf 100644 --- a/account_check/views/account_payment_view.xml +++ b/account_check/views/account_payment_view.xml @@ -94,7 +94,7 @@ - + diff --git a/account_check/wizard/account_check_action_wizard.py b/account_check/wizard/account_check_action_wizard.py index f4dccac4c..1caa4e6e9 100644 --- a/account_check/wizard/account_check_action_wizard.py +++ b/account_check/wizard/account_check_action_wizard.py @@ -29,8 +29,13 @@ class AccountCheckActionWizard(models.TransientModel): @api.onchange("journal_id") def onchange_journal_id(self): if self.journal_id: - self.debit_account_id = self.journal_id.default_debit_account_id - self.credit_account_id = self.journal_id.default_credit_account_id + default_account = self.journal_id.default_account_id + if self.journal_id.type in ("bank", "cash"): + self.debit_account_id = default_account + self.credit_account_id = default_account + else: + self.debit_account_id = default_account + self.credit_account_id = default_account def action_confirm(self): self.ensure_one() @@ -55,7 +60,5 @@ def action_confirm(self): ), self.action_type, )() - if len(checks) == 1: - return res - else: - return True + return res if len(checks) == 1 else True + diff --git a/altinkaya_reports/report/report_account_payment.xml b/altinkaya_reports/report/report_account_payment.xml index 02b956668..8816a38d7 100755 --- a/altinkaya_reports/report/report_account_payment.xml +++ b/altinkaya_reports/report/report_account_payment.xml @@ -129,7 +129,7 @@
- + @@ -153,7 +153,7 @@ Bankasına ait seri numaralı - + vadeli çek alınmıştır. @@ -168,20 +168,20 @@ - Nakit + Nakit ÇEK + > ÇEK Kredi Kartı - Ödemesi + > Kredi Kartı + Ödemesi Sanal Pos Ödemesi - Banka Ödemesi + > Sanal Pos Ödemesi + Banka Ödemesi olarak tahsil edilmiştir.

@@ -202,9 +202,9 @@
- + Notlar: - +