mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-11-02 20:30:20 -06:00
Merge branch 'master-upstream-patch-20092023' into 'master'
[PATCH] Upstream patch - 20092023 See merge request flectra-hq/flectra!1137
This commit is contained in:
commit
0d0d318ea4
3 files changed
+30
-4
No files matched your search
@@ -3,7 +3,7 @@
|
|||||||
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
|
<template id="report_invoice_document" inherit_id="account.report_invoice_document">
|
||||||
<xpath expr="//p[@name='note']" position="replace">
|
<xpath expr="//p[@name='note']" position="replace">
|
||||||
<p name="note">
|
<p name="note">
|
||||||
<t t-if="o.move_type == 'out_invoice' and o.fiscal_position_id.note">
|
<t t-if="o.company_id.country_id.code == 'IT' and o.fiscal_position_id.note">
|
||||||
<span t-field="o.fiscal_position_id.note"/>
|
<span t-field="o.fiscal_position_id.note"/>
|
||||||
</t>
|
</t>
|
||||||
<t t-else="">
|
<t t-else="">
|
||||||
|
|||||||
@@ -601,7 +601,10 @@ class ProductTemplate(models.Model):
|
|||||||
tracking = fields.Selection([
|
tracking = fields.Selection([
|
||||||
('serial', 'By Unique Serial Number'),
|
('serial', 'By Unique Serial Number'),
|
||||||
('lot', 'By Lots'),
|
('lot', 'By Lots'),
|
||||||
('none', 'No Tracking')], string="Tracking", help="Ensure the traceability of a storable product in your warehouse.", default='none', required=True)
|
('none', 'No Tracking')],
|
||||||
|
string="Tracking", required=True, default='none',
|
||||||
|
compute='_compute_tracking', store=True, readonly=False,
|
||||||
|
help="Ensure the traceability of a storable product in your warehouse.")
|
||||||
description_picking = fields.Text('Description on Picking', translate=True)
|
description_picking = fields.Text('Description on Picking', translate=True)
|
||||||
description_pickingout = fields.Text('Description on Delivery Orders', translate=True)
|
description_pickingout = fields.Text('Description on Delivery Orders', translate=True)
|
||||||
description_pickingin = fields.Text('Description on Receptions', translate=True)
|
description_pickingin = fields.Text('Description on Receptions', translate=True)
|
||||||
@@ -688,6 +691,12 @@ class ProductTemplate(models.Model):
|
|||||||
}
|
}
|
||||||
return prod_available
|
return prod_available
|
||||||
|
|
||||||
|
@api.depends('type')
|
||||||
|
def _compute_tracking(self):
|
||||||
|
self.filtered(
|
||||||
|
lambda t: not t.tracking or t.type in ('consu', 'service') and t.tracking != 'none'
|
||||||
|
).tracking = 'none'
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_action_view_related_putaway_rules(self, domain):
|
def _get_action_view_related_putaway_rules(self, domain):
|
||||||
return {
|
return {
|
||||||
@@ -744,8 +753,6 @@ class ProductTemplate(models.Model):
|
|||||||
@api.onchange('type')
|
@api.onchange('type')
|
||||||
def _onchange_type(self):
|
def _onchange_type(self):
|
||||||
res = super(ProductTemplate, self)._onchange_type() or {}
|
res = super(ProductTemplate, self)._onchange_type() or {}
|
||||||
if self.type == 'consu' and self.tracking != 'none':
|
|
||||||
self.tracking = 'none'
|
|
||||||
|
|
||||||
# Return a warning when trying to change the product type
|
# Return a warning when trying to change the product type
|
||||||
if self.ids and self.product_variant_ids.ids and self.env['stock.move.line'].sudo().search_count([
|
if self.ids and self.product_variant_ids.ids and self.env['stock.move.line'].sudo().search_count([
|
||||||
|
|||||||
@@ -276,3 +276,22 @@ class TestVirtualAvailable(TestStockCommon):
|
|||||||
res = self.env['product.template'].name_search(name='123', operator='not ilike')
|
res = self.env['product.template'].name_search(name='123', operator='not ilike')
|
||||||
res_ids = [r[0] for r in res]
|
res_ids = [r[0] for r in res]
|
||||||
self.assertNotIn(template.id, res_ids)
|
self.assertNotIn(template.id, res_ids)
|
||||||
|
|
||||||
|
def test_change_type_tracked_product(self):
|
||||||
|
product = self.env['product.template'].create({
|
||||||
|
'name': 'Brand new product',
|
||||||
|
'type': 'product',
|
||||||
|
'tracking': 'serial',
|
||||||
|
})
|
||||||
|
product_form = Form(product)
|
||||||
|
product_form.type = 'service'
|
||||||
|
product = product_form.save()
|
||||||
|
self.assertEqual(product.tracking, 'none')
|
||||||
|
|
||||||
|
product.type = 'product'
|
||||||
|
product.tracking = 'serial'
|
||||||
|
self.assertEqual(product.tracking, 'serial')
|
||||||
|
product_form = Form(product.product_variant_id)
|
||||||
|
product_form.type = 'service'
|
||||||
|
product = product_form.save()
|
||||||
|
self.assertEqual(product.tracking, 'none')
|
||||||
Reference in new issue
Block a user