Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dhongu committed Oct 21, 2024
1 parent 3b4e3b2 commit 814cd7e
Show file tree
Hide file tree
Showing 18 changed files with 155 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion .pylintrc-mandatory
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion l10n_ro_cash_register/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions l10n_ro_cash_register/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
from . import wizard
3 changes: 2 additions & 1 deletion l10n_ro_cash_register/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
19 changes: 11 additions & 8 deletions l10n_ro_cash_register/models/account_journal_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down Expand Up @@ -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(
{
Expand All @@ -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)

26 changes: 17 additions & 9 deletions l10n_ro_cash_register/models/cash_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions l10n_ro_cash_register/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion l10n_ro_cash_register/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h1 class="title">Romania - Cash Register</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:bd84ef5da0acda74f54ced4b755ef26bb3ac3d7f2779067283750d99f95e396b
!! source digest: sha256:266e708c0e2783245a81bf63691d48bdbdc3f001aa03fd933da2ac1dfc7fee59
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/l10n-romania/tree/15.0/l10n_ro_cash_register"><img alt="dhongu/l10n-romania" src="https://img.shields.io/badge/github-dhongu%2Fl10n--romania-lightgray.png?logo=github" /></a></p>
<p>Functionalitati</p>
Expand Down
9 changes: 5 additions & 4 deletions l10n_ro_cash_register/views/cash_register_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<button name="action_refresh" string="Refresh" type="object" />
<button name="action_receipt" string="Add Receipt" type="object" />
<button name="action_payment" string="Add Payment" type="object" />
<button name="action_operation" string="Operation" type="object" />
</header>
<sheet>
<div class="oe_title oe_inline">
Expand Down Expand Up @@ -94,16 +95,16 @@

<record id="action_generate_missing_cash_register" model="ir.actions.server">
<field name="name">Generate Missing Cash Register</field>
<field name="model_id" ref="account.model_account_journal"/>
<field name="binding_model_id" ref="account.model_account_journal"/>
<field name="model_id" ref="account.model_account_journal" />
<field name="binding_model_id" ref="account.model_account_journal" />
<field name="state">code</field>
<field name="code">record.generate_missing_cash_register()</field>
</record>

<record id="action_remove_outstanding_accounts" model="ir.actions.server">
<field name="name">Remove Outstanding Accounts</field>
<field name="model_id" ref="account.model_account_journal"/>
<field name="binding_model_id" ref="account.model_account_journal"/>
<field name="model_id" ref="account.model_account_journal" />
<field name="binding_model_id" ref="account.model_account_journal" />
<field name="state">code</field>
<field name="code">record.remove_outstanding_accounts()</field>
</record>
Expand Down
3 changes: 3 additions & 0 deletions l10n_ro_cash_register/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import cash_register_operation
58 changes: 58 additions & 0 deletions l10n_ro_cash_register/wizard/cash_register_operation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from odoo import fields, models


class CashRegisterOperation(models.TransientModel):
_name = "l10n.ro.cash.register.operation"
_description = "Cash Register Operation"

journal_id = fields.Many2one("account.journal", string="Journal", required=True, domain=[("type", "=", "cash")])
currency_id = fields.Many2one(related="journal_id.currency_id", string="Currency", readonly=True)
date = fields.Date(required=True, default=fields.Date.context_today)
amount = fields.Monetary(string="Amount", required=True)
operation = fields.Selection(
[
("in", "Cash In"),
("out", "Cash Out"),
],
string="Operation",
required=True,
)
description = fields.Char(string="Description")

counterpart_account_id = fields.Many2one("account.account", string="Account", required=True)

def default_get(self, fields_list):
defaults = super().default_get(fields_list)
defaults["account_id"] = self.env.company.transfer_account_id.id
return defaults

def action_confirm(self):
# se va genra o nota contabila cu operatia
self.ensure_one()
value = {
"journal_id": self.journal_id.id,
"date": self.date,
"ref": self.description,
"line_ids": [
(
0,
0,
{
"account_id": self.journal_id.default_account_id.id,
"name": self.description,
"debit" if self.operation == "in" else "credit": self.amount,
},
),
(
0,
0,
{
"account_id": self.counterpart_account_id.id,
"name": self.description,
"credit" if self.operation == "in" else "debit": self.amount,
},
),
],
}
move = self.env["account.move"].create(value)
move._post()
36 changes: 36 additions & 0 deletions l10n_ro_cash_register/wizard/cash_register_operation_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<odoo>
<record id="view_cash_register_operation_form" model="ir.ui.view">
<field name="name">cash.register.operation.form</field>
<field name="model">l10n.ro.cash.register.operation</field>
<field name="arch" type="xml">
<form string="Cash Register Operation">
<group>
<group>
<field name="operation" widget="radio" options="{'horizontal': True}" />
<field name="amount" />
<field name="currency_id" invisible="1" />
<field name="description" />
</group>
<group>
<field name="journal_id" />
<field name="date" />
<field name="counterpart_account_id" />
</group>
</group>
<footer>
<button string="Confirm" type="object" name="action_confirm" class="btn-primary" />
<button string="Cancel" class="btn-secondary" special="cancel" />
</footer>
</form>
</field>
</record>

<record id="action_cash_register_operation" model="ir.actions.act_window">
<field name="name">Cash Register Operation</field>
<field name="res_model">l10n.ro.cash.register.operation</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>


</odoo>
2 changes: 1 addition & 1 deletion l10n_ro_edi_ubl_sale_store/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Deltatech Sale from Store UBL
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3d2ecc323744ec424599daed516d383eff82d66ec60b373c09b19f48ff005d48
!! source digest: sha256:82dad9fd93fb19748471db3f4ba19840a80f821af9ff77805380aea4e6d1276b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
Expand Down
2 changes: 1 addition & 1 deletion l10n_ro_edi_ubl_sale_store/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Deltatech Sale from Store UBL",
"version": "15.0.1.0.0",
"author": "Terrabit, Dorin Hongu",
"author": "Terrabit, Dorin Hongu, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-romania",
"summary": "Sale from store",
"category": "Generic Modules",
Expand Down
2 changes: 1 addition & 1 deletion l10n_ro_edi_ubl_sale_store/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h1 class="title">Deltatech Sale from Store UBL</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3d2ecc323744ec424599daed516d383eff82d66ec60b373c09b19f48ff005d48
!! source digest: sha256:82dad9fd93fb19748471db3f4ba19840a80f821af9ff77805380aea4e6d1276b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/l10n-romania/tree/15.0/l10n_ro_edi_ubl_sale_store"><img alt="dhongu/l10n-romania" src="https://img.shields.io/badge/github-dhongu%2Fl10n--romania-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
Expand Down
12 changes: 12 additions & 0 deletions l10n_ro_partner_create_by_vat_openapi/wizard/get_partner_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@ def do_get_data(self):
if not openapi_key:
raise UserError(_("API Key is missing - please contact support service!"))
self.partner_id.button_get_partner_data_openapi()

action = {
"type": "ir.actions.client",
"tag": "display_notification",
"params": {
"title": "Title",
"message": "message",
"sticky": True,
"next": {"type": "ir.actions.act_window_close"},
},
}
return action
4 changes: 2 additions & 2 deletions l10n_ro_stock_account_store/models/stock_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def _create_in_store_svl(self, forced_quantity=None):
# 371 = %
# 378
# 4428
account_diff = self.company_id.l10n_ro_property_stock_picking_payable_account_id
# account_diff = self.company_id.l10n_ro_property_stock_picking_payable_account_id

svls = self.env["stock.valuation.layer"]
# svls = self.env["stock.valuation.layer"]
# move._create_account_move_line(
# acc_dest,
# acc_valuation,
Expand Down

0 comments on commit 814cd7e

Please sign in to comment.