Coffee form

This commit is contained in:
2026-07-16 21:22:34 +02:00
parent aba25d62dc
commit 8be68db6db
6 changed files with 127 additions and 126 deletions

View File

@@ -1128,14 +1128,7 @@ class CoffeeLineMixin:
coffee_packing_weight_unit = fields.Many2One(
'product.uom', 'Package weight unit')
coffee_packing_unit = fields.Many2One(
'product.uom', 'Package unit',
domain=[
('category', '=', Eval('coffee_packing_category')),
],
depends=['coffee_packing_category'])
coffee_packing_category = fields.Function(
fields.Many2One('product.uom.category', 'Packing Category'),
'on_change_with_coffee_packing_category')
'product.uom', 'Package unit')
coffee_packing_description = fields.Char('Packing description')
coffee_market_reference = fields.Many2One(
'price.price', 'Market reference')
@@ -1151,13 +1144,6 @@ class CoffeeLineMixin:
def on_change_with_active_coffee_compatibility(self, name=None):
return self.get_active_coffee_compatibility(name)
@fields.depends()
def on_change_with_coffee_packing_category(self, name=None):
UnitCategory = Pool().get('product.uom.category')
packing = UnitCategory.search([('name', '=', 'Packing')], limit=1)
if packing:
return packing[0]
def _coffee_attributes_name(self):
values = []
for field_name, selection in self._coffee_attribute_name_fields:

View File

@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<tree sequence="sequence">
<field name="sequence"/>
<field name="sample"/>
<field name="public_origin"/>
<field name="public_coffee_type"/>
<field name="cups_per_sample"/>
<field name="result_count"/>
<field name="average_score"/>
<field name="defect_count"/>
<field name="decision"/>
<field name="sequence" width="70"/>
<field name="sample" width="160"/>
<field name="public_origin" width="120"/>
<field name="public_coffee_type" width="110"/>
<field name="cups_per_sample" width="110"/>
<field name="result_count" width="90"/>
<field name="average_score" width="90"/>
<field name="defect_count" width="100"/>
<field name="decision" width="110"/>
</tree>

View File

@@ -1,14 +1,14 @@
<?xml version="1.0"?>
<tree>
<field name="sample"/>
<field name="lab"/>
<field name="state"/>
<field name="sent_date"/>
<field name="due_date"/>
<field name="received_date"/>
<field name="report_reference"/>
<field name="moisture"/>
<field name="defect_count"/>
<field name="cup_score"/>
<field name="compliant"/>
<field name="sample" width="160"/>
<field name="lab" width="140"/>
<field name="state" width="110"/>
<field name="sent_date" width="100"/>
<field name="due_date" width="100"/>
<field name="received_date" width="100"/>
<field name="report_reference" width="140"/>
<field name="moisture" width="90"/>
<field name="defect_count" width="100"/>
<field name="cup_score" width="90"/>
<field name="compliant" width="90"/>
</tree>

View File

