diff --git a/.pylintrc b/.pylintrc index 5c967e61..a1947e66 100644 --- a/.pylintrc +++ b/.pylintrc @@ -7,7 +7,7 @@ readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/templat manifest_required_authors=Odoo Community Association (OCA) manifest_required_keys=license manifest_deprecated_keys=description,active -license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 +license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,OPL-1 valid_odoo_versions=15.0 [MESSAGES CONTROL] diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 0b1d8175..49e98f5b 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -7,7 +7,7 @@ readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/templat manifest_required_authors=Odoo Community Association (OCA) manifest_required_keys=license manifest_deprecated_keys=description,active -license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3 +license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3,OPL-1 valid_odoo_versions=15.0 [MESSAGES CONTROL] diff --git a/l10n_ro_cash_register/README.rst b/l10n_ro_cash_register/README.rst index b5c4ceab..8a405908 100644 --- a/l10n_ro_cash_register/README.rst +++ b/l10n_ro_cash_register/README.rst @@ -7,7 +7,7 @@ Romania - Cash Register !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:bd84ef5da0acda74f54ced4b755ef26bb3ac3d7f2779067283750d99f95e396b + !! source digest: sha256:266e708c0e2783245a81bf63691d48bdbdc3f001aa03fd933da2ac1dfc7fee59 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/l10n_ro_cash_register/__init__.py b/l10n_ro_cash_register/__init__.py index c72966fe..1000d1df 100644 --- a/l10n_ro_cash_register/__init__.py +++ b/l10n_ro_cash_register/__init__.py @@ -1,3 +1,4 @@ # # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models +from . import wizard diff --git a/l10n_ro_cash_register/__manifest__.py b/l10n_ro_cash_register/__manifest__.py index 8e3c0e6f..134bc885 100644 --- a/l10n_ro_cash_register/__manifest__.py +++ b/l10n_ro_cash_register/__manifest__.py @@ -1,7 +1,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "Romania - Cash Register", - "version": "15.0.1.0.0", + "version": "15.0.1.0.1", "author": "Terrabit," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/l10n-romania", "category": "Romania Adaptation", @@ -11,6 +11,7 @@ "views/cash_register_views.xml", "security/ir.model.access.csv", "security/cash_register_security.xml", + "wizard/cash_register_operation_view.xml", "views/report_cash_register.xml", ], "license": "AGPL-3", diff --git a/l10n_ro_cash_register/models/account_journal_dashboard.py b/l10n_ro_cash_register/models/account_journal_dashboard.py index 9115773c..7de2a098 100644 --- a/l10n_ro_cash_register/models/account_journal_dashboard.py +++ b/l10n_ro_cash_register/models/account_journal_dashboard.py @@ -17,7 +17,6 @@ def open_action(self): return action return super().open_action() - def generate_missing_cash_register(self): """Generate missing cash registers for all cash journals and for all moves""" @@ -45,7 +44,9 @@ def generate_missing_cash_register(self): for row in self.env.cr.dictfetchall(): date = row["date"] # verificam daca exista deja un registru de casa pentru aceasta data - cash_register = self.env["l10n.ro.cash.register"].search([("journal_id", "=", journal.id), ("date", "=", date)]) + cash_register = self.env["l10n.ro.cash.register"].search( + [("journal_id", "=", journal.id), ("date", "=", date)] + ) if not cash_register: cash_register.create( { @@ -61,21 +62,23 @@ def remove_outstanding_accounts(self): for journal in self: if journal.type != "cash": continue - lines = self.outbound_payment_method_line_ids + self.inbound_payment_method_line_ids + lines = self.outbound_payment_method_line_ids + self.inbound_payment_method_line_ids for line in lines: - account_id = line.payment_account_id.id or self.company_id.account_journal_payment_debit_account_id.id + account_id = line.payment_account_id.id or self.company_id.account_journal_payment_debit_account_id.id if account_id == journal.default_account_id.id: continue journal._remove_outstanding_account(account_id) line.write({"payment_account_id": journal.default_account_id.id}) def _remove_outstanding_account(self, account_id): - param = {'old_account': account_id, 'journal_id': self.id, 'new_account': self.default_account_id.id} - sql = """ + param = {"old_account": account_id, "journal_id": self.id, "new_account": self.default_account_id.id} + sql = ( + """ UPDATE account_move_line SET account_id = %(new_account)s WHERE account_id = %(old_account)s AND journal_id = %(journal_id)s - """"" + """ + "" + ) self.env.cr.execute(sql, param) - diff --git a/l10n_ro_cash_register/models/cash_register.py b/l10n_ro_cash_register/models/cash_register.py index 75b390f2..389ed1c5 100644 --- a/l10n_ro_cash_register/models/cash_register.py +++ b/l10n_ro_cash_register/models/cash_register.py @@ -43,11 +43,7 @@ def _get_default_journal_id(self): balance_start = fields.Monetary(string="Starting Balance", compute="_compute_balance_start", store=True) # Balance end is calculated based on the statement line amounts and real starting balance. - balance_end = fields.Monetary( - string="Computed Balance", - compute="_compute_balance_end", - store=True - ) + balance_end = fields.Monetary(string="Computed Balance", compute="_compute_balance_end", store=True) move_ids = fields.Many2many("account.move", string="Journal Items", compute="_compute_move_ids") move_line_ids = fields.Many2many("account.move.line", string="Journal Items", compute="_compute_move_ids") @@ -90,8 +86,6 @@ def _onchange_journal_id(self): if self.journal_id: self.currency_id = self.journal_id.currency_id or self.env.company.currency_id - - @api.depends("date", "journal_id") def _compute_move_ids(self): for record in self: @@ -156,12 +150,26 @@ def action_refresh(self): def action_receipt(self): action = self.journal_id.open_payments_action("inbound", "form") - action["context"].update({"default_journal_id": self.journal_id.id}) + action["context"].update( + { + "default_journal_id": self.journal_id.id, + "default_date": self.date, + } + ) action["target"] = "new" return action def action_payment(self): action = self.journal_id.open_payments_action("outbound", "form") - action["context"].update({"default_journal_id": self.journal_id.id}) + action["context"].update({"default_journal_id": self.journal_id.id, "default_date": self.date}) + action["target"] = "new" + return action + + def action_operation(self): + action = self.env["ir.actions.actions"]._for_xml_id("l10n_ro_cash_register.action_cash_register_operation") + action["context"] = { + "default_journal_id": self.journal_id.id, + "default_date": self.date, + } action["target"] = "new" return action diff --git a/l10n_ro_cash_register/security/ir.model.access.csv b/l10n_ro_cash_register/security/ir.model.access.csv index 78152886..835d31d4 100644 --- a/l10n_ro_cash_register/security/ir.model.access.csv +++ b/l10n_ro_cash_register/security/ir.model.access.csv @@ -1,2 +1,3 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_l10n_ro_cash_register_user,cash_register user,model_l10n_ro_cash_register,account.group_account_manager,1,1,1,1 +.access_l10n_ro_cash_register_operation,access_l10n_ro_cash_register_operation,model_l10n_ro_cash_register_operation,account.group_account_manager,1,1,1,1 diff --git a/l10n_ro_cash_register/static/description/index.html b/l10n_ro_cash_register/static/description/index.html index 279fce5e..8a22bfaf 100644 --- a/l10n_ro_cash_register/static/description/index.html +++ b/l10n_ro_cash_register/static/description/index.html @@ -368,7 +368,7 @@

Romania - Cash Register

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:bd84ef5da0acda74f54ced4b755ef26bb3ac3d7f2779067283750d99f95e396b +!! source digest: sha256:266e708c0e2783245a81bf63691d48bdbdc3f001aa03fd933da2ac1dfc7fee59 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 dhongu/l10n-romania

Functionalitati

diff --git a/l10n_ro_cash_register/views/cash_register_views.xml b/l10n_ro_cash_register/views/cash_register_views.xml index 7e5f2048..bf233b1d 100644 --- a/l10n_ro_cash_register/views/cash_register_views.xml +++ b/l10n_ro_cash_register/views/cash_register_views.xml @@ -26,6 +26,7 @@