Browse Source

Mar 8 : [IMP] Anglo saxon accounting feature added 'base_accounting_kit'

pull/249/head
AjmalCybro 2 years ago
parent
commit
b4f63aa844
  1. 4
      base_accounting_kit/__manifest__.py
  2. 5
      base_accounting_kit/doc/RELEASE_NOTES.md
  3. 15
      base_accounting_kit/models/account_asset.py
  4. 20
      base_accounting_kit/models/account_payment.py
  5. 3
      base_accounting_kit/models/res_config_settings.py
  6. 1277
      base_accounting_kit/static/description/index.html
  7. 1
      base_accounting_kit/views/account_asset_views.xml
  8. 6
      base_accounting_kit/views/account_payment_view.xml
  9. 14
      base_accounting_kit/views/res_config_view.xml

4
base_accounting_kit/__manifest__.py

@ -22,7 +22,7 @@
{ {
'name': 'Odoo 16 Full Accounting Kit', 'name': 'Odoo 16 Full Accounting Kit',
'version': '16.0.1.0.0', 'version': '16.0.2.0.0',
'category': 'Accounting', 'category': 'Accounting',
'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs', 'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs',
'summary': """ Asset and Budget Management, 'summary': """ Asset and Budget Management,
@ -50,7 +50,7 @@
'website': "https://www.cybrosys.com", 'website': "https://www.cybrosys.com",
'company': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions',
'maintainer': 'Cybrosys Techno Solutions', 'maintainer': 'Cybrosys Techno Solutions',
'depends': ['base', 'account', 'sale', 'account_check_printing', 'base_account_budget','analytic','website'], 'depends': ['base', 'account', 'sale', 'account_check_printing', 'base_account_budget','analytic'],
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'security/security.xml', 'security/security.xml',

5
base_accounting_kit/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 16.0.1.0.0 #### Version 16.0.1.0.0
#### ADD #### ADD
- Initial commit for Odoo 16 accounting - Initial commit for Odoo 16 accounting
#### 08.03.2023
#### Version 16.0.2.0.0
#### IMP
- Added Anglo Saxon Accounting Feature

15
base_accounting_kit/models/account_asset.py

@ -26,6 +26,7 @@ from datetime import date, datetime
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, _ from odoo import api, fields, models, _
from odoo.addons.base.models.decimal_precision import dp
from odoo.exceptions import UserError, ValidationError from odoo.exceptions import UserError, ValidationError
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
from odoo.tools import float_compare, float_is_zero from odoo.tools import float_compare, float_is_zero
@ -39,6 +40,12 @@ class AccountAssetCategory(models.Model):
name = fields.Char(required=True, index=True, string="Asset Type") name = fields.Char(required=True, index=True, string="Asset Type")
company_id = fields.Many2one('res.company', string='Company', company_id = fields.Many2one('res.company', string='Company',
required=True, default=lambda self: self.env.company) required=True, default=lambda self: self.env.company)
price=fields.Monetary(string='Price',required=True)
currency_id=fields.Many2one("res.currency",
default=lambda self: self.env
['res.currency'].search([
('name', '=', 'USD')]).id,
readonly=True, hide=True)
account_analytic_id = fields.Many2one('account.analytic.account', account_analytic_id = fields.Many2one('account.analytic.account',
string='Analytic Account',domain="[('company_id', '=', company_id)]") string='Analytic Account',domain="[('company_id', '=', company_id)]")
account_asset_id = fields.Many2one('account.account', account_asset_id = fields.Many2one('account.account',
@ -240,7 +247,9 @@ class AccountAssetAsset(models.Model):
# @api.model # @api.model
# def _cron_generate_entries(self): # def _cron_generate_entries(self):
# self.compute_generated_entries(datetime.today()) # self.compute_generated_entries(datetime.today())
@api.onchange('category_id')
def gross_value(self):
self.value=self.category_id.price
@api.model @api.model
def compute_generated_entries(self, date, asset_type=None): def compute_generated_entries(self, date, asset_type=None):
# Entries generated : one by grouped category and one by asset from ungrouped category # Entries generated : one by grouped category and one by asset from ungrouped category
@ -408,7 +417,7 @@ class AccountAssetAsset(models.Model):
'asset_id': self.id, 'asset_id': self.id,
'sequence': sequence, 'sequence': sequence,
'name': (self.code or '') + '/' + str(sequence), 'name': (self.code or '') + '/' + str(sequence),
'remaining_value': residual_amount, 'remaining_value': residual_amount if residual_amount>=0 else 0.0,
'depreciated_value': self.value - ( 'depreciated_value': self.value - (
self.salvage_value + residual_amount), self.salvage_value + residual_amount),
'depreciation_date': depreciation_date.strftime(DF), 'depreciation_date': depreciation_date.strftime(DF),
@ -451,6 +460,8 @@ class AccountAssetAsset(models.Model):
fields)) fields))
asset.message_post(subject=_('Asset created'), asset.message_post(subject=_('Asset created'),
tracking_value_ids=tracking_value_ids) tracking_value_ids=tracking_value_ids)
self.set_to_close()
def _get_disposal_moves(self): def _get_disposal_moves(self):
move_ids = [] move_ids = []

20
base_accounting_kit/models/account_payment.py

@ -53,6 +53,7 @@ class AccountRegisterPayments(models.TransientModel):
return res return res
class AccountPayment(models.Model): class AccountPayment(models.Model):
_inherit = "account.payment" _inherit = "account.payment"
@ -90,26 +91,26 @@ class AccountPayment(models.Model):
sent and call print_checks() """ sent and call print_checks() """
# Since this method can be called via a client_action_multi, we # Since this method can be called via a client_action_multi, we
# need to make sure the received records are what we expect # need to make sure the received records are what we expect
self = self.filtered(lambda r: selfs = self.filtered(lambda r:
r.payment_method_id.code r.payment_method_id.code
in ['check_printing', 'pdc'] in ['check_printing', 'pdc']
and r.state != 'reconciled') and r.state != 'reconciled')
if len(self) == 0: if len(selfs) == 0:
raise UserError(_( raise UserError(_(
"Payments to print as a checks must have 'Check' " "Payments to print as a checks must have 'Check' "
"or 'PDC' selected as payment method and " "or 'PDC' selected as payment method and "
"not have already been reconciled")) "not have already been reconciled"))
if any(payment.journal_id != self[0].journal_id for payment in self): if any(payment.journal_id != selfs[0].journal_id for payment in selfs):
raise UserError(_( raise UserError(_(
"In order to print multiple checks at once, they " "In order to print multiple checks at once, they "
"must belong to the same bank journal.")) "must belong to the same bank journal."))
if not self[0].journal_id.check_manual_sequencing: if not selfs[0].journal_id.check_manual_sequencing:
# The wizard asks for the number printed on the first # The wizard asks for the number printed on the first
# pre-printed check so payments are attributed the # pre-printed check so payments are attributed the
# number of the check the'll be printed on. # number of the check the'll be printed on.
last_printed_check = self.search([ last_printed_check = selfs.search([
('journal_id', '=', self[0].journal_id.id), ('journal_id', '=', selfs[0].journal_id.id),
('check_number', '!=', "0")], order="check_number desc", ('check_number', '!=', "0")], order="check_number desc",
limit=1) limit=1)
next_check_number = last_printed_check and int( next_check_number = last_printed_check and int(
@ -145,6 +146,11 @@ class AccountPayment(models.Model):
line[2]['date_maturity'] = self.effective_date line[2]['date_maturity'] = self.effective_date
return res return res
def mark_as_sent(self):
self.write({'is_move_sent': True})
def unmark_as_sent(self):
self.write({'is_move_sent': False})
class AccountPaymentMethod(models.Model): class AccountPaymentMethod(models.Model):
_inherit = "account.payment.method" _inherit = "account.payment.method"
@ -153,4 +159,4 @@ class AccountPaymentMethod(models.Model):
def _get_payment_method_information(self): def _get_payment_method_information(self):
res = super()._get_payment_method_information() res = super()._get_payment_method_information()
res['pdc'] = {'mode': 'multi', 'domain': [('type', '=', 'bank')]} res['pdc'] = {'mode': 'multi', 'domain': [('type', '=', 'bank')]}
return res return res

3
base_accounting_kit/models/res_config_settings.py

@ -28,6 +28,9 @@ class ResConfigSettings(models.TransientModel):
customer_credit_limit = fields.Boolean(string="Customer Credit Limit") customer_credit_limit = fields.Boolean(string="Customer Credit Limit")
use_anglo_saxon_accounting = fields.Boolean(string="Use Anglo-Saxon accounting", readonly=False,
related='company_id.anglo_saxon_accounting')
@api.model @api.model
def get_values(self): def get_values(self):
res = super(ResConfigSettings, self).get_values() res = super(ResConfigSettings, self).get_values()

1277
base_accounting_kit/static/description/index.html

File diff suppressed because it is too large

1
base_accounting_kit/views/account_asset_views.xml

@ -22,6 +22,7 @@
<group> <group>
<field name="type" invisible="1"/> <field name="type" invisible="1"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/> <field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="price"/>
</group> </group>
<group string="Journal Entries"> <group string="Journal Entries">
<field name="journal_id"/> <field name="journal_id"/>

6
base_accounting_kit/views/account_payment_view.xml

@ -5,6 +5,10 @@
<field name="model">account.payment</field> <field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_form"/> <field name="inherit_id" ref="account.view_account_payment_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="after">
<widget name="web_ribbon" title="Sent"
attrs="{'invisible': [('is_move_sent', '!=', True)]}"/>
</xpath>
<xpath expr="//button[@name='action_post']" position="before"> <xpath expr="//button[@name='action_post']" position="before">
<button name="print_checks" class="oe_highlight" <button name="print_checks" class="oe_highlight"
attrs="{'invisible': ['|', ('payment_method_code', 'not in', ['check_printing','pdc']), ('state', '!=', 'posted')]}" attrs="{'invisible': ['|', ('payment_method_code', 'not in', ['check_printing','pdc']), ('state', '!=', 'posted')]}"
@ -84,4 +88,4 @@
</xpath> </xpath>
</field> </field>
</record> </record>
</odoo> </odoo>

14
base_accounting_kit/views/res_config_view.xml

@ -23,6 +23,20 @@
<!-- Remove the enterprise budget option --> <!-- Remove the enterprise budget option -->
<xpath expr="//div[@id='account_budget']" position="replace"/> <xpath expr="//div[@id='account_budget']" position="replace"/>
<xpath expr="//div[@id='bank_cash']" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="use_anglo_saxon_accounting"/>
</div>
<div class="o_setting_right_pane">
<label for="use_anglo_saxon_accounting"/>
<div class="text-muted">
It will record the cost of good sold.
</div>
</div>
</div>
</xpath>
</field> </field>
</record> </record>
</data> </data>

Loading…
Cancel
Save