Skip to content

Commit 85e38de

Browse files
committed
task Journal modify 0.1
1 parent 67e0eb2 commit 85e38de

33 files changed

+198
-97
lines changed

README.md

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1 @@
1-
2-
[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/currency&target_branch=15.0)
3-
[![Pre-commit Status](https://github.com/OCA/currency/actions/workflows/pre-commit.yml/badge.svg?branch=15.0)](https://github.com/OCA/currency/actions/workflows/pre-commit.yml?query=branch%3A15.0)
4-
[![Build Status](https://github.com/OCA/currency/actions/workflows/test.yml/badge.svg?branch=15.0)](https://github.com/OCA/currency/actions/workflows/test.yml?query=branch%3A15.0)
5-
[![codecov](https://codecov.io/gh/OCA/currency/branch/15.0/graph/badge.svg)](https://codecov.io/gh/OCA/currency)
6-
[![Translation Status](https://translation.odoo-community.org/widgets/currency-15-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/currency-15-0/?utm_source=widget)
7-
8-
<!-- /!\ do not modify above this line -->
9-
10-
# currency
11-
12-
TODO: add repo description.
13-
14-
<!-- /!\ do not modify below this line -->
15-
16-
<!-- prettier-ignore-start -->
17-
18-
[//]: # (addons)
19-
20-
Available addons
21-
----------------
22-
addon | version | maintainers | summary
23-
--- | --- | --- | ---
24-
[currency_rate_update](currency_rate_update/) | 15.0.1.2.0 | | Update exchange rates using OCA modules
25-
[currency_rate_update_xe](currency_rate_update_xe/) | 15.0.1.0.0 | | Update exchange rates using XE.com
26-
27-
[//]: # (end addons)
28-
29-
<!-- prettier-ignore-end -->
30-
31-
## Licenses
32-
33-
This repository is licensed under [AGPL-3.0](LICENSE).
34-
35-
However, each module can have a totally different license, as long as they adhere to Odoo Community Association (OCA)
36-
policy. Consult each module's `__manifest__.py` file, which contains a `license` key
37-
that explains its license.
38-
39-
----
40-
OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit
41-
organization whose mission is to support the collaborative development of Odoo features
42-
and promote its widespread use.
1+
This is a training module that I play with during the study of odoo framework

custom_journal/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from . import account_journal

custom_journal/__manifest__.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding: utf-8 -*-
2+
3+
{
4+
'name': 'Custom Journal',
5+
'version': '16.0',
6+
'category': 'Accounting',
7+
'website': 'https://royalconsultants.net',
8+
'license': 'OPL-1',
9+
'author': 'RoyalConsultants',
10+
'summary': 'Add Approval cycle for invoices & refuse reason',
11+
'depends': [
12+
'account',
13+
],
14+
'data': [
15+
'account_journal_form.xml',
16+
],
17+
}

custom_journal/account_journal.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from odoo import models, fields, api
4+
5+
class AccountJournal(models.Model):
6+
7+
# ---------------------------------------- Private Attributes ---------------------------------
8+
9+
_inherit = "account.journal"
10+
11+
# --------------------------------------- Fields Declaration ----------------------------------
12+
13+
# Basic
14+
cash_in = fields.Boolean("Cash in")
15+
cash_out = fields.Boolean("Cash out")
16+
17+
# ----------------------------------- Constrains and Onchanges --------------------------------
18+
19+
@api.onchange("cash_in")
20+
def _onchange_cash_in(self):
21+
if self.cash_in:
22+
self.cash_out = False
23+
24+
@api.onchange("cash_out")
25+
def _onchange_cash_out(self):
26+
if self.cash_out:
27+
self.cash_in = False
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<odoo>
4+
<record id="view_account_journal_form" model="ir.ui.view">
5+
<field name="name">account.journal.form</field>
6+
<field name="model">account.journal</field>
7+
<field name="inherit_id" ref="account.view_account_journal_form"/>
8+
<field name="arch" type="xml">
9+
<field name="type" position="after">
10+
<field name="cash_in" attrs="{'invisible': [('type', 'not in', ['cash'])]}"/>
11+
<field name="cash_out" attrs="{'invisible': [('type', 'not in', ['cash'])]}"/>
12+
</field>
13+
</field>
14+
</record>
15+
</odoo>

estate_account/__manifest__.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
# manifest file consists of a dictionary which must include
1+
# -*- coding: utf-8 -*-
2+
3+
# manifest file consists of a dictionary which must include
24
# two necessary fields (name field, depends field).
3-
# Test for archiving files into odoo15@probook
5+
46
{
5-
'name': "Estate Account",
6-
'depends': ["base", "account"],
7-
'application': "True",
7+
'name': "Real Estate Accounting",
8+
'depends': ["estate", "account"],
9+
810
'license': "LGPL-3",
9-
'data': ['security/ir.model.access.csv', 'views/menu_tree.xml'],
1011
}
1112

12-
# account_edi
13-
14-
# 'views/account_account_views.xml', \
15-
# 'views/chart_template.xml', 'views/account_journal_views.xml', \
16-
# 'views/account_journal_dashboard_view.xml',
13+
# 'auto_install': "True",

estate_account/models/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# -*- coding: utf-8 -*-
22
# Import all models defining files
33

4-
from . import res_company, res_bank, res_partner_bank, account_reconcile_model, \
5-
account_account, account_chart_template, account_journal, res_partner, account_move, ir_asset
4+
from . import estate_property
Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,42 @@
11
# -*- coding: utf-8 -*-
22
# Defining New Class of the Real Estate Property Model
33

4-
from odoo import fields, models, api
4+
from odoo import models, Command
55

66

7-
class Property(models.Model):
8-
_inherit = "estate.property"
9-
10-
11-
def action_property_sold(self):
12-
13-
"""Adding small functionality to the action"""
14-
15-
partner_name = self.partner_id.display_name
16-
partner_id = self.partner_id.id
17-
company_name = self.user_id.company_id.display_name
18-
company_id = self.env['res.company'].browse([self.user_id.id]).id
19-
20-
journal_vals = {'name': "General Journal for X Company",
21-
'code': "GJXC",
22-
'type': "sale",
23-
'invoice_reference_type': "invoice",
24-
'invoice_reference_model': "odoo",
25-
'company_id': self.user_id.company_id.id,
26-
}
27-
28-
#import pdb; pdb.set_trace()
29-
self.env['account.journal'].create(journal_vals)
30-
#journal_id = self.env['account.journal'].browse([self.partner_id.parent_id.id]).id
31-
32-
33-
invoice_vals = {'partner_id': self.partner_id.id,
34-
'state': "draft",
35-
'move_type': 'out_invoice',
36-
'journal_id': 1,
37-
'company_id': self.user_id.company_id.id,
38-
}
39-
40-
41-
self.env['account.move'].with_context(default_move_type='out_invoice').create(invoice_vals)
42-
43-
return super().action_property_sold()
7+
class EstateProperty(models.Model):
448

9+
# ---------------------------------------- Private Attributes ---------------------------------
4510

46-
class Move(models.Model):
47-
_inherit = "account.move"
11+
_inherit = "estate.property"
4812

13+
# ---------------------------------------- Action Methods -------------------------------------
4914

50-
class Journal(models.Model):
51-
_inherit = "account.journal"
15+
def action_sold(self):
16+
17+
"""Adding small functionality to the action"""
18+
res = super().action_sold()
19+
journal = self.env["account.journal"].search([("type", "=", "sale")], limit=1)
20+
# Another way to get the journal:
21+
# journal = self.env["account.move"].with_context(default_move_type="out_invoice")._get_default_journal()
22+
for prop in self:
23+
self.env["account.move"].create(
24+
{
25+
"partner_id": prop.buyer_id.id,
26+
"move_type": "out_invoice",
27+
"journal_id": journal.id,
28+
"invoice_line_ids": [
29+
Command.create({
30+
"name": prop.name,
31+
"quantity": 1.0,
32+
"price_unit": prop.selling_price * 6.0 / 100.0,
33+
}),
34+
Command.create({
35+
"name": "Administrative fees",
36+
"quantity": 1.0,
37+
"price_unit": 100.0,
38+
}),
39+
],
40+
}
41+
)
42+
return res

financial_accounting/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# -*- coding: utf-8 -*-
2+
# Import all models
3+
4+
from . import models

financial_accounting/__manifest__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# manifest file consists of a dictionary which must include
2+
# two necessary fields (name field, depends field).
3+
# Test for archiving files into odoo15@probook
4+
{
5+
'name': "Estate Account",
6+
'depends': ["base", "account"],
7+
'application': "True",
8+
'license': "LGPL-3",
9+
'data': ['security/ir.model.access.csv', 'views/menu_tree.xml'],
10+
}
11+
12+
# account_edi
13+
14+
# 'views/account_account_views.xml', \
15+
# 'views/chart_template.xml', 'views/account_journal_views.xml', \
16+
# 'views/account_journal_dashboard_view.xml',

0 commit comments

Comments
 (0)