mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-22 17:42:00 +02:00
Initial commit: Accounting packages
This commit is contained in:
commit
4ef34c2317
2661 changed files with 1709616 additions and 0 deletions
|
|
@ -0,0 +1,48 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
|
||||
const { Component } = owl;
|
||||
|
||||
export class JournalDashboardActivity extends Component {
|
||||
setup() {
|
||||
this.action = useService("action");
|
||||
this.MAX_ACTIVITY_DISPLAY = 5;
|
||||
this.formatData(this.props);
|
||||
}
|
||||
|
||||
formatData(props) {
|
||||
this.info = JSON.parse(this.props.value);
|
||||
this.info.more_activities = false;
|
||||
if (this.info.activities.length > this.MAX_ACTIVITY_DISPLAY) {
|
||||
this.info.more_activities = true;
|
||||
this.info.activities = this.info.activities.slice(0, this.MAX_ACTIVITY_DISPLAY);
|
||||
}
|
||||
}
|
||||
|
||||
async openActivity(activity) {
|
||||
this.action.doAction({
|
||||
type: 'ir.actions.act_window',
|
||||
name: this.env._t('Journal Entry'),
|
||||
target: 'current',
|
||||
res_id: activity.res_id,
|
||||
res_model: 'account.move',
|
||||
views: [[false, 'form']],
|
||||
});
|
||||
}
|
||||
|
||||
openAllActivities(e) {
|
||||
this.action.doAction({
|
||||
type: 'ir.actions.act_window',
|
||||
name: this.env._t('Journal Entries'),
|
||||
res_model: 'account.move',
|
||||
views: [[false, 'kanban'], [false, 'form']],
|
||||
search_view_id: [false],
|
||||
domain: [['journal_id', '=', this.props.record.resId], ['activity_ids', '!=', false]],
|
||||
});
|
||||
}
|
||||
}
|
||||
JournalDashboardActivity.template = "account.JournalDashboardActivity";
|
||||
|
||||
registry.category("fields").add("kanban_vat_activity", JournalDashboardActivity);
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<templates>
|
||||
|
||||
<t t-name="account.JournalDashboardActivity" owl="1">
|
||||
<t t-foreach="info.activities" t-as="activity" t-key="activity_index">
|
||||
<div class="row">
|
||||
<div class="col-8 o_mail_activity">
|
||||
<a href="#"
|
||||
t-att-class="(activity.status == 'late' ? 'o_activity_color_overdue ' : ' ') + (activity.activity_category == 'tax_report' ? 'o_open_vat_report' : 'see_activity')"
|
||||
t-att-data-res-id="activity.res_id" t-att-data-id="activity.id" t-att-data-model="activity.res_model"
|
||||
t-on-click.stop.prevent="() => this.openActivity(activity)">
|
||||
<t t-esc="activity.name"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
<span><t t-esc="activity.date"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<a t-if="info.more_activities" class="float-end see_all_activities" href="#" t-on-click.stop.prevent="(ev) => this.openAllActivities(ev)">See all activities</a>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
Loading…
Add table
Add a link
Reference in a new issue