[MIG] account_reconcile_oca: Finish migration
parent
a5f04c08f7
commit
98e0d559ba
|
@ -12,6 +12,7 @@
|
||||||
"website": "https://github.com/OCA/account-reconcile",
|
"website": "https://github.com/OCA/account-reconcile",
|
||||||
"depends": [
|
"depends": [
|
||||||
"account_statement_base",
|
"account_statement_base",
|
||||||
|
"account_reconcile_model_oca",
|
||||||
"base_sparse_field",
|
"base_sparse_field",
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from odoo import Command, _, api, fields, models
|
from odoo import Command, _, api, fields, models, tools
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
from odoo.tools import float_is_zero
|
from odoo.tools import float_is_zero
|
||||||
|
|
||||||
|
@ -186,10 +186,14 @@ class AccountBankStatementLine(models.Model):
|
||||||
suspense_line = {
|
suspense_line = {
|
||||||
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
||||||
"id": False,
|
"id": False,
|
||||||
"account_id": self.journal_id.suspense_account_id.display_name,
|
"account_id": [
|
||||||
|
self.journal_id.suspense_account_id.id,
|
||||||
|
self.journal_id.suspense_account_id.display_name,
|
||||||
|
],
|
||||||
"partner_id": self.partner_id
|
"partner_id": self.partner_id
|
||||||
and self.partner_id.display_name
|
and [self.partner_id.id, self.partner_id.display_name]
|
||||||
or (False, self.partner_name),
|
or (self.partner_name and (False, self.partner_name))
|
||||||
|
or False,
|
||||||
"date": fields.Date.to_string(self.date),
|
"date": fields.Date.to_string(self.date),
|
||||||
"name": self.payment_ref or self.name,
|
"name": self.payment_ref or self.name,
|
||||||
"amount": -total_amount,
|
"amount": -total_amount,
|
||||||
|
@ -289,9 +293,16 @@ class AccountBankStatementLine(models.Model):
|
||||||
{
|
{
|
||||||
"name": self.manual_name,
|
"name": self.manual_name,
|
||||||
"partner_id": self.manual_partner_id
|
"partner_id": self.manual_partner_id
|
||||||
and self.manual_partner_id.display_name
|
and [
|
||||||
or (False, self.partner_name),
|
self.manual_partner_id.id,
|
||||||
"account_id": self.manual_account_id.display_name
|
self.manual_partner_id.display_name,
|
||||||
|
]
|
||||||
|
or (self.partner_name and (False, self.partner_name))
|
||||||
|
or False,
|
||||||
|
"account_id": [
|
||||||
|
self.manual_account_id.id,
|
||||||
|
self.manual_account_id.display_name,
|
||||||
|
]
|
||||||
if self.manual_account_id
|
if self.manual_account_id
|
||||||
else [False, _("Undefined")],
|
else [False, _("Undefined")],
|
||||||
"amount": self.manual_amount,
|
"amount": self.manual_amount,
|
||||||
|
@ -374,9 +385,12 @@ class AccountBankStatementLine(models.Model):
|
||||||
"debit": amount if amount > 0 else 0,
|
"debit": amount if amount > 0 else 0,
|
||||||
"credit": -amount if amount < 0 else 0,
|
"credit": -amount if amount < 0 else 0,
|
||||||
"kind": "other",
|
"kind": "other",
|
||||||
"account_id": self.env["account.account"]
|
"account_id": [
|
||||||
|
line["account_id"],
|
||||||
|
self.env["account.account"]
|
||||||
.browse(line["account_id"])
|
.browse(line["account_id"])
|
||||||
.display_name,
|
.display_name,
|
||||||
|
],
|
||||||
"date": fields.Date.to_string(self.date),
|
"date": fields.Date.to_string(self.date),
|
||||||
"line_currency_id": self.company_id.currency_id.id,
|
"line_currency_id": self.company_id.currency_id.id,
|
||||||
"currency_id": self.company_id.currency_id.id,
|
"currency_id": self.company_id.currency_id.id,
|
||||||
|
@ -386,7 +400,8 @@ class AccountBankStatementLine(models.Model):
|
||||||
reconcile_auxiliary_id += 1
|
reconcile_auxiliary_id += 1
|
||||||
if line.get("partner_id"):
|
if line.get("partner_id"):
|
||||||
new_line["partner_id"] = (
|
new_line["partner_id"] = (
|
||||||
self.env["res.partner"].browse(line["partner_id"]).display_name
|
line["partner_id"],
|
||||||
|
self.env["res.partner"].browse(line["partner_id"]).display_name,
|
||||||
)
|
)
|
||||||
new_data.append(new_line)
|
new_data.append(new_line)
|
||||||
return new_data, reconcile_auxiliary_id
|
return new_data, reconcile_auxiliary_id
|
||||||
|
@ -409,7 +424,7 @@ class AccountBankStatementLine(models.Model):
|
||||||
{
|
{
|
||||||
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
||||||
"id": False,
|
"id": False,
|
||||||
"account_id": account.display_name,
|
"account_id": [account.id, account.display_name],
|
||||||
"partner_id": False,
|
"partner_id": False,
|
||||||
"date": fields.Date.to_string(self.date),
|
"date": fields.Date.to_string(self.date),
|
||||||
"name": self.payment_ref or self.name,
|
"name": self.payment_ref or self.name,
|
||||||
|
@ -620,6 +635,10 @@ class AccountBankStatementLine(models.Model):
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, mvals):
|
def create(self, mvals):
|
||||||
result = super().create(mvals)
|
result = super().create(mvals)
|
||||||
|
if tools.config["test_enable"] and not self.env.context.get(
|
||||||
|
"_test_account_reconcile_oca"
|
||||||
|
):
|
||||||
|
return result
|
||||||
models = self.env["account.reconcile.model"].search(
|
models = self.env["account.reconcile.model"].search(
|
||||||
[
|
[
|
||||||
("rule_type", "in", ["invoice_matching", "writeoff_suggestion"]),
|
("rule_type", "in", ["invoice_matching", "writeoff_suggestion"]),
|
||||||
|
@ -726,6 +745,6 @@ class AccountBankStatementLine(models.Model):
|
||||||
max_amount=max_amount,
|
max_amount=max_amount,
|
||||||
from_unreconcile=from_unreconcile,
|
from_unreconcile=from_unreconcile,
|
||||||
)
|
)
|
||||||
if vals["partner_id"] is False:
|
if vals["partner_id"] is False and self.partner_name:
|
||||||
vals["partner_id"] = (False, self.partner_name)
|
vals["partner_id"] = (False, self.partner_name)
|
||||||
return vals
|
return vals
|
||||||
|
|
|
@ -15,6 +15,9 @@ class AccountJournal(models.Model):
|
||||||
|
|
||||||
def get_rainbowman_message(self):
|
def get_rainbowman_message(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.get_journal_dashboard_datas()["number_to_reconcile"] > 0:
|
if (
|
||||||
|
self._get_journal_dashboard_data_batched()[self.id]["number_to_reconcile"]
|
||||||
|
> 0
|
||||||
|
):
|
||||||
return False
|
return False
|
||||||
return _("Well done! Everything has been reconciled")
|
return _("Well done! Everything has been reconciled")
|
||||||
|
|
|
@ -68,8 +68,10 @@ class AccountReconcileAbstract(models.AbstractModel):
|
||||||
vals = {
|
vals = {
|
||||||
"reference": "account.move.line;%s" % line.id,
|
"reference": "account.move.line;%s" % line.id,
|
||||||
"id": line.id,
|
"id": line.id,
|
||||||
"account_id": line.account_id.display_name,
|
"account_id": [line.account_id.id, line.account_id.display_name],
|
||||||
"partner_id": line.partner_id and line.partner_id.display_name or False,
|
"partner_id": [line.partner_id.id, line.partner_id.display_name]
|
||||||
|
if line.partner_id
|
||||||
|
else False,
|
||||||
"date": fields.Date.to_string(line.date),
|
"date": fields.Date.to_string(line.date),
|
||||||
"name": line.name,
|
"name": line.name,
|
||||||
"debit": amount if amount > 0 else 0.0,
|
"debit": amount if amount > 0 else 0.0,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/** @odoo-module */
|
/** @odoo-module */
|
||||||
const {useState, useSubEnv} = owl;
|
const {useState, useSubEnv} = owl;
|
||||||
|
import {useBus, useService} from "@web/core/utils/hooks";
|
||||||
import {KanbanController} from "@web/views/kanban/kanban_controller";
|
import {KanbanController} from "@web/views/kanban/kanban_controller";
|
||||||
import {View} from "@web/views/view";
|
import {View} from "@web/views/view";
|
||||||
import {useService} from "@web/core/utils/hooks";
|
|
||||||
|
|
||||||
export class ReconcileController extends KanbanController {
|
export class ReconcileController extends KanbanController {
|
||||||
async setup() {
|
async setup() {
|
||||||
|
@ -19,7 +19,9 @@ export class ReconcileController extends KanbanController {
|
||||||
this.action = useService("action");
|
this.action = useService("action");
|
||||||
this.router = useService("router");
|
this.router = useService("router");
|
||||||
this.activeActions = this.props.archInfo.activeActions;
|
this.activeActions = this.props.archInfo.activeActions;
|
||||||
this.model.addEventListener("update", () => this.selectRecord(), {once: true});
|
useBus(this.model.bus, "update", () => {
|
||||||
|
this.selectRecord();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
exposeController(controller) {
|
exposeController(controller) {
|
||||||
this.form_controller = controller;
|
this.form_controller = controller;
|
||||||
|
@ -55,7 +57,7 @@ export class ReconcileController extends KanbanController {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
async selectRecord(record) {
|
async selectRecord(record) {
|
||||||
var resId = undefined;
|
var resId = false;
|
||||||
if (record === undefined && this.props.resId) {
|
if (record === undefined && this.props.resId) {
|
||||||
resId = this.props.resId;
|
resId = this.props.resId;
|
||||||
} else if (record === undefined) {
|
} else if (record === undefined) {
|
||||||
|
@ -97,6 +99,7 @@ export class ReconcileController extends KanbanController {
|
||||||
this.router.pushState({id: resId});
|
this.router.pushState({id: resId});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReconcileController.components = {
|
ReconcileController.components = {
|
||||||
...ReconcileController.components,
|
...ReconcileController.components,
|
||||||
View,
|
View,
|
||||||
|
|
|
@ -3,14 +3,25 @@
|
||||||
// import {ChatterContainer} from "@mail/components/chatter_container/chatter_container";
|
// import {ChatterContainer} from "@mail/components/chatter_container/chatter_container";
|
||||||
// import {Chatter} from "@mail/core/web/chatter";
|
// import {Chatter} from "@mail/core/web/chatter";
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
|
import {standardFieldProps} from "@web/views/fields/standard_field_props";
|
||||||
|
import {Chatter} from "@mail/core/web/chatter";
|
||||||
|
|
||||||
const {Component} = owl;
|
const {Component} = owl;
|
||||||
|
|
||||||
export class AccountReconcileChatterWidget extends Component {}
|
export class AccountReconcileChatterWidget extends Component {
|
||||||
|
setup() {
|
||||||
|
super.setup();
|
||||||
|
console.log(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AccountReconcileChatterWidget.props = {...standardFieldProps};
|
||||||
AccountReconcileChatterWidget.template =
|
AccountReconcileChatterWidget.template =
|
||||||
"account_reconcile_oca.AccountReconcileChatterWidget";
|
"account_reconcile_oca.AccountReconcileChatterWidget";
|
||||||
// AccountReconcileChatterWidget.components = {...Component.components, ChatterContainer};
|
AccountReconcileChatterWidget.components = {...Component.components, Chatter};
|
||||||
|
export const AccountReconcileChatterWidgetField = {
|
||||||
|
component: AccountReconcileChatterWidget,
|
||||||
|
supportedTypes: [],
|
||||||
|
};
|
||||||
registry
|
registry
|
||||||
.category("fields")
|
.category("fields")
|
||||||
.add("account_reconcile_oca_chatter", AccountReconcileChatterWidget);
|
.add("account_reconcile_oca_chatter", AccountReconcileChatterWidgetField);
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
import {formatDate, parseDate} from "@web/core/l10n/dates";
|
||||||
import {formatDate, formatMonetary} from "@web/views/fields/formatters";
|
import {formatMonetary} from "@web/views/fields/formatters";
|
||||||
import {parseDate} from "@web/core/l10n/dates";
|
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
import {session} from "@web/session";
|
|
||||||
|
|
||||||
const {Component} = owl;
|
const {Component} = owl;
|
||||||
|
|
||||||
|
@ -24,19 +22,19 @@ export class AccountReconcileDataWidget extends Component {
|
||||||
var data = this.props.record.data[this.props.name].data;
|
var data = this.props.record.data[this.props.name].data;
|
||||||
for (var line in data) {
|
for (var line in data) {
|
||||||
data[line].amount_format = formatMonetary(data[line].amount, undefined, {
|
data[line].amount_format = formatMonetary(data[line].amount, undefined, {
|
||||||
currency: session.get_currency(data[line].currency_id),
|
currency: data[line].currency_id,
|
||||||
});
|
});
|
||||||
data[line].debit_format = formatMonetary(data[line].debit, undefined, {
|
data[line].debit_format = formatMonetary(data[line].debit, undefined, {
|
||||||
currency: session.get_currency(data[line].currency_id),
|
currency: data[line].currency_id,
|
||||||
});
|
});
|
||||||
data[line].credit_format = formatMonetary(data[line].credit, undefined, {
|
data[line].credit_format = formatMonetary(data[line].credit, undefined, {
|
||||||
currency: session.get_currency(data[line].currency_id),
|
currency: data[line].currency_id,
|
||||||
});
|
});
|
||||||
data[line].amount_currency_format = formatMonetary(
|
data[line].amount_currency_format = formatMonetary(
|
||||||
data[line].currency_amount,
|
data[line].currency_amount,
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
currency: session.get_currency(data[line].line_currency_id),
|
currency: data[line].line_currency_id,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (data[line].original_amount) {
|
if (data[line].original_amount) {
|
||||||
|
@ -44,7 +42,7 @@ export class AccountReconcileDataWidget extends Component {
|
||||||
data[line].original_amount,
|
data[line].original_amount,
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
currency: session.get_currency(data[line].currency_id),
|
currency: data[line].currency_id,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -75,6 +73,10 @@ export class AccountReconcileDataWidget extends Component {
|
||||||
}
|
}
|
||||||
AccountReconcileDataWidget.template = "account_reconcile_oca.ReconcileDataWidget";
|
AccountReconcileDataWidget.template = "account_reconcile_oca.ReconcileDataWidget";
|
||||||
|
|
||||||
|
export const AccountReconcileDataWidgetField = {
|
||||||
|
component: AccountReconcileDataWidget,
|
||||||
|
supportedTypes: [],
|
||||||
|
};
|
||||||
registry
|
registry
|
||||||
.category("fields")
|
.category("fields")
|
||||||
.add("account_reconcile_oca_data", AccountReconcileDataWidget);
|
.add("account_reconcile_oca_data", AccountReconcileDataWidgetField);
|
||||||
|
|
|
@ -1,19 +1,29 @@
|
||||||
/** @odoo-module **/
|
/** @odoo-module **/
|
||||||
|
|
||||||
import {View} from "@web/views/view";
|
import {View} from "@web/views/view";
|
||||||
|
import {evaluateBooleanExpr} from "@web/core/py_js/py";
|
||||||
|
import {getFieldContext} from "@web/model/relational_model/utils";
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
|
import {standardFieldProps} from "@web/views/fields/standard_field_props";
|
||||||
|
|
||||||
const {Component, useSubEnv} = owl;
|
const {Component, useSubEnv} = owl;
|
||||||
|
|
||||||
export class AccountReconcileMatchWidget extends Component {
|
export class AccountReconcileMatchWidget extends Component {
|
||||||
setup() {
|
setup() {
|
||||||
// Necessary in order to avoid a loop
|
// Necessary in order to avoid a loop
|
||||||
super.setup(...arguments);
|
|
||||||
useSubEnv({
|
useSubEnv({
|
||||||
config: {},
|
config: {},
|
||||||
parentController: this.env.parentController,
|
parentController: this.env.parentController,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getDomain() {
|
||||||
|
let domain = this.props.domain;
|
||||||
|
if (typeof domain === "function") {
|
||||||
|
domain = domain();
|
||||||
|
}
|
||||||
|
return domain;
|
||||||
|
}
|
||||||
get listViewProperties() {
|
get listViewProperties() {
|
||||||
return {
|
return {
|
||||||
type: "list",
|
type: "list",
|
||||||
|
@ -22,15 +32,18 @@ export class AccountReconcileMatchWidget extends Component {
|
||||||
// Hiding the control panel buttons
|
// Hiding the control panel buttons
|
||||||
"top-left": false,
|
"top-left": false,
|
||||||
"bottom-left": false,
|
"bottom-left": false,
|
||||||
|
layoutActions: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
noBreadcrumbs: true,
|
||||||
resModel: this.props.record.fields[this.props.name].relation,
|
resModel: this.props.record.fields[this.props.name].relation,
|
||||||
searchMenuTypes: ["filter"],
|
searchMenuTypes: ["filter"],
|
||||||
domain: this.props.record.getFieldDomain(this.props.name).toList(),
|
domain: this.getDomain(),
|
||||||
context: {
|
context: {
|
||||||
...this.props.record.getFieldContext(this.props.name),
|
...this.props.context,
|
||||||
|
...getFieldContext(this.props.record, this.props.name),
|
||||||
},
|
},
|
||||||
// Disables de selector
|
// Disables selector
|
||||||
allowSelectors: false,
|
allowSelectors: false,
|
||||||
// We need to force the search view in order to show the right one
|
// We need to force the search view in order to show the right one
|
||||||
searchViewId: false,
|
searchViewId: false,
|
||||||
|
@ -39,13 +52,56 @@ export class AccountReconcileMatchWidget extends Component {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AccountReconcileMatchWidget.props = {
|
||||||
|
...standardFieldProps,
|
||||||
|
placeholder: {type: String, optional: true},
|
||||||
|
canOpen: {type: Boolean, optional: true},
|
||||||
|
canCreate: {type: Boolean, optional: true},
|
||||||
|
canWrite: {type: Boolean, optional: true},
|
||||||
|
canQuickCreate: {type: Boolean, optional: true},
|
||||||
|
canCreateEdit: {type: Boolean, optional: true},
|
||||||
|
context: {type: String, optional: true},
|
||||||
|
domain: {type: [Array, Function], optional: true},
|
||||||
|
nameCreateField: {type: String, optional: true},
|
||||||
|
searchLimit: {type: Number, optional: true},
|
||||||
|
relation: {type: String, optional: true},
|
||||||
|
string: {type: String, optional: true},
|
||||||
|
canScanBarcode: {type: Boolean, optional: true},
|
||||||
|
update: {type: Function, optional: true},
|
||||||
|
value: {optional: true},
|
||||||
|
decorations: {type: Object, optional: true},
|
||||||
|
};
|
||||||
AccountReconcileMatchWidget.template = "account_reconcile_oca.ReconcileMatchWidget";
|
AccountReconcileMatchWidget.template = "account_reconcile_oca.ReconcileMatchWidget";
|
||||||
|
|
||||||
AccountReconcileMatchWidget.components = {
|
AccountReconcileMatchWidget.components = {
|
||||||
...AccountReconcileMatchWidget.components,
|
...AccountReconcileMatchWidget.components,
|
||||||
View,
|
View,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const AccountReconcileMatchWidgetField = {
|
||||||
|
component: AccountReconcileMatchWidget,
|
||||||
|
supportedTypes: [],
|
||||||
|
extractProps({attrs, context, decorations, options}, dynamicInfo) {
|
||||||
|
const hasCreatePermission = attrs.can_create
|
||||||
|
? evaluateBooleanExpr(attrs.can_create)
|
||||||
|
: true;
|
||||||
|
const hasWritePermission = attrs.can_write
|
||||||
|
? evaluateBooleanExpr(attrs.can_write)
|
||||||
|
: true;
|
||||||
|
const canCreate = options.no_create ? false : hasCreatePermission;
|
||||||
|
return {
|
||||||
|
placeholder: attrs.placeholder,
|
||||||
|
canOpen: !options.no_open,
|
||||||
|
canCreate,
|
||||||
|
canWrite: hasWritePermission,
|
||||||
|
canQuickCreate: canCreate && !options.no_quick_create,
|
||||||
|
canCreateEdit: canCreate && !options.no_create_edit,
|
||||||
|
context: context,
|
||||||
|
decorations,
|
||||||
|
domain: dynamicInfo.domain,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
registry
|
registry
|
||||||
.category("fields")
|
.category("fields")
|
||||||
.add("account_reconcile_oca_match", AccountReconcileMatchWidget);
|
.add("account_reconcile_oca_match", AccountReconcileMatchWidgetField);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
preloadSelection,
|
preloadSelection,
|
||||||
} from "@web/views/fields/badge_selection/badge_selection_field";
|
} from "@web/views/fields/badge_selection/badge_selection_field";
|
||||||
import {registry} from "@web/core/registry";
|
import {registry} from "@web/core/registry";
|
||||||
|
import {standardFieldProps} from "@web/views/fields/standard_field_props";
|
||||||
|
|
||||||
export class FieldSelectionBadgeUncheck extends BadgeSelectionField {
|
export class FieldSelectionBadgeUncheck extends BadgeSelectionField {
|
||||||
async onChange(value) {
|
async onChange(value) {
|
||||||
|
@ -19,9 +20,17 @@ export class FieldSelectionBadgeUncheck extends BadgeSelectionField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FieldSelectionBadgeUncheck.props = {...standardFieldProps};
|
||||||
FieldSelectionBadgeUncheck.supportedTypes = ["many2one", "selection"];
|
FieldSelectionBadgeUncheck.supportedTypes = ["many2one", "selection"];
|
||||||
FieldSelectionBadgeUncheck.additionalClasses = ["o_field_selection_badge"];
|
FieldSelectionBadgeUncheck.additionalClasses = ["o_field_selection_badge"];
|
||||||
registry.category("fields").add("selection_badge_uncheck", FieldSelectionBadgeUncheck);
|
|
||||||
|
export const FieldSelectionBadgeUncheckField = {
|
||||||
|
component: FieldSelectionBadgeUncheck,
|
||||||
|
supportedTypes: ["many2one"],
|
||||||
|
};
|
||||||
|
registry
|
||||||
|
.category("fields")
|
||||||
|
.add("selection_badge_uncheck", FieldSelectionBadgeUncheckField);
|
||||||
|
|
||||||
registry.category("preloadedData").add("selection_badge_uncheck", {
|
registry.category("preloadedData").add("selection_badge_uncheck", {
|
||||||
loadOnTypes: ["many2one"],
|
loadOnTypes: ["many2one"],
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
>Create</button>
|
>Create</button>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="account_reconcile_oca.ReconcileMatchWidget">
|
<t t-name="account_reconcile_oca.ReconcileMatchWidget">
|
||||||
<View t-props="listViewProperties" />
|
<View t-props="this.listViewProperties" />
|
||||||
</t>
|
</t>
|
||||||
<t t-name="account_reconcile_oca.ReconcileDataWidget">
|
<t t-name="account_reconcile_oca.ReconcileDataWidget">
|
||||||
<table
|
<table
|
||||||
|
@ -137,9 +137,9 @@
|
||||||
</table>
|
</table>
|
||||||
</t>
|
</t>
|
||||||
<t t-name="account_reconcile_oca.AccountReconcileChatterWidget">
|
<t t-name="account_reconcile_oca.AccountReconcileChatterWidget">
|
||||||
<ChatterContainer
|
<Chatter
|
||||||
threadModel="this.props.record.fields[this.props.name].relation"
|
threadModel="this.props.record.fields[this.props.name].relation"
|
||||||
threadId="this.props.value[0]"
|
threadId="this.props.record.data[this.props.name][0]"
|
||||||
/>
|
/>
|
||||||
</t>
|
</t>
|
||||||
<t
|
<t
|
||||||
|
|
|
@ -1,28 +1,34 @@
|
||||||
from odoo.tests import Form, tagged
|
from odoo.tests import Form, tagged
|
||||||
|
|
||||||
from odoo.addons.account.tests.common import TestAccountReconciliationCommon
|
from odoo.addons.account_reconcile_model_oca.tests.common import (
|
||||||
|
TestAccountReconciliationCommon,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@tagged("post_install", "-at_install")
|
@tagged("post_install", "-at_install")
|
||||||
class TestReconciliationWidget(TestAccountReconciliationCommon):
|
class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
|
@classmethod
|
||||||
|
def _setup_context(cls):
|
||||||
|
return {**cls.env.context, "_test_account_reconcile_oca": True}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls, chart_template_ref=None):
|
def setUpClass(cls, chart_template_ref=None):
|
||||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||||
|
cls.env = cls.env(context=cls._setup_context())
|
||||||
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
||||||
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
||||||
cls.bank_journal_usd.suspense_account_id = (
|
cls.bank_journal_usd.suspense_account_id = (
|
||||||
cls.company.account_journal_suspense_account_id
|
cls.env.company.account_journal_suspense_account_id
|
||||||
)
|
)
|
||||||
cls.bank_journal_euro.suspense_account_id = (
|
cls.bank_journal_euro.suspense_account_id = (
|
||||||
cls.company.account_journal_suspense_account_id
|
cls.env.company.account_journal_suspense_account_id
|
||||||
)
|
)
|
||||||
cls.current_assets_account = (
|
cls.current_assets_account = (
|
||||||
cls.env["account.account"]
|
cls.env["account.account"]
|
||||||
.search(
|
.search(
|
||||||
[
|
[
|
||||||
("account_type", "=", "asset_current"),
|
("account_type", "=", "asset_current"),
|
||||||
("company_id", "=", cls.company.id),
|
("company_id", "=", cls.env.company.id),
|
||||||
],
|
],
|
||||||
limit=1,
|
limit=1,
|
||||||
)
|
)
|
||||||
|
@ -34,7 +40,7 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
.search(
|
.search(
|
||||||
[
|
[
|
||||||
("account_type", "=", "asset_receivable"),
|
("account_type", "=", "asset_receivable"),
|
||||||
("company_id", "=", cls.company.id),
|
("company_id", "=", cls.env.company.id),
|
||||||
],
|
],
|
||||||
limit=1,
|
limit=1,
|
||||||
)
|
)
|
||||||
|
@ -46,7 +52,7 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
.search(
|
.search(
|
||||||
[
|
[
|
||||||
("account_type", "=", "equity"),
|
("account_type", "=", "equity"),
|
||||||
("company_id", "=", cls.company.id),
|
("company_id", "=", cls.env.company.id),
|
||||||
],
|
],
|
||||||
limit=1,
|
limit=1,
|
||||||
)
|
)
|
||||||
|
@ -57,7 +63,7 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
.search(
|
.search(
|
||||||
[
|
[
|
||||||
("account_type", "=", "asset_non_current"),
|
("account_type", "=", "asset_non_current"),
|
||||||
("company_id", "=", cls.company.id),
|
("company_id", "=", cls.env.company.id),
|
||||||
],
|
],
|
||||||
limit=1,
|
limit=1,
|
||||||
)
|
)
|
||||||
|
@ -251,7 +257,7 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
0,
|
0,
|
||||||
{
|
{
|
||||||
"account_id": self.asset_receivable_account.id,
|
"account_id": self.asset_receivable_account.id,
|
||||||
"partner_id": self.company.partner_id.id,
|
"partner_id": self.env.company.partner_id.id,
|
||||||
"name": "DEMO",
|
"name": "DEMO",
|
||||||
"credit": 100,
|
"credit": 100,
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,27 +3,34 @@ import time
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError
|
||||||
from odoo.tests import Form, tagged
|
from odoo.tests import Form, tagged
|
||||||
|
|
||||||
from odoo.addons.account.tests.common import TestAccountReconciliationCommon
|
from odoo.addons.account_reconcile_model_oca.tests.common import (
|
||||||
|
TestAccountReconciliationCommon,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@tagged("post_install", "-at_install")
|
@tagged("post_install", "-at_install")
|
||||||
class TestReconciliationWidget(TestAccountReconciliationCommon):
|
class TestReconciliationWidget(TestAccountReconciliationCommon):
|
||||||
|
@classmethod
|
||||||
|
def _setup_context(cls):
|
||||||
|
return {**cls.env.context, "_test_account_reconcile_oca": True}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls, chart_template_ref=None):
|
def setUpClass(cls, chart_template_ref=None):
|
||||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||||
|
cls.env = cls.env(context=cls._setup_context())
|
||||||
|
|
||||||
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
|
||||||
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
|
||||||
cls.bank_journal_usd.suspense_account_id = (
|
cls.bank_journal_usd.suspense_account_id = (
|
||||||
cls.company.account_journal_suspense_account_id
|
cls.env.company.account_journal_suspense_account_id
|
||||||
)
|
)
|
||||||
cls.bank_journal_euro.suspense_account_id = (
|
cls.bank_journal_euro.suspense_account_id = (
|
||||||
cls.company.account_journal_suspense_account_id
|
cls.env.company.account_journal_suspense_account_id
|
||||||
)
|
)
|
||||||
cls.current_assets_account = cls.env["account.account"].search(
|
cls.current_assets_account = cls.env["account.account"].search(
|
||||||
[
|
[
|
||||||
("account_type", "=", "asset_current"),
|
("account_type", "=", "asset_current"),
|
||||||
("company_id", "=", cls.company.id),
|
("company_id", "=", cls.env.company.id),
|
||||||
],
|
],
|
||||||
limit=1,
|
limit=1,
|
||||||
)
|
)
|
||||||
|
|
|
@ -294,7 +294,7 @@
|
||||||
<field name="narration" />
|
<field name="narration" />
|
||||||
</page>
|
</page>
|
||||||
<page name="chatter" string="Chatter">
|
<page name="chatter" string="Chatter">
|
||||||
<!-- <field name="move_id" widget="account_reconcile_oca_chatter" /> -->
|
<field name="move_id" widget="account_reconcile_oca_chatter" />
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</form>
|
</form>
|
||||||
|
@ -307,11 +307,11 @@
|
||||||
<field name="context">
|
<field name="context">
|
||||||
{'default_journal_id': active_id, 'search_default_not_reconciled': True, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}
|
{'default_journal_id': active_id, 'search_default_not_reconciled': True, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}
|
||||||
</field>
|
</field>
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">kanban</field>
|
||||||
<field
|
<field
|
||||||
name="view_ids"
|
name="view_ids"
|
||||||
eval="[(5, 0, 0),
|
eval="[(5, 0, 0),
|
||||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
(0, 0, {'view_mode': 'kanban', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
||||||
/>
|
/>
|
||||||
<field name="help" type="html">
|
<field name="help" type="html">
|
||||||
<p class="o_view_nocontent_smiling_face">
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
@ -326,11 +326,11 @@
|
||||||
<field name="context">
|
<field name="context">
|
||||||
{'default_journal_id': active_id, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}
|
{'default_journal_id': active_id, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}
|
||||||
</field>
|
</field>
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">kanban</field>
|
||||||
<field
|
<field
|
||||||
name="view_ids"
|
name="view_ids"
|
||||||
eval="[(5, 0, 0),
|
eval="[(5, 0, 0),
|
||||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
(0, 0, {'view_mode': 'kanban', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
||||||
/>
|
/>
|
||||||
<field name="help" type="html">
|
<field name="help" type="html">
|
||||||
<p class="o_view_nocontent_smiling_face">
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
@ -348,11 +348,11 @@
|
||||||
<field name="context">
|
<field name="context">
|
||||||
{'default_journal_id': active_id, 'search_default_to_check': True, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}
|
{'default_journal_id': active_id, 'search_default_to_check': True, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}
|
||||||
</field>
|
</field>
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">kanban</field>
|
||||||
<field
|
<field
|
||||||
name="view_ids"
|
name="view_ids"
|
||||||
eval="[(5, 0, 0),
|
eval="[(5, 0, 0),
|
||||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
(0, 0, {'view_mode': 'kanban', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
||||||
/>
|
/>
|
||||||
<field name="help" type="html">
|
<field name="help" type="html">
|
||||||
<p class="o_view_nocontent_smiling_face">
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
@ -368,11 +368,11 @@
|
||||||
<field name="name">Reconcile bank statement lines</field>
|
<field name="name">Reconcile bank statement lines</field>
|
||||||
<field name="res_model">account.bank.statement.line</field>
|
<field name="res_model">account.bank.statement.line</field>
|
||||||
<field name="context">{'search_default_move_id': id}</field>
|
<field name="context">{'search_default_move_id': id}</field>
|
||||||
<field name="view_mode">tree</field>
|
<field name="view_mode">kanban</field>
|
||||||
<field
|
<field
|
||||||
name="view_ids"
|
name="view_ids"
|
||||||
eval="[(5, 0, 0),
|
eval="[(5, 0, 0),
|
||||||
(0, 0, {'view_mode': 'tree', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
(0, 0, {'view_mode': 'kanban', 'view_id': ref('bank_statement_line_reconcile_view')})]"
|
||||||
/>
|
/>
|
||||||
<field name="help" type="html">
|
<field name="help" type="html">
|
||||||
<p class="o_view_nocontent_smiling_face">
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
|
|
@ -8,7 +8,12 @@
|
||||||
<field name="model">account.move.line</field>
|
<field name="model">account.move.line</field>
|
||||||
<field name="priority">99</field>
|
<field name="priority">99</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree js_class="reconcile_move_line">
|
<tree
|
||||||
|
js_class="reconcile_move_line"
|
||||||
|
create="0"
|
||||||
|
edit="0"
|
||||||
|
export_xlsx="false"
|
||||||
|
>
|
||||||
<field name="date" />
|
<field name="date" />
|
||||||
<field name="move_id" optional="show" />
|
<field name="move_id" optional="show" />
|
||||||
<field name="invoice_due_date" optional="show" />
|
<field name="invoice_due_date" optional="show" />
|
||||||
|
|
Loading…
Reference in New Issue