mirror of
https://github.com/OCA/stock-logistics-reporting.git
synced 2025-02-16 17:13:21 +02:00
[IMP] stock_card_report: black, isort, prettier
This commit is contained in:
committed by
ps-tubtim
parent
6a9eef7840
commit
f274130e65
1
setup/stock_card_report/odoo/addons/stock_card_report
Symbolic link
1
setup/stock_card_report/odoo/addons/stock_card_report
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../stock_card_report
|
||||
6
setup/stock_card_report/setup.py
Normal file
6
setup/stock_card_report/setup.py
Normal file
@@ -0,0 +1,6 @@
|
||||
import setuptools
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['setuptools-odoo'],
|
||||
odoo_addon=True,
|
||||
)
|
||||
@@ -6,21 +6,25 @@
|
||||
<field name="context" eval="{'active_model': 'report.stock.card.report'}" />
|
||||
</record>
|
||||
|
||||
<report string="Stock Card PDF"
|
||||
<report
|
||||
string="Stock Card PDF"
|
||||
id="action_stock_card_report_pdf"
|
||||
model="report.stock.card.report"
|
||||
name="stock_card_report.report_stock_card_report_pdf"
|
||||
file="stock_card_report.report_stock_card_report_pdf"
|
||||
report_type="qweb-pdf"
|
||||
print_report_name="'Stock Card Report - [%s]' % object.location_id.display_name"
|
||||
paperformat="stock_card_report.paperformat_stock_card"/>
|
||||
paperformat="stock_card_report.paperformat_stock_card"
|
||||
/>
|
||||
|
||||
<report string="Stock Card XLSX"
|
||||
<report
|
||||
string="Stock Card XLSX"
|
||||
id="action_stock_card_report_xlsx"
|
||||
model="report.stock.card.report"
|
||||
name="stock_card_report.report_stock_card_report_xlsx"
|
||||
file="Stock Card Report"
|
||||
report_type="xlsx"
|
||||
attachment_use="False"/>
|
||||
attachment_use="False"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,23 +1,36 @@
|
||||
<odoo>
|
||||
|
||||
<template id="assets_backend"
|
||||
name="stock_card_report assets" inherit_id="web.assets_backend">
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="stock_card_report assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<link href="/stock_card_report/static/src/css/report.css" rel="stylesheet"/>
|
||||
<script type="text/javascript"
|
||||
src="/stock_card_report/static/src/js/stock_card_report_backend.js"/>
|
||||
<link
|
||||
href="/stock_card_report/static/src/css/report.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/stock_card_report/static/src/js/stock_card_report_backend.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="stock_card_report.internal_layout">
|
||||
<div class="article">
|
||||
<link href="/stock_card_report/static/src/css/report.css" rel="stylesheet"/>
|
||||
<link
|
||||
href="/stock_card_report/static/src/css/report.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<t t-raw="0" />
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div class="row">
|
||||
<div class="col-6 custom_footer">
|
||||
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/>
|
||||
<span
|
||||
t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-6 text-right custom_footer">
|
||||
<span class="page" />/<span class="topage" />
|
||||
@@ -28,8 +41,12 @@
|
||||
|
||||
<template id="report_buttons">
|
||||
<div class="button_row">
|
||||
<button class="o_stock_card_reports_print btn btn-sm oe_button"><span class="fa fa-print"/>Print</button>
|
||||
<button class="o_stock_card_reports_export btn btn-sm oe_button"><span class="fa fa-download"/>Export</button>
|
||||
<button class="o_stock_card_reports_print btn btn-sm oe_button"><span
|
||||
class="fa fa-print"
|
||||
/>Print</button>
|
||||
<button class="o_stock_card_reports_export btn btn-sm oe_button"><span
|
||||
class="fa fa-download"
|
||||
/>Export</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -64,7 +81,10 @@
|
||||
<!-- Display header line-->
|
||||
<t t-call="stock_card_report.report_stock_card_lines_header" />
|
||||
<!-- Display initial lines -->
|
||||
<t t-set="initial" t-value="o._get_initial(o.results.filtered(lambda l: l.product_id == product and l.is_initial))"/>
|
||||
<t
|
||||
t-set="initial"
|
||||
t-value="o._get_initial(o.results.filtered(lambda l: l.product_id == product and l.is_initial))"
|
||||
/>
|
||||
<div class="act_as_row lines">
|
||||
<div class="act_as_cell" />
|
||||
<div class="act_as_cell">
|
||||
@@ -78,12 +98,18 @@
|
||||
</div>
|
||||
<!-- Display each lines -->
|
||||
<t t-set="product_balance" t-value="initial" />
|
||||
<t t-foreach="o.results.filtered(lambda l: l.product_id == product and not l.is_initial)" t-as="product_line">
|
||||
<t t-set="product_balance" t-value="product_balance + product_line.product_in - product_line.product_out"/>
|
||||
<t
|
||||
t-foreach="o.results.filtered(lambda l: l.product_id == product and not l.is_initial)"
|
||||
t-as="product_line"
|
||||
>
|
||||
<t
|
||||
t-set="product_balance"
|
||||
t-value="product_balance + product_line.product_in - product_line.product_out"
|
||||
/>
|
||||
<t t-call="stock_card_report.report_stock_card_lines" />
|
||||
</t>
|
||||
</div>
|
||||
<p style="page-break-before:always;"></p>
|
||||
<p style="page-break-before:always;" />
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
display: table-header-group !important;
|
||||
}
|
||||
.act_as_row.labels {
|
||||
background-color:#F0F0F0 !important;
|
||||
background-color: #f0f0f0 !important;
|
||||
}
|
||||
.data_table {
|
||||
width: 100% !important;
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
odoo.define('stock_card_report.stock_card_report_backend', function (require) {
|
||||
'use strict';
|
||||
|
||||
var AbstractAction = require('web.AbstractAction');
|
||||
var core = require('web.core');
|
||||
var ReportWidget = require('web.Widget');
|
||||
odoo.define("stock_card_report.stock_card_report_backend", function (require) {
|
||||
"use strict";
|
||||
|
||||
var AbstractAction = require("web.AbstractAction");
|
||||
var core = require("web.core");
|
||||
var ReportWidget = require("web.Widget");
|
||||
|
||||
var report_backend = AbstractAction.extend({
|
||||
hasControlPanel: true,
|
||||
// Stores all the parameters of the action.
|
||||
events: {
|
||||
'click .o_stock_card_reports_print': 'print',
|
||||
'click .o_stock_card_reports_export': 'export',
|
||||
"click .o_stock_card_reports_print": "print",
|
||||
"click .o_stock_card_reports_export": "export",
|
||||
},
|
||||
init: function (parent, action) {
|
||||
this._super.apply(this, arguments);
|
||||
@@ -22,8 +21,8 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
|
||||
if (action.context.context) {
|
||||
this.given_context = action.context.context;
|
||||
}
|
||||
this.given_context.active_id = action.context.active_id ||
|
||||
action.params.active_id;
|
||||
this.given_context.active_id =
|
||||
action.context.active_id || action.params.active_id;
|
||||
this.given_context.model = action.context.active_model || false;
|
||||
this.given_context.ttype = action.context.ttype || false;
|
||||
},
|
||||
@@ -35,7 +34,7 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
|
||||
var def = Promise.resolve();
|
||||
if (!this.report_widget) {
|
||||
this.report_widget = new ReportWidget(this, this.given_context);
|
||||
def = this.report_widget.appendTo(this.$('.o_content'));
|
||||
def = this.report_widget.appendTo(this.$(".o_content"));
|
||||
}
|
||||
def.then(function () {
|
||||
self.report_widget.$el.html(self.html);
|
||||
@@ -52,11 +51,10 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
|
||||
var defs = [];
|
||||
return this._rpc({
|
||||
model: this.given_context.model,
|
||||
method: 'get_html',
|
||||
method: "get_html",
|
||||
args: [self.given_context],
|
||||
context: self.odoo_context,
|
||||
})
|
||||
.then(function (result) {
|
||||
}).then(function (result) {
|
||||
self.html = result.html;
|
||||
defs.push(self.update_cp());
|
||||
return $.when.apply($, defs);
|
||||
@@ -81,8 +79,8 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
|
||||
var self = this;
|
||||
this._rpc({
|
||||
model: this.given_context.model,
|
||||
method: 'print_report',
|
||||
args: [this.given_context.active_id, 'qweb-pdf'],
|
||||
method: "print_report",
|
||||
args: [this.given_context.active_id, "qweb-pdf"],
|
||||
context: self.odoo_context,
|
||||
}).then(function (result) {
|
||||
self.do_action(result);
|
||||
@@ -92,8 +90,8 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
|
||||
var self = this;
|
||||
this._rpc({
|
||||
model: this.given_context.model,
|
||||
method: 'print_report',
|
||||
args: [this.given_context.active_id, 'xlsx'],
|
||||
method: "print_report",
|
||||
args: [this.given_context.active_id, "xlsx"],
|
||||
context: self.odoo_context,
|
||||
}).then(function (result) {
|
||||
self.do_action(result);
|
||||
@@ -104,9 +102,6 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
|
||||
},
|
||||
});
|
||||
|
||||
core.action_registry.add(
|
||||
"stock_card_report_backend",
|
||||
report_backend
|
||||
);
|
||||
core.action_registry.add("stock_card_report_backend", report_backend);
|
||||
return report_backend;
|
||||
});
|
||||
|
||||
@@ -17,12 +17,25 @@
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="button_export_html" string="View"
|
||||
type="object" default_focus="1" class="oe_highlight"/>
|
||||
<button
|
||||
name="button_export_html"
|
||||
string="View"
|
||||
type="object"
|
||||
default_focus="1"
|
||||
class="oe_highlight"
|
||||
/>
|
||||
or
|
||||
<button name="button_export_pdf" string="Export PDF" type="object"/>
|
||||
<button
|
||||
name="button_export_pdf"
|
||||
string="Export PDF"
|
||||
type="object"
|
||||
/>
|
||||
or
|
||||
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
|
||||
<button
|
||||
name="button_export_xlsx"
|
||||
string="Export XLSX"
|
||||
type="object"
|
||||
/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
@@ -37,9 +50,11 @@
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="stock_card_report_menu"
|
||||
<menuitem
|
||||
id="stock_card_report_menu"
|
||||
action="stock_card_report_action"
|
||||
parent="stock.menu_warehouse_report"
|
||||
sequence="30"/>
|
||||
sequence="30"
|
||||
/>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user