add some new quotation fields

This commit is contained in:
Àngel Àlvarez 2021-11-05 12:11:05 +01:00
parent 8b80165e22
commit 25de68f144
4 changed files with 30 additions and 7 deletions

View File

@ -820,9 +820,9 @@ class Property(tree(separator=' / '), sequence_ordered(), ModelSQL, ModelView):
exists_product = Product.search([('template.code', '=', template.code)])
if exists_product:
product = exists_product[0]
self.update_product_values(template, design, values, created_obj)
output = BomOutput()
output.bom = bom
output.product = product
@ -841,7 +841,7 @@ class Property(tree(separator=' / '), sequence_ordered(), ModelSQL, ModelView):
# if exists_bom:
# return {self: (exists_bom[0], res_obj)}
return {self: (bom, res_obj)}
def get_ratio_for_prices(self, values, ratio):
@ -1465,6 +1465,10 @@ class QuotationLine(ModelSQL, ModelView):
digits=(16, 4)), 'get_prices')
cost_price_no_manual = fields.Function(fields.Numeric(
'Cost Price No Manual', digits=price_digits), 'get_prices')
unit_price_per_mil = fields.Function(fields.Numeric('Cost/Qty',
digits=price_digits), 'get_prices')
unit_price_no_manual_per_mil = fields.Function(fields.Numeric('Cost(NoM)/Qty',
digits=price_digits), 'get_prices')
def get_rec_name(self, name):
return '%s - %s' % (str(self.quantity),
@ -1520,7 +1524,8 @@ class QuotationLine(ModelSQL, ModelView):
quantize = Decimal(str(10.0 ** -price_digits[1]))
for name in {'cost_price', 'list_price', 'margin', 'unit_price',
'material_cost_price', 'margin_material',
'cost_price_no_manual', 'margin_w_manual'}:
'cost_price_no_manual', 'margin_w_manual',
'unit_price_per_mil', 'unit_price_no_manual_per_mil'}:
res[name] = {}.fromkeys([x.id for x in quotations], Decimal(0))
for quote in quotations:
@ -1564,6 +1569,10 @@ class QuotationLine(ModelSQL, ModelView):
- material_cost_price)
res['margin_w_manual'][quote.id] = (res['list_price'][quote.id]
- cost_price)
res['unit_price_per_mil'][quote.id] = (
res['cost_price'][quote.id]/ Decimal(quote_quantity2))
res['unit_price_no_manual_per_mil'][quote.id] = (
res['cost_price_no_manual'][quote.id] / Decimal(quote_quantity2))
return res

View File

@ -312,7 +312,7 @@ msgstr "Preu de cost"
msgctxt "field:configurator.quotation.line,cost_price_no_manual:"
msgid "Cost Price No Manual"
msgstr "Preu Cost No manual"
msgstr "Preu Cost (NoM)"
msgctxt "field:configurator.quotation.line,design:"
msgid "Design"

View File

@ -40,9 +40,11 @@
<field name="quoted_by"/>
<label name="quotation_date"/>
<field name="quotation_date"/>
<field name="suppliers" colspan="4"/>
<field name="prices" colspan="4"/>
</page>
<page name="suppliers">
<field name="suppliers" colspan="4"/>
</page>
<page name="objects">
<field name="objects" colspan="4"/>
</page>

View File

@ -25,13 +25,25 @@
<field name="manual_list_price"/>
<newline/>
</group>
<group col="2" id="column4">
<group col="2" id="column4" colspan="2">
<label name="list_price"/>
<field name="list_price"/>
<label name="cost_price_no_manual"/>
<field name="cost_price_no_manual"/>
<label name="margin"/>
<field name="margin"/>
<label name="unit_price_no_manual_per_mil"/>
<field name="unit_price_no_manual_per_mil"/>
</group>
<group col="2" id="column5" colspan="2">
<label name="list_price"/>
<field name="list_price"/>
<label name="cost_price"/>
<field name="cost_price"/>
<label name="margin_w_manual"/>
<field name="margin_w_manual"/>
<label name="unit_price_per_mil"/>
<field name="unit_price_per_mil"/>
</group>
<field name="prices" colspan="8"/>
</form>