[imp] in Webshop show max qty as ordered qty and show missing items per package
This commit is contained in:
parent
d7ed048c21
commit
d815505705
11 changed files with 22 additions and 11 deletions
|
|
@ -36,6 +36,7 @@ Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
:0.0.1: Initial module.
|
:0.0.1: Initial module.
|
||||||
|
:1.0.0: Live
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"author": "BAKEUP",
|
"author": "BAKEUP",
|
||||||
"website": "https://www.bakeup.org",
|
"website": "https://www.bakeup.org",
|
||||||
"category": "website",
|
"category": "website",
|
||||||
"version": "16.0.0.0.1",
|
"version": "16.0.1.0.0",
|
||||||
"depends": ["website_sale", "nfu_sale_order_batch_packaging"],
|
"depends": ["website_sale", "nfu_sale_order_batch_packaging"],
|
||||||
"data": ["views/templates.xml"],
|
"data": ["views/templates.xml"],
|
||||||
"assets": {"web.assets_frontend": ["nfu_ecommerce/static/src/js/website_sale.js"]},
|
"assets": {"web.assets_frontend": ["nfu_ecommerce/static/src/js/website_sale.js"]},
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,6 @@ class SaleOrderLine(models.Model):
|
||||||
|
|
||||||
def compute_open_packages(self):
|
def compute_open_packages(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
open_qty = self.batch_uom_qty % self.product_packaging_id.qty
|
qty_of_last_pack = self.batch_uom_qty % self.product_packaging_id.qty
|
||||||
|
open_qty = self.product_packaging_id.qty - qty_of_last_pack
|
||||||
return open_qty
|
return open_qty
|
||||||
|
|
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
:0.0.1: Initial module.
|
:0.0.1: Initial module.
|
||||||
|
:1.0.0: Live
|
||||||
|
|
@ -395,6 +395,8 @@ and after the current order.</p>
|
||||||
<tbody valign="top">
|
<tbody valign="top">
|
||||||
<tr class="field"><th class="field-name">0.0.1:</th><td class="field-body">Initial module.</td>
|
<tr class="field"><th class="field-name">0.0.1:</th><td class="field-body">Initial module.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">1.0.0:</th><td class="field-body">Live</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
<span>Open Package: <t t-esc="line.compute_open_packages()"/>/<t
|
<span>Open Package: <t t-esc="line.compute_open_packages()"/>/<t
|
||||||
t-esc="line.product_packaging_id.qty"
|
t-esc="line.product_packaging_id.qty"
|
||||||
/><br/></span>
|
/><br/></span>
|
||||||
<span>Total Ordered Quantity: <t t-esc="line.batch_uom_qty"/></span>
|
<span>Ordered Quantity: <t t-esc="line.batch_uom_max_qty"/></span>
|
||||||
</div>
|
</div>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//th[hasclass('td-qty')]" position="after">
|
<xpath expr="//th[hasclass('td-qty')]" position="after">
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ Changelog
|
||||||
|
|
||||||
:0.0.1: Initial module.
|
:0.0.1: Initial module.
|
||||||
:1.0.0: rename to nfu_sale_order_batch_packaging
|
:1.0.0: rename to nfu_sale_order_batch_packaging
|
||||||
|
:1.1.0: Live
|
||||||
|
|
||||||
Bug Tracker
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"author": "BAKEUP",
|
"author": "BAKEUP",
|
||||||
"website": "https://www.bakeup.org",
|
"website": "https://www.bakeup.org",
|
||||||
"category": "Sale",
|
"category": "Sale",
|
||||||
"version": "16.0.1.0.0",
|
"version": "16.0.1.1.0",
|
||||||
"depends": ["sale", "sale_order_batch"],
|
"depends": ["sale", "sale_order_batch"],
|
||||||
"data": [
|
"data": [
|
||||||
"views/sale_order_views.xml",
|
"views/sale_order_views.xml",
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ class SaleOrderLine(models.Model):
|
||||||
product_uom_ordered_qty = fields.Float(string="Ordered Qty", digits="Product Unit of Measure", default=1.0)
|
product_uom_ordered_qty = fields.Float(string="Ordered Qty", digits="Product Unit of Measure", default=1.0)
|
||||||
product_uom_max_qty = fields.Float(string="Max Qty", digits="Product Unit of Measure")
|
product_uom_max_qty = fields.Float(string="Max Qty", digits="Product Unit of Measure")
|
||||||
batch_uom_qty = fields.Float(compute="_compute_batch_uom_qty")
|
batch_uom_qty = fields.Float(compute="_compute_batch_uom_qty")
|
||||||
|
batch_uom_max_qty = fields.Float(compute="_compute_batch_uom_qty")
|
||||||
|
|
||||||
@api.constrains("product_uom_qty", "product_uom_max_qty")
|
@api.constrains("product_uom_qty", "product_uom_max_qty")
|
||||||
def _check_product_uom_qty(self):
|
def _check_product_uom_qty(self):
|
||||||
|
|
@ -21,20 +22,21 @@ class SaleOrderLine(models.Model):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.depends("product_uom_qty")
|
@api.depends("product_uom_qty", "product_uom_max_qty")
|
||||||
def _compute_batch_uom_qty(self):
|
def _compute_batch_uom_qty(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
if line.order_id.batch_id:
|
if line.order_id.batch_id:
|
||||||
batch_id = line.batch_id
|
batch_id = line.batch_id
|
||||||
product_id = line.product_id
|
product_id = line.product_id
|
||||||
batch_uom_qtys = (
|
batch_lines = (
|
||||||
self.env["sale.order.line"]
|
self.env["sale.order.line"]
|
||||||
.sudo()
|
.sudo()
|
||||||
.search([("batch_id", "=", batch_id.id), ("product_id", "=", product_id.id)])
|
.search([("batch_id", "=", batch_id.id), ("product_id", "=", product_id.id)])
|
||||||
).mapped("product_uom_qty")
|
)
|
||||||
line.batch_uom_qty = sum(batch_uom_qtys)
|
line.batch_uom_qty = sum(batch_lines.mapped("product_uom_qty"))
|
||||||
|
line.batch_uom_max_qty = sum(batch_lines.mapped("product_uom_max_qty"))
|
||||||
else:
|
else:
|
||||||
line.batch_uom_qty = 0
|
line.batch_uom_max_qty = line.batch_uom_qty = 0
|
||||||
|
|
||||||
@api.depends("product_packaging_id", "product_uom", "product_uom_qty", "batch_id")
|
@api.depends("product_packaging_id", "product_uom", "product_uom_qty", "batch_id")
|
||||||
def _compute_product_packaging_qty(self):
|
def _compute_product_packaging_qty(self):
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
:0.0.1: Initial module.
|
:0.0.1: Initial module.
|
||||||
:1.0.0: rename to nfu_sale_order_batch_packaging
|
:1.0.0: rename to nfu_sale_order_batch_packaging
|
||||||
|
:1.1.0: Live
|
||||||
|
|
@ -395,6 +395,8 @@ and adds a packaging default to sale order batch.</p>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="field"><th class="field-name">1.0.0:</th><td class="field-body">rename to nfu_sale_order_batch_packaging</td>
|
<tr class="field"><th class="field-name">1.0.0:</th><td class="field-body">rename to nfu_sale_order_batch_packaging</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="field"><th class="field-name">1.1.0:</th><td class="field-body">Live</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue