diff --git a/base_accounting_kit/__manifest__.py b/base_accounting_kit/__manifest__.py index c3ad6578c..daa361d09 100644 --- a/base_accounting_kit/__manifest__.py +++ b/base_accounting_kit/__manifest__.py @@ -22,7 +22,7 @@ { 'name': 'Odoo 13 Full Accounting Kit', - 'version': '13.0.4.5.6', + 'version': '13.0.4.6.7', 'category': 'Accounting', 'live_test_url': 'https://www.youtube.com/watch?v=peAp2Tx_XIs', 'summary': """ Asset and Budget Management, diff --git a/base_accounting_kit/doc/changelog.md b/base_accounting_kit/doc/changelog.md index 07be6be35..2f8c5ee33 100644 --- a/base_accounting_kit/doc/changelog.md +++ b/base_accounting_kit/doc/changelog.md @@ -64,3 +64,8 @@ #### Version 13.0.4.5.6 #### UPDT - Code Optimized-dashboard + +#### 24.04.2020 +#### Version 13.0.4.6.7 +#### IMP +- Multi Company issue updated. diff --git a/base_accounting_kit/models/account_asset.py b/base_accounting_kit/models/account_asset.py index ed407455e..57f0a5c3a 100644 --- a/base_accounting_kit/models/account_asset.py +++ b/base_accounting_kit/models/account_asset.py @@ -57,7 +57,7 @@ class AccountAssetCategory(models.Model): journal_id = fields.Many2one('account.journal', string='Journal', required=True) company_id = fields.Many2one('res.company', string='Company', - required=True, default=lambda self: self.env.user.company_id) + required=True, default=lambda self: self.env.company) method = fields.Selection( [('linear', 'Linear'), ('degressive', 'Degressive')], string='Computation Method', required=True, default='linear', @@ -125,11 +125,11 @@ class AccountAssetAsset(models.Model): required=True, readonly=True, states={'draft': [('readonly', False)]}, default=lambda - self: self.env.user.company_id.currency_id.id) + self: self.env.company.currency_id.id) company_id = fields.Many2one('res.company', string='Company', required=True, readonly=True, states={'draft': [('readonly', False)]}, - default=lambda self: self.env.user.company_id) + default=lambda self: self.env.company) note = fields.Text() category_id = fields.Many2one('account.asset.category', string='Category', required=True, change_default=True, diff --git a/base_accounting_kit/models/account_dashboard.py b/base_accounting_kit/models/account_dashboard.py index c6c467d79..730f39b86 100644 --- a/base_accounting_kit/models/account_dashboard.py +++ b/base_accounting_kit/models/account_dashboard.py @@ -7,6 +7,7 @@ from datetime import datetime from dateutil.relativedelta import relativedelta from odoo import models, api +from odoo.http import request class DashBoard(models.Model): @@ -19,7 +20,7 @@ class DashBoard(models.Model): @api.model def get_income_this_year(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() month_list = [] for i in range(11, -1, -1): @@ -116,7 +117,7 @@ class DashBoard(models.Model): @api.model def get_income_last_year(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() month_list = [] for i in range(11, -1, -1): @@ -213,7 +214,7 @@ class DashBoard(models.Model): @api.model def get_income_last_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() day_list = [] now = datetime.now() day = \ @@ -316,7 +317,7 @@ class DashBoard(models.Model): @api.model def get_income_this_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -416,7 +417,7 @@ class DashBoard(models.Model): @api.model def get_latebills(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -465,7 +466,7 @@ class DashBoard(models.Model): @api.model def get_overdues(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -516,7 +517,7 @@ class DashBoard(models.Model): else: states_arg = """ state = 'posted'""" - company_id = self.env.company.id + company_id = self.get_current_company_value() if post[1] == 'this_month': self._cr.execute((''' select to_char(account_move.date, 'Month') as month, res_partner.name as due_partner, account_move.partner_id as parent, @@ -566,7 +567,7 @@ class DashBoard(models.Model): @api.model def get_latebillss(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() partners = self.env['res.partner'].search([('active', '=', True)]) @@ -627,7 +628,7 @@ class DashBoard(models.Model): def get_top_10_customers_month(self, *post): record_invoice = {} record_refund = {} - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post[0] != 'posted': @@ -712,7 +713,7 @@ class DashBoard(models.Model): @api.model def get_total_invoice(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -750,7 +751,7 @@ class DashBoard(models.Model): @api.model def get_total_invoice_current_year(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -839,7 +840,7 @@ class DashBoard(models.Model): @api.model def get_total_invoice_current_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -932,7 +933,7 @@ class DashBoard(models.Model): @api.model def get_total_invoice_this_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -980,7 +981,7 @@ class DashBoard(models.Model): @api.model def get_total_invoice_this_year(self): - company_id = self.env.company.id + company_id = self.get_current_company_value() self._cr.execute(''' select sum(amount_total) from account_move where type = 'out_invoice' AND Extract(YEAR FROM account_move.date) = Extract(YEAR FROM DATE(NOW())) AND @@ -1006,7 +1007,7 @@ class DashBoard(models.Model): @api.model def unreconcile_items_this_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -1053,7 +1054,7 @@ class DashBoard(models.Model): @api.model def unreconcile_items_this_year(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -1102,7 +1103,7 @@ class DashBoard(models.Model): @api.model def month_income_this_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -1124,7 +1125,7 @@ class DashBoard(models.Model): @api.model def profit_income_this_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -1158,11 +1159,17 @@ class DashBoard(models.Model): return profit + def get_current_company_value(self): + current_company = request.httprequest.cookies.get('cids') + if current_company: + company_id = current_company[0] + else: + company_id = self.env.company.id + return int(company_id) + @api.model def profit_income_this_year(self, *post): - - company_id = self.env.company.id - + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): states_arg = """ parent_state in ('posted', 'draft')""" @@ -1220,7 +1227,7 @@ class DashBoard(models.Model): @api.model def month_income_this_year(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -1254,7 +1261,8 @@ class DashBoard(models.Model): @api.model def get_currency(self): - default = self.env.ref('base.main_company').currency_id + current_company = self.env['res.company'].browse(self.get_current_company_value()) + default = current_company.currency_id or self.env.ref('base.main_company').currency_id default = default.symbol return default @@ -1276,7 +1284,7 @@ class DashBoard(models.Model): @api.model def month_expense_this_month(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -1302,7 +1310,7 @@ class DashBoard(models.Model): @api.model def month_expense_this_year(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): @@ -1326,7 +1334,7 @@ class DashBoard(models.Model): @api.model def bank_balance(self, *post): - company_id = self.env.company.id + company_id = self.get_current_company_value() states_arg = "" if post != ('posted',): diff --git a/base_accounting_kit/models/account_followup.py b/base_accounting_kit/models/account_followup.py index e96f321c3..5c2712534 100644 --- a/base_accounting_kit/models/account_followup.py +++ b/base_accounting_kit/models/account_followup.py @@ -31,7 +31,7 @@ class Followup(models.Model): followup_line_ids = fields.One2many('followup.line', 'followup_id', 'Follow-up', copy=True) company_id = fields.Many2one('res.company', 'Company', - default=lambda self: self.env.user.company_id) + default=lambda self: self.env.company) name = fields.Char(related='company_id.name', readonly=True) diff --git a/base_accounting_kit/models/recurring_payments.py b/base_accounting_kit/models/recurring_payments.py index 1a76ff11f..ba2ba7b45 100644 --- a/base_accounting_kit/models/recurring_payments.py +++ b/base_accounting_kit/models/recurring_payments.py @@ -89,7 +89,7 @@ class RecurringPayments(models.Model): ('pay_later', 'Pay Later')], store=True, required=True) company_id = fields.Many2one('res.company', - default=lambda l: l.env.user.company_id.id) + default=lambda l: l.env.company.id) recurring_lines = fields.One2many('account.recurring.entries.line', 'tmpl_id') @api.onchange('partner_id') @@ -156,7 +156,7 @@ class RecurringPayments(models.Model): vals = { 'date': line.date, 'recurring_ref': recurr_code, - 'company_id': self.env.user.company_id.id, + 'company_id': self.env.company.id, 'journal_id': tmpl_id.journal_id.id, 'ref': line.template_name, 'narration': 'Recurring entry', diff --git a/base_accounting_kit/models/res_partner.py b/base_accounting_kit/models/res_partner.py index ebe534886..bc70f8eea 100644 --- a/base_accounting_kit/models/res_partner.py +++ b/base_accounting_kit/models/res_partner.py @@ -56,7 +56,7 @@ class ResPartner(models.Model): total_overdue = 0 today = fields.Date.today() for am in record.invoice_list: - if am.company_id == self.env.user.company_id: + if am.company_id == self.env.company: amount = am.amount_residual total_due += amount is_overdue = today > am.invoice_date_due if am.invoice_date_due else today > am.date @@ -96,13 +96,13 @@ class ResPartner(models.Model): delay = """select id,delay from followup_line where followup_id = (select id from account_followup where company_id = %s) order by delay limit 1""" - self._cr.execute(delay, [self.env.user.company_id.id]) + self._cr.execute(delay, [self.env.company.id]) record = self.env.cr.dictfetchall() return record def action_after(self): lines = self.env['followup.line'].search([( - 'followup_id.company_id', '=', self.env.user.company_id.id)]) + 'followup_id.company_id', '=', self.env.company.id)]) if lines: record = self.get_delay() for i in record: diff --git a/base_accounting_kit/report/account_bank_book_view.xml b/base_accounting_kit/report/account_bank_book_view.xml index c8b74ed02..b4410ae3b 100644 --- a/base_accounting_kit/report/account_bank_book_view.xml +++ b/base_accounting_kit/report/account_bank_book_view.xml @@ -8,7 +8,7 @@
-

: Bank Book Report +

: Bank Book Report

@@ -75,15 +75,15 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> @@ -108,15 +108,15 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> diff --git a/base_accounting_kit/report/account_cash_book_view.xml b/base_accounting_kit/report/account_cash_book_view.xml index 0a0d2c4bb..e26ae7e08 100644 --- a/base_accounting_kit/report/account_cash_book_view.xml +++ b/base_accounting_kit/report/account_cash_book_view.xml @@ -9,7 +9,7 @@
-

: Cash Book Report

+

: Cash Book Report

@@ -67,13 +67,13 @@ - + - + - + @@ -85,13 +85,13 @@ - + - + - + diff --git a/base_accounting_kit/report/account_day_book_view.xml b/base_accounting_kit/report/account_day_book_view.xml index fcf22d4ba..8d80aadaa 100644 --- a/base_accounting_kit/report/account_day_book_view.xml +++ b/base_accounting_kit/report/account_day_book_view.xml @@ -7,7 +7,7 @@
-

: Day Book Report +

: Day Book Report

@@ -56,15 +56,15 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> @@ -89,15 +89,15 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> diff --git a/base_accounting_kit/report/cash_flow_report.xml b/base_accounting_kit/report/cash_flow_report.xml index 3dcc1637d..873de85fd 100644 --- a/base_accounting_kit/report/cash_flow_report.xml +++ b/base_accounting_kit/report/cash_flow_report.xml @@ -43,19 +43,19 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> diff --git a/base_accounting_kit/report/general_ledger_report.xml b/base_accounting_kit/report/general_ledger_report.xml index 2dea42772..ef78ebacc 100644 --- a/base_accounting_kit/report/general_ledger_report.xml +++ b/base_accounting_kit/report/general_ledger_report.xml @@ -7,7 +7,7 @@
-

: General ledger

+

: General ledger

@@ -64,13 +64,13 @@ - + - + - + @@ -82,13 +82,13 @@ - + - + - + diff --git a/base_accounting_kit/report/report_aged_partner.py b/base_accounting_kit/report/report_aged_partner.py index 745a6c912..f9467931a 100644 --- a/base_accounting_kit/report/report_aged_partner.py +++ b/base_accounting_kit/report/report_aged_partner.py @@ -67,7 +67,7 @@ class ReportAgedPartnerBalance(models.AbstractModel): res = [] total = [] cr = self.env.cr - user_company = self.env.user.company_id + user_company = self.env.company user_currency = user_company.currency_id ResCurrency = self.env['res.currency'].with_context(date=date_from) company_ids = self._context.get('company_ids') or [user_company.id] @@ -147,7 +147,7 @@ class ReportAgedPartnerBalance(models.AbstractModel): line_amount -= ResCurrency._compute( partial_line.company_id.currency_id, user_currency, partial_line.amount) - if not self.env.user.company_id.currency_id.is_zero(line_amount): + if not self.env.company.currency_id.is_zero(line_amount): undue_amounts[partner_id] += line_amount lines[partner_id].append({ 'line': line, @@ -207,7 +207,7 @@ class ReportAgedPartnerBalance(models.AbstractModel): partial_line.company_id.currency_id, user_currency, partial_line.amount) - if not self.env.user.company_id.currency_id.is_zero( + if not self.env.company.currency_id.is_zero( line_amount): partners_amount[partner_id] += line_amount lines[partner_id].append({ @@ -230,7 +230,7 @@ class ReportAgedPartnerBalance(models.AbstractModel): total[6] = total[6] + undue_amt values['direction'] = undue_amt if not float_is_zero(values['direction'], - precision_rounding=self.env.user.company_id.currency_id.rounding): + precision_rounding=self.env.company.currency_id.rounding): at_least_one_amount = True for i in range(5): @@ -241,7 +241,7 @@ class ReportAgedPartnerBalance(models.AbstractModel): total[(i)] = total[(i)] + (during and during[0] or 0) values[str(i)] = during and during[0] or 0.0 if not float_is_zero(values[str(i)], - precision_rounding=self.env.user.company_id.currency_id.rounding): + precision_rounding=self.env.company.currency_id.rounding): at_least_one_amount = True values['total'] = sum( [values['direction']] + [values[str(i)] for i in range(5)]) diff --git a/base_accounting_kit/report/report_aged_partner.xml b/base_accounting_kit/report/report_aged_partner.xml index efdb4eaf9..d21269240 100644 --- a/base_accounting_kit/report/report_aged_partner.xml +++ b/base_accounting_kit/report/report_aged_partner.xml @@ -53,13 +53,13 @@ Account Total - - - - - - - + + + + + + + @@ -68,25 +68,25 @@ - + - + - + - + - + - + - + diff --git a/base_accounting_kit/report/report_financial.xml b/base_accounting_kit/report/report_financial.xml index fb7d4d027..1ca5812d0 100644 --- a/base_accounting_kit/report/report_financial.xml +++ b/base_accounting_kit/report/report_financial.xml @@ -57,15 +57,15 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> @@ -96,7 +96,7 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> @@ -130,7 +130,7 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> diff --git a/base_accounting_kit/report/report_journal_audit.py b/base_accounting_kit/report/report_journal_audit.py index b6723155a..ea5ab3f0d 100644 --- a/base_accounting_kit/report/report_journal_audit.py +++ b/base_accounting_kit/report/report_journal_audit.py @@ -33,7 +33,6 @@ class ReportJournal(models.AbstractModel): def lines(self, target_move, journal_ids, sort_selection, data): if isinstance(journal_ids, int): journal_ids = [journal_ids] - move_state = ['draft', 'posted'] if target_move == 'posted': move_state = ['posted'] diff --git a/base_accounting_kit/report/report_journal_audit.xml b/base_accounting_kit/report/report_journal_audit.xml index 6c2a2c52c..0ab38ac43 100644 --- a/base_accounting_kit/report/report_journal_audit.xml +++ b/base_accounting_kit/report/report_journal_audit.xml @@ -19,7 +19,7 @@
Company: -

+

@@ -74,11 +74,11 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> @@ -129,11 +129,11 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> diff --git a/base_accounting_kit/report/report_partner_ledger.xml b/base_accounting_kit/report/report_partner_ledger.xml index 9024bea47..cd5e9fbe4 100644 --- a/base_accounting_kit/report/report_partner_ledger.xml +++ b/base_accounting_kit/report/report_partner_ledger.xml @@ -11,7 +11,7 @@
Company: -

+

@@ -54,15 +54,15 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> @@ -80,15 +80,15 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> diff --git a/base_accounting_kit/report/report_tax.xml b/base_accounting_kit/report/report_tax.xml index 33beb00c6..b64837917 100644 --- a/base_accounting_kit/report/report_tax.xml +++ b/base_accounting_kit/report/report_tax.xml @@ -11,7 +11,7 @@
Company: -

+

@@ -39,11 +39,11 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/>
@@ -60,11 +60,11 @@ + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> + t-options="{'widget': 'monetary', 'display_currency': env.company.currency_id}"/> diff --git a/base_accounting_kit/report/report_trial_balance.xml b/base_accounting_kit/report/report_trial_balance.xml index d7bfd0c15..88d8f1f98 100644 --- a/base_accounting_kit/report/report_trial_balance.xml +++ b/base_accounting_kit/report/report_trial_balance.xml @@ -7,7 +7,7 @@
-

: Trial Balance

+

: Trial Balance

@@ -53,13 +53,13 @@ - + - + - + diff --git a/base_accounting_kit/static/description/banner.gif b/base_accounting_kit/static/description/banner.gif index ff9d0e7af..dea243cdb 100644 Binary files a/base_accounting_kit/static/description/banner.gif and b/base_accounting_kit/static/description/banner.gif differ diff --git a/base_accounting_kit/static/src/js/account_dashboard.js b/base_accounting_kit/static/src/js/account_dashboard.js index e58b65076..4e36205b3 100644 --- a/base_accounting_kit/static/src/js/account_dashboard.js +++ b/base_accounting_kit/static/src/js/account_dashboard.js @@ -4,7 +4,6 @@ odoo.define('AccountingDashboard.AccountingDashboard', function (require) { var ajax = require('web.ajax'); var core = require('web.core'); var rpc = require('web.rpc'); - var session = require('web.session'); var web_client = require('web.web_client'); var _t = core._t; var QWeb = core.qweb; diff --git a/base_accounting_kit/wizard/account_bank_book_wizard.py b/base_accounting_kit/wizard/account_bank_book_wizard.py index bb03ca478..bd1e78788 100644 --- a/base_accounting_kit/wizard/account_bank_book_wizard.py +++ b/base_accounting_kit/wizard/account_bank_book_wizard.py @@ -31,7 +31,7 @@ class BankBookWizard(models.TransientModel): company_id = fields.Many2one('res.company', string='Company', readonly=True, - default=lambda self: self.env.user.company_id) + default=lambda self: self.env.company) target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries')], string='Target Moves', required=True, default='posted') diff --git a/base_accounting_kit/wizard/account_cash_book_wizard.py b/base_accounting_kit/wizard/account_cash_book_wizard.py index 9b3634743..a9034ee0a 100644 --- a/base_accounting_kit/wizard/account_cash_book_wizard.py +++ b/base_accounting_kit/wizard/account_cash_book_wizard.py @@ -31,7 +31,7 @@ class CashBookWizard(models.TransientModel): company_id = fields.Many2one('res.company', string='Company', readonly=True, - default=lambda self: self.env.user.company_id) + default=lambda self: self.env.company) target_move = fields.Selection([('posted', 'All Posted Entries'), ('all', 'All Entries')], string='Target Moves', required=True, default='posted') diff --git a/base_accounting_kit/wizard/account_day_book_wizard.py b/base_accounting_kit/wizard/account_day_book_wizard.py index 1657f9816..c72479ea7 100644 --- a/base_accounting_kit/wizard/account_day_book_wizard.py +++ b/base_accounting_kit/wizard/account_day_book_wizard.py @@ -30,7 +30,7 @@ class DayBookWizard(models.TransientModel): company_id = fields.Many2one('res.company', string='Company', readonly=True, - default=lambda self: self.env.user.company_id) + default=lambda self: self.env.company) journal_ids = fields.Many2many('account.journal', string='Journals', required=True, default=lambda self: self.env[ diff --git a/base_accounting_kit/wizard/account_lock_date.py b/base_accounting_kit/wizard/account_lock_date.py index 9ff4b9ddf..7fcff941f 100644 --- a/base_accounting_kit/wizard/account_lock_date.py +++ b/base_accounting_kit/wizard/account_lock_date.py @@ -41,7 +41,7 @@ class AccountUpdateLockDate(models.TransientModel): @api.model def default_get(self, field_list): res = super(AccountUpdateLockDate, self).default_get(field_list) - company = self.env.user.company_id + company = self.env.company res.update({ 'company_id': company.id, 'period_lock_date': company.period_lock_date, diff --git a/base_accounting_kit/wizard/financial_report.py b/base_accounting_kit/wizard/financial_report.py index fe82ca3ff..0f656bfb2 100644 --- a/base_accounting_kit/wizard/financial_report.py +++ b/base_accounting_kit/wizard/financial_report.py @@ -68,7 +68,7 @@ class FinancialReport(models.TransientModel): 'res.company', string='Company', index=True, - default=lambda self: self.env.user.company_id.id) + default=lambda self: self.env.company.id) def view_report_pdf(self): """This function will be executed when we click the view button @@ -370,7 +370,7 @@ class FinancialReport(models.TransientModel): self.env.context.get('default_journal_id', False)) if journal.currency_id: return journal.currency_id.id - return self.env.user.company_id.currency_id.symbol + return self.env.company.currency_id.symbol class ProfitLossPdf(models.AbstractModel):