[add] unfinisched packages warning
This commit is contained in:
parent
4569ce9655
commit
46bf4d5c1a
8 changed files with 76 additions and 6 deletions
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
|
@ -13,7 +13,7 @@
|
||||||
"--addons-path=${config:odoo.addons_path},${workspaceFolder}",
|
"--addons-path=${config:odoo.addons_path},${workspaceFolder}",
|
||||||
"--limit-time-real=0",
|
"--limit-time-real=0",
|
||||||
"--limit-time-cpu=0",
|
"--limit-time-cpu=0",
|
||||||
"--init=sale_order_batch",
|
"--update=sale_order_batch,nfu_sale_order_packaging",
|
||||||
// "--update=",
|
// "--update=",
|
||||||
"--dev=xml"
|
"--dev=xml"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
"category": "Stock",
|
"category": "Stock",
|
||||||
"version": "16.0.0.0.1",
|
"version": "16.0.0.0.1",
|
||||||
"depends": ["sale", "sale_order_batch"],
|
"depends": ["sale", "sale_order_batch"],
|
||||||
"data": ["views/sale_order_views.xml", "views/sale_order_batch_views.xml"],
|
"data": [
|
||||||
|
"views/sale_order_views.xml",
|
||||||
|
"views/sale_order_batch_views.xml",
|
||||||
|
"views/sale_order_batch_product_views.xml",
|
||||||
|
],
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,18 @@
|
||||||
from odoo import api, models
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class SaleOrderBatchProduct(models.Model):
|
class SaleOrderBatchProduct(models.Model):
|
||||||
_inherit = "sale.order.batch.product"
|
_inherit = "sale.order.batch.product"
|
||||||
|
|
||||||
|
open_packaging_qty = fields.Float(compute="_compute_open_packagin_qty")
|
||||||
|
|
||||||
|
@api.depends("sale_order_line_ids.product_uom_qty")
|
||||||
|
def _compute_open_packagin_qty(self):
|
||||||
|
for product in self:
|
||||||
|
product.open_packaging_qty = (
|
||||||
|
sum(product.sale_order_line_ids.mapped("product_uom_qty")) % product.product_packaging_qty
|
||||||
|
)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
for vals in vals_list:
|
for vals in vals_list:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record id="view_order_batch_product_form" model="ir.ui.view">
|
||||||
|
<field name="name">sale.order.batch.product.form.nfu</field>
|
||||||
|
<field name="model">sale.order.batch.product</field>
|
||||||
|
<field name="inherit_id" ref="sale_order_batch.view_order_batch_product_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='batch_id']" position="after">
|
||||||
|
<field name="open_packaging_qty" decoration-warning="(open_packaging_qty != 0)"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
"data": [
|
"data": [
|
||||||
"data/ir_sequence_data.xml",
|
"data/ir_sequence_data.xml",
|
||||||
"views/sale_order_batch_views.xml",
|
"views/sale_order_batch_views.xml",
|
||||||
|
"views/sale_order_batch_product_views.xml",
|
||||||
"views/sale_order_views.xml",
|
"views/sale_order_views.xml",
|
||||||
"views/sale_menus.xml",
|
"views/sale_menus.xml",
|
||||||
"security/ir.model.access.csv",
|
"security/ir.model.access.csv",
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,15 @@ class SaleOrderBatchProduct(models.Model):
|
||||||
ondelete="cascade",
|
ondelete="cascade",
|
||||||
index=True,
|
index=True,
|
||||||
copy=False,
|
copy=False,
|
||||||
|
readonly=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
product_id = fields.Many2one(comodel_name="product.product", required=True, readonly=False)
|
product_id = fields.Many2one(comodel_name="product.product", required=True, readonly=True)
|
||||||
|
|
||||||
product_template_id = fields.Many2one(
|
product_template_id = fields.Many2one(
|
||||||
"product.template", related="product_id.product_tmpl_id", string="Product Template"
|
"product.template", related="product_id.product_tmpl_id", string="Product Template"
|
||||||
)
|
)
|
||||||
sale_order_line_ids = fields.Many2many("sale.order.line", compute="_compute_sale_order_line_ids")
|
sale_order_line_ids = fields.Many2many("sale.order.line", compute="_compute_sale_order_line_ids", store=True)
|
||||||
product_uom_category_id = fields.Many2one(related="product_id.uom_id.category_id", depends=["product_id"])
|
product_uom_category_id = fields.Many2one(related="product_id.uom_id.category_id", depends=["product_id"])
|
||||||
product_uom_qty = fields.Float(compute="_compute_uom_qty")
|
product_uom_qty = fields.Float(compute="_compute_uom_qty")
|
||||||
product_uom = fields.Many2one(related="product_id.uom_id")
|
product_uom = fields.Many2one(related="product_id.uom_id")
|
||||||
|
|
|
||||||
42
sale_order_batch/views/sale_order_batch_product_views.xml
Normal file
42
sale_order_batch/views/sale_order_batch_product_views.xml
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<odoo>
|
||||||
|
<record id="view_order_batch_product_form" model="ir.ui.view">
|
||||||
|
<field name="name">sale.order.batch.product.form</field>
|
||||||
|
<field name="model">sale.order.batch.product</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form>
|
||||||
|
<sheet>
|
||||||
|
<div class="oe_button_box" name="button_box">
|
||||||
|
</div>
|
||||||
|
<h1>
|
||||||
|
<field name="product_id"/>
|
||||||
|
</h1>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="batch_id"/>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="product_packaging_id"/>
|
||||||
|
<field name="product_packaging_qty"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
<notebook>
|
||||||
|
<page string="Sale Order Lines" name="order_line">
|
||||||
|
<field name="sale_order_line_ids" widget="section_and_note_one2many">
|
||||||
|
<tree editable="bottom">
|
||||||
|
<field name="sequence" widget="handle"/>
|
||||||
|
<field name="order_partner_id"/>
|
||||||
|
<field name="product_template_id"/>
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="product_uom_qty"/>
|
||||||
|
<field name="price_unit"/>
|
||||||
|
<field name="price_subtotal"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</odoo>
|
||||||
|
|
@ -106,7 +106,7 @@
|
||||||
</page>
|
</page>
|
||||||
<page string="Products" name="products">
|
<page string="Products" name="products">
|
||||||
<field name="product_ids">
|
<field name="product_ids">
|
||||||
<tree create="0" editable="1">
|
<tree create="0">
|
||||||
<field name="product_template_id"/>
|
<field name="product_template_id"/>
|
||||||
<field name="product_uom_qty"/>
|
<field name="product_uom_qty"/>
|
||||||
<field name="product_packaging_qty" groups="product.group_stock_packaging"/>
|
<field name="product_packaging_qty" groups="product.group_stock_packaging"/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue