mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-10-26 07:50:05 -05:00
[PATCH] Upstream patch - 10112021
This commit is contained in:
1 parent
bad747c859
commit
7fab2bb779
7 files changed
+63
-6
No files matched your search
@@ -118,7 +118,7 @@ class SaleOrder(models.Model):
|
||||
else:
|
||||
values['price_unit'] = price_unit
|
||||
if carrier.free_over and self.currency_id.is_zero(price_unit) :
|
||||
values['name'] += '\n' + 'Free Shipping'
|
||||
values['name'] += '\n' + _('Free Shipping')
|
||||
if self.order_line:
|
||||
values['sequence'] = self.order_line[-1].sequence + 1
|
||||
sol = SaleOrderLine.sudo().create(values)
|
||||
|
||||
@@ -169,6 +169,7 @@ class ReportBomStructure(models.AbstractModel):
|
||||
def _get_operation_line(self, bom, qty, level):
|
||||
operations = []
|
||||
total = 0.0
|
||||
qty = bom.product_uom_id._compute_quantity(qty, bom.product_tmpl_id.uom_id)
|
||||
for operation in bom.operation_ids:
|
||||
operation_cycle = float_round(qty / operation.workcenter_id.capacity, precision_rounding=1, rounding_method='UP')
|
||||
duration_expected = operation_cycle * operation.time_cycle + operation.workcenter_id.time_stop + operation.workcenter_id.time_start
|
||||
|
||||
@@ -497,6 +497,52 @@ class TestBoM(TestMrpCommon):
|
||||
# total price = 15.51 + crumble_cost + operation_cost(10 + 1.67 = 11.67) = 27.18 + crumble_cost
|
||||
self.assertEqual(float_compare(report_values['lines']['total'], 27.18 + crumble_cost, precision_digits=2), 0, 'Product Bom Price is not correct')
|
||||
|
||||
def test_bom_report_dozens(self):
|
||||
""" Simulate a drawer bom with dozens as bom units
|
||||
"""
|
||||
uom_dozen = self.env.ref('uom.product_uom_dozen')
|
||||
uom_unit = self.env.ref('uom.product_uom_unit')
|
||||
drawer = self.env['product.product'].create({
|
||||
'name': 'drawer',
|
||||
'type': 'product',
|
||||
'uom_id': uom_unit.id,
|
||||
'uom_po_id': uom_unit.id,
|
||||
})
|
||||
screw = self.env['product.product'].create({
|
||||
'name': 'screw',
|
||||
'type': 'product',
|
||||
'uom_id': uom_unit.id,
|
||||
'uom_po_id': uom_unit.id,
|
||||
'standard_price': 7.01
|
||||
})
|
||||
|
||||
bom_form_drawer = Form(self.env['mrp.bom'])
|
||||
bom_form_drawer.product_tmpl_id = drawer.product_tmpl_id
|
||||
bom_form_drawer.product_qty = 11
|
||||
bom_form_drawer.product_uom_id = uom_dozen
|
||||
bom_drawer = bom_form_drawer.save()
|
||||
|
||||
workcenter = self.env['mrp.workcenter'].create({
|
||||
'costs_hour': 10,
|
||||
'name': 'Deserts Table'
|
||||
})
|
||||
|
||||
with Form(bom_drawer) as bom:
|
||||
with bom.bom_line_ids.new() as line:
|
||||
line.product_id = screw
|
||||
line.product_uom_id = uom_unit
|
||||
line.product_qty = 5
|
||||
with bom.operation_ids.new() as operation:
|
||||
operation.workcenter_id = workcenter
|
||||
operation.name = 'Screw drawer'
|
||||
operation.time_cycle_manual = 5
|
||||
|
||||
# TEST BOM STRUCTURE VALUE WITH BOM QUANTITY
|
||||
report_values = self.env['report.mrp.report_bom_structure']._get_report_data(bom_id=bom_drawer.id, searchQty=11, searchVariant=False)
|
||||
# 5 min 'Prepare biscuits' + 3 min 'Prepare butter' + 5 min 'Mix manually' = 13 minutes
|
||||
self.assertEqual(report_values['lines']['operations_time'], 60.0, 'Operation time should be the same for 1 unit or for the batch')
|
||||
|
||||
|
||||
def test_21_bom_report_variant(self):
|
||||
""" Test a sub BoM process with multiple variants.
|
||||
BOM 1:
|
||||
|
||||
@@ -63,3 +63,13 @@
|
||||
text-align: center;
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.responsive-price {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.responsive-price > .pos-receipt-right-align {
|
||||
margin-left: auto;
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
<div class="orderlines">
|
||||
<t t-foreach="products" t-as="line" t-key="line.product_id">
|
||||
<div>
|
||||
<div class="responsive-price">
|
||||
<t t-esc="line.product_name.substr(0,20)" />
|
||||
<span class="pos-receipt-right-align">
|
||||
<t t-esc="Math.round(line.quantity * Math.pow(10, pos.dp['Product Unit of Measure'])) / Math.pow(10, pos.dp['Product Unit of Measure'])" />
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
<div class="orderlines">
|
||||
<t t-foreach="receipt.orderlines" t-as="line" t-key="line.id">
|
||||
<t t-if="isSimple(line)">
|
||||
<div>
|
||||
<div class="responsive-price">
|
||||
<t t-esc="line.product_name_wrapped[0]" />
|
||||
<span t-esc="env.pos.format_currency_no_symbol(line.price_display)" class="price_display pos-receipt-right-align"/>
|
||||
</div>
|
||||
@@ -111,7 +111,7 @@
|
||||
<br/>
|
||||
<div>Subtotal<span t-esc="env.pos.format_currency(receipt.subtotal)" class="pos-receipt-right-align"/></div>
|
||||
<t t-foreach="receipt.tax_details" t-as="tax" t-key="tax.name">
|
||||
<div>
|
||||
<div class="responsive-price">
|
||||
<t t-esc="tax.name" />
|
||||
<span t-esc='env.pos.format_currency_no_symbol(tax.amount)' class="pos-receipt-right-align"/>
|
||||
</div>
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
<!-- Editor top bar which contains the summernote tools and save/discard buttons -->
|
||||
<t t-name="website.editorbar">
|
||||
<div class="o_we_website_top_actions">
|
||||
<div class="o_we_external_history_buttons">
|
||||
<div class="o_we_external_history_buttons d-flex">
|
||||
<button type="button" data-action="undo" class="btn btn-secondary fa fa-undo"/>
|
||||
<button type="button" data-action="redo" class="btn btn-secondary fa fa-repeat"/>
|
||||
</div>
|
||||
<form class="ml-auto">
|
||||
<form class="ml-auto d-flex">
|
||||
<button type="button" class="btn btn-secondary" data-action="cancel" accesskey="j">Discard</button>
|
||||
<button type="button" class="btn btn-primary" data-action="save" accesskey="s">Save</button>
|
||||
</form>
|
||||
|
||||
Reference in new issue
Block a user