[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",
"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",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://www.tecnativa.com",
"website": "https://github.com/OCA/web",
"license": "AGPL-3",
"depends": ["web_widget_one2many_product_picker", "sale_stock_info_popup",],
"data": ["templates/assets.xml",],
"qweb": ["static/src/xml/one2many_product_picker.xml",],
"depends": ["web_widget_one2many_product_picker", "sale_stock"],
"data": ["templates/assets.xml"],
"qweb": ["static/src/xml/one2many_product_picker.xml"],
"installable": True,
"auto_install": False,
}

View File

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

View File

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

View File

@ -5,7 +5,7 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.AbstractView", functi
) {
"use strict";
var AbstractView = require("web.AbstractView");
const AbstractView = require("web.AbstractView");
/**
* 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) {
if (viewInfo.model === "sale.order") {
var widget_name = $(viewInfo.arch)
const widget_name = $(viewInfo.arch)
.find("field[name='order_line']")
.attr("widget");
if (widget_name === "one2many_product_picker") {
@ -56,7 +56,7 @@ odoo.define("web_widget_one2many_product_picker_sale_stock.AbstractView", functi
* @param {Object} viewInfo
*/
_injectSaleStockFields: function(viewInfo) {
var to_inject = {
const to_inject = {
product_type: _constructFakeFieldDef({
depends: ["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
var field_names = Object.keys(to_inject);
var $arch = $(viewInfo.viewFields.order_line.views.form.arch);
for (var index in field_names) {
const field_names = Object.keys(to_inject);
const $arch = $(viewInfo.viewFields.order_line.views.form.arch);
for (const index in field_names) {
var field_name = field_names[index];
var $field = $arch.find("field[name='" + field_name + "']");
if (!$field.length) {

View File

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

View File

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

View File

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