20.03.26
This commit is contained in:
@@ -168,6 +168,7 @@ def register():
|
||||
purchase.DocTypeTemplate,
|
||||
purchase.PurchaseStrategy,
|
||||
purchase.PriceComposition,
|
||||
purchase.QualityAnalysis,
|
||||
backtoback.Backtoback,
|
||||
dimension.AnalyticDimension,
|
||||
dimension.AnalyticDimensionValue,
|
||||
|
||||
@@ -528,6 +528,44 @@ class PriceComposition(ModelSQL,ModelView):
|
||||
line = fields.Many2One('purchase.line',"Purchase line")
|
||||
component = fields.Char("Component")
|
||||
price = fields.Numeric("Price")
|
||||
|
||||
class QualityAnalysis(ModelSQL,ModelView):
|
||||
__name__ = 'quality.analysis'
|
||||
|
||||
line = fields.Many2One('purchase.line',"Purchase Line")
|
||||
reference = fields.Char("Reference")
|
||||
date = fields.Date("Analysis date")
|
||||
attributes = fields.Dict(
|
||||
'product.attribute', 'Attributes',
|
||||
domain=[
|
||||
('sets', '=', Eval('attribute_set')),
|
||||
],
|
||||
states={
|
||||
'readonly': ~Eval('attribute_set'),
|
||||
},
|
||||
depends=['product', 'attribute_set'],
|
||||
help="Add attributes to the variant."
|
||||
)
|
||||
|
||||
product = fields.Function(
|
||||
fields.Many2One('product.product', "Product"),
|
||||
'on_change_with_product'
|
||||
)
|
||||
|
||||
attribute_set = fields.Function(
|
||||
fields.Many2One('product.attribute.set', "Attribute Set"),
|
||||
'on_change_with_attribute_set'
|
||||
)
|
||||
|
||||
@fields.depends('product')
|
||||
def on_change_with_attribute_set(self, name=None):
|
||||
if self.product and self.product.template and self.product.template.attribute_set:
|
||||
return self.product.template.attribute_set.id
|
||||
|
||||
@fields.depends('line')
|
||||
def on_change_with_product(self, name=None):
|
||||
if self.line:
|
||||
return self.line.product
|
||||
|
||||
class Line(metaclass=PoolMeta):
|
||||
__name__ = 'purchase.line'
|
||||
@@ -624,6 +662,8 @@ class Line(metaclass=PoolMeta):
|
||||
|
||||
finished = fields.Boolean("Mark as finished")
|
||||
|
||||
quality_analysis = fields.One2Many('quality.analysis','line',"Quality analysis")
|
||||
|
||||
@classmethod
|
||||
def default_finished(cls):
|
||||
return False
|
||||
|
||||
@@ -162,6 +162,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">price_composition_tree</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="quality_analysis_view_tree">
|
||||
<field name="model">quality.analysis</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">quality_analysis_tree</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Pnl Report"
|
||||
parent="purchase_trade.menu_global_reporting"
|
||||
|
||||
5
modules/purchase_trade/view/quality_analysis_tree.xml
Normal file
5
modules/purchase_trade/view/quality_analysis_tree.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<tree editable="1">
|
||||
<field name="reference"/>
|
||||
<field name="date"/>
|
||||
<field name="attributes"/>
|
||||
</tree>
|
||||
Reference in New Issue
Block a user