@@ -1,100 +1,117 @@
<?xml version="1.0"?>
<form col="12">
<group id="sample_summary" colspan="12" col="8">
<group id="sample_summary" colspan="12" col="8"
col_widths="min-content,1.2fr,min-content,0.8fr,min-content,0.8fr,min-content,0.8fr">
<label name="reference"/>
<field name="reference"/>
<field name="reference" width="220" xexpand="0" xfill="0"/>
<label name="state"/>
<field name="state"/>
<field name="state" width="160" xexpand="0" xfill="0"/>
<label name="quality_status"/>
<field name="quality_status"/>
<field name="quality_status" width="140" xexpand="0" xfill="0"/>
<label name="recommended_decision"/>
<field name="recommended_decision"/>
<field name="recommended_decision" width="140" xexpand="0" xfill="0"/>
</group>
<button name="receive" string="Receive"/>
<button name="send_to_lab" string="Send to lab"/>
<button name="review" string="Review"/>
<button name="evaluate_quality" string="Evaluate quality"/>
<button name="approve" string="Approve"/>
<button name="reject" string="Reject"/>
<button name="expire" string="Expire"/>
<button name="archive" string="Archive"/>
<button name="reset_to_requested" string="Reset"/>
<newline/>
<group id="sample_identity" string="Sample identity" colspan="6" col="4">
<label name="direction"/>
<field name="direction"/>
<label name="sample_type"/>
<field name="sample_type"/>
<label name="purchase_line"/>
<field name="purchase_line"/>
<label name="sale_line"/>
<field name="sale_line"/>
<label name="lot"/>
<field name="lot"/>
<label name="product"/>
<field name="product"/>
<label name="party"/>
<field name="party"/>
<label name="public_origin"/>
<field name="public_origin"/>
<label name="public_coffee_type"/>
<field name="public_coffee_type"/>
<group id="sample_actions" colspan="12" col="9"
col_widths="1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr,1fr">
<button name="receive" string="Receive"/>
<button name="send_to_lab" string="Send to lab"/>
<button name="review" string="Review"/>
<button name="evaluate_quality" string="Evaluate quality"/>
<button name="approve" string="Approve"/>
<button name="reject" string="Reject"/>
<button name="expire" string="Expire"/>
<button name="archive" string="Archive"/>
<button name="reset_to_requested" string="Reset"/>
</group>
<group id="sample_lifecycle" string="Lifecycle" colspan="6" col="4">
<label name="requested_date"/>
<field name="requested_date"/>
<label name="received_date"/>
<field name="received_date"/>
<label name="sent_date"/>
<field name="sent_date"/>
<label name="review_date"/>
<field name="review_date"/>
<label name="decision_date"/>
<field name="decision_date"/>
<label name="shelf_life_days"/>
<field name="shelf_life_days"/>
<label name="expiry_date"/>
<field name="expiry_date"/>
<label name="expires_soon"/>
<field name="expires_soon"/>
<group id="sample_left_column" colspan="7" col="1" col_widths="1fr">
<group id="sample_identity" string="Sample identity" colspan="1" col="4"
col_widths="min-content,1fr,min-content,1fr">
<label name="direction"/>
<field name="direction" width="160" xexpand="0" xfill="0"/>
<label name="sample_type"/>
<field name="sample_type" width="220" xexpand="0" xfill="0"/>
<label name="purchase_line"/>
<field name="purchase_line" colspan="3"/>
<label name="sale_line"/>
<field name="sale_line" colspan="3"/>
<label name="lot"/>
<field name="lot"/>
<label name="product"/>
<field name="product"/>
<label name="party"/>
<field name="party"/>
<label name="public_origin"/>
<field name="public_origin" width="160" xexpand="0" xfill="0"/>
<label name="public_coffee_type"/>
<field name="public_coffee_type" width="140" xexpand="0" xfill="0"/>
</group>
<group id="sample_storage" string="Sample storage" colspan="1" col="4"
col_widths="min-content,1fr,min-content,1fr">
<label name="quantity"/>
<field name="quantity" width="120" xexpand="0" xfill="0"/>
<label name="unit"/>
<field name="unit"/>
<label name="storage_location"/>
<field name="storage_location" colspan="3"/>
</group>
<group id="sample_lab" string="Lab delegation" colspan="1" col="6"
col_widths="min-content,max-content,min-content,1fr,min-content,max-content">
<label name="delegated_to_lab"/>
<field name="delegated_to_lab" xexpand="0" xfill="0"/>
<label name="lab"/>
<field name="lab"/>
<label name="lab_due_date"/>
<field name="lab_due_date" width="120" xexpand="0" xfill="0"/>
</group>
</group>
<group id="sample_storage" string="Sample storage" colspan="6" col="4">
<label name="quantity"/>
<field name="quantity"/>
<label name="unit"/>
<field name="unit"/>
<label name="storage_location"/>
<field name="storage_location"/>
</group>
<group id="sample_quality" string="Quality values" colspan="6" col="4">
<label name="moisture"/>
<field name="moisture" width="120" xexpand="0" xfill="0"/>
<label name="screen_size"/>
<field name="screen_size"/>
<label name="defect_count"/>
<field name="defect_count" width="120" xexpand="0" xfill="0"/>
<label name="cupping_average_score"/>
<field name="cupping_average_score" width="120" xexpand="0" xfill="0"/>
<label name="lab_analysis_status"/>
<field name="lab_analysis_status"/>
</group>
<group id="sample_lab" string="Lab delegation" colspan="12" col="4">
<label name="delegated_to_lab"/>
<field name="delegated_to_lab"/>
<label name="lab"/>
<field name="lab"/>
<label name="lab_due_date"/>
<field name="lab_due_date"/>
<newline/>
<field name="lab_analyses" colspan="4" mode="tree,form"
view_ids="purchase_trade.coffee_lab_analysis_view_tree,purchase_trade.coffee_lab_analysis_view_form"/>
</group>
<group id="sample_cupping" string="Cupping sessions" colspan="12" col="1">
<field name="cupping_lines" colspan="1" mode="tree"
view_ids="purchase_trade.coffee_cupping_session_sample_view_tree"/>
</group>
<group id="sample_notes" string="Notes" colspan="12" col="1">
<field name="notes"/>
<field name="decision_note"/>
<group id="sample_right_column" colspan="5" col="1" col_widths="1fr">
<group id="sample_lifecycle" string="Lifecycle" colspan="1" col="4"
col_widths="min-content,max-content,min-content,max-content">
<label name="requested_date"/>
<field name="requested_date" width="120" xexpand="0" xfill="0"/>
<label name="received_date"/>
<field name="received_date" width="120" xexpand="0" xfill="0"/>
<label name="sent_date"/>
<field name="sent_date" width="120" xexpand="0" xfill="0"/>
<label name="review_date"/>
<field name="review_date" width="120" xexpand="0" xfill="0"/>
<label name="decision_date"/>
<field name="decision_date" width="120" xexpand="0" xfill="0"/>
<label name="shelf_life_days"/>
<field name="shelf_life_days" width="80" xexpand="0" xfill="0"/>
<label name="expiry_date"/>
<field name="expiry_date" width="120" xexpand="0" xfill="0"/>
<label name="expires_soon"/>
<field name="expires_soon" xexpand="0" xfill="0"/>
</group>
<group id="sample_quality" string="Quality values" colspan="1" col="4"
col_widths="min-content,max-content,min-content,max-content">
<label name="moisture"/>
<field name="moisture" width="90" xexpand="0" xfill="0"/>
<label name="screen_size"/>
<field name="screen_size" width="90" xexpand="0" xfill="0"/>
<label name="defect_count"/>
<field name="defect_count" width="90" xexpand="0" xfill="0"/>
<label name="cupping_average_score"/>
<field name="cupping_average_score" width="90" xexpand="0" xfill="0"/>
<label name="lab_analysis_status"/>
<field name="lab_analysis_status" colspan="3" width="180" xexpand="0" xfill="0"/>
</group>
</group>
<notebook colspan="12">
<page string="Lab analyses" id="lab_analyses" col="1">
<field name="lab_analyses" colspan="1" mode="tree,form"
view_ids="purchase_trade.coffee_lab_analysis_view_tree,purchase_trade.coffee_lab_analysis_view_form"
height="180"/>
</page>
<page string="Cupping sessions" id="cupping_sessions" col="1">
<field name="cupping_lines" colspan="1" mode="tree"
view_ids="purchase_trade.coffee_cupping_session_sample_view_tree"
height="160"/>
</page>
<page string="Notes" id="notes" col="2">
<field name="notes"/>
<field name="decision_note"/>
</page>
</notebook>
</form>

View File

@@ -49,7 +49,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="coffee_packing_unit"/>
<label name="coffee_packing_description"/>
<field name="coffee_packing_description"/>
<field name="coffee_packing_category" invisible="1" colspan="4"/>
</group>
<group id="tolerances" string="Tolerances &amp; Inheritance"
colspan="1" col="4" panel="card" icon="tryton-switch"

View File

@@ -46,7 +46,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="coffee_packing_unit"/>
<label name="coffee_packing_description"/>
<field name="coffee_packing_description"/>
<field name="coffee_packing_category" invisible="1" colspan="4"/>
</group>
<group id="tolerances" string="Tolerances &amp; Inheritance"
colspan="1" col="4" panel="card" icon="tryton-switch"