[MIG] web_widget_one2many_product_picker_sale_stock: Migration to 13.0

pull/1873/head
Alexandre D. Díaz 2021-03-22 19:54:05 +01:00
parent 6e94d0a7d2
commit e6d21552a9
7 changed files with 25 additions and 27 deletions

View File

@ -4,14 +4,14 @@
{ {
"name": "Web Widget One2Many Product Picker Sale Stock", "name": "Web Widget One2Many Product Picker Sale Stock",
"summary": "Adds support for stock in the one2many product picker widget", "summary": "Adds support for stock in the one2many product picker widget",
"version": "12.0.1.0.0", "version": "13.0.1.0.0",
"category": "Website", "category": "Website",
"author": "Tecnativa, " "Odoo Community Association (OCA)", "author": "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://www.tecnativa.com", "website": "https://github.com/OCA/web",
"license": "AGPL-3", "license": "AGPL-3",
"depends": ["web_widget_one2many_product_picker", "sale_stock_info_popup",], "depends": ["web_widget_one2many_product_picker", "sale_stock"],
"data": ["templates/assets.xml",], "data": ["templates/assets.xml"],
"qweb": ["static/src/xml/one2many_product_picker.xml",], "qweb": ["static/src/xml/one2many_product_picker.xml"],
"installable": True, "installable": True,
"auto_install": False, "auto_install": False,
} }

View File

@ -5,7 +5,7 @@ odoo.define(
function(require) { function(require) {
"use strict"; "use strict";
var One2ManyProductPickerRecord = require("web_widget_one2many_product_picker.One2ManyProductPickerRecord"); const One2ManyProductPickerRecord = require("web_widget_one2many_product_picker.One2ManyProductPickerRecord");
One2ManyProductPickerRecord.include({ One2ManyProductPickerRecord.include({
/** /**

View File

@ -5,13 +5,13 @@ odoo.define(
function(require) { function(require) {
"use strict"; "use strict";
var One2ManyProductPickerRenderer = require("web_widget_one2many_product_picker.One2ManyProductPickerRenderer"); const One2ManyProductPickerRenderer = require("web_widget_one2many_product_picker.One2ManyProductPickerRenderer");
One2ManyProductPickerRenderer.include({ One2ManyProductPickerRenderer.include({
/** /**
* @override * @override
*/ */
_getRecordOptions: function(search_record) { _getRecordOptions: function() {
var options = this._super.apply(this, arguments); var options = this._super.apply(this, arguments);
options.showSaleStock = this.options.show_sale_stock; options.showSaleStock = this.options.show_sale_stock;
return options; return options;

View File

@ -5,7 +5,7 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.AbstractView", functi
) { ) {
"use strict"; "use strict";
var AbstractView = require("web.AbstractView"); const AbstractView = require("web.AbstractView");
/** /**
* Helper function to create field view definitions * Helper function to create field view definitions
@ -40,7 +40,7 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.AbstractView", functi
*/ */
init: function(viewInfo, params) { init: function(viewInfo, params) {
if (viewInfo.model === "sale.order") { if (viewInfo.model === "sale.order") {
var widget_name = $(viewInfo.arch) const widget_name = $(viewInfo.arch)
.find("field[name='order_line']") .find("field[name='order_line']")
.attr("widget"); .attr("widget");
if (widget_name === "one2many_product_picker") { if (widget_name === "one2many_product_picker") {
@ -56,7 +56,7 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.AbstractView", functi
* @param {Object} viewInfo * @param {Object} viewInfo
*/ */
_injectSaleStockFields: function(viewInfo) { _injectSaleStockFields: function(viewInfo) {
var to_inject = { const to_inject = {
product_type: _constructFakeFieldDef({ product_type: _constructFakeFieldDef({
depends: ["product_id.type"], depends: ["product_id.type"],
related: ["product_id", "type"], related: ["product_id", "type"],
@ -149,9 +149,9 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.AbstractView", functi
); );
// Add fields to arch // Add fields to arch
var field_names = Object.keys(to_inject); const field_names = Object.keys(to_inject);
var $arch = $(viewInfo.viewFields.order_line.views.form.arch); const $arch = $(viewInfo.viewFields.order_line.views.form.arch);
for (var index in field_names) { for (const index in field_names) {
var field_name = field_names[index]; var field_name = field_names[index];
var $field = $arch.find("field[name='" + field_name + "']"); var $field = $arch.find("field[name='" + field_name + "']");
if (!$field.length) { if (!$field.length) {

View File

@ -5,7 +5,7 @@ odoo.define(
function(require) { function(require) {
"use strict"; "use strict";
var FieldOne2ManyProductPicker = require("web_widget_one2many_product_picker.FieldOne2ManyProductPicker"); const FieldOne2ManyProductPicker = require("web_widget_one2many_product_picker.FieldOne2ManyProductPicker");
FieldOne2ManyProductPicker.include({ FieldOne2ManyProductPicker.include({
/** /**

View File

@ -21,20 +21,18 @@
.oe_flip_card_inner { .oe_flip_card_inner {
.stock_info { .stock_info {
top: 50%; top: 5px;
left: 5px; right: 8px;
transform: translateY(-50%);
> .o_widget { > .o_widget {
> div { > div {
background-color: white; background-color: white;
border-radius: 50%; border-radius: 50%;
width: 2.5em; width: 2em;
height: 2.5em; height: 2em;
.fa { .fa {
margin-top: -3px; font-size: 2.5em;
font-size: 3em;
} }
} }
} }

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<template> <template>
<t t-extend="One2ManyProductPicker.FlipCard"> <t t-extend="One2ManyProductPicker.FlipCard.Front">
<t <t
t-jquery="div[t-attf-class*=oe_flip_card_front] t[t-if='state']" t-jquery="t[t-call='One2ManyProductPicker.ActionButton']"
t-operation="append" t-operation="after"
> >
<t t-if="state.model === 'sale.order.line'"> <t t-if="has_onchange &amp;&amp; state.model === 'sale.order.line'">
<div class="position-absolute m-0 text-left stock_info"> <div class="position-absolute m-0 stock_info">
<widget name="qty_at_date_widget" width="0.1" /> <widget name="qty_at_date_widget" width="0.1" />
</div> </div>
</t> </t>