This commit is contained in:
2026-01-20 18:59:40 +01:00
parent a9d1fe7baf
commit ddf023f078
6 changed files with 330 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ from . import (
open_position,
credit_risk,
valuation,
weight_report,
)
def register():
@@ -159,6 +160,7 @@ def register():
purchase.DocTemplate,
purchase.DocTypeTemplate,
purchase.Mtm,
weight_report.WeightReport,
module='purchase', type_='model')
Pool.register(
forex.Forex,

View File

@@ -29,4 +29,5 @@ xml:
forex.xml
global_reporting.xml
derivative.xml
valuation.xml
valuation.xml
weight_report.xml

View File

@@ -0,0 +1,104 @@
<?xml version="1.0"?>
<form col="8">
<group id="identification" colspan="4" col="4">
<label name="lab"/>
<field name="lab"/>
<newline/>
<label name="reference"/>
<field name="reference"/>
<newline/>
<label name="file_no"/>
<field name="file_no"/>
<newline/>
<label name="report_date"/>
<field name="report_date"/>
</group>
<group id="audit" colspan="4" col="4">
<label name="created_by"/>
<field name="created_by" readonly="True"/>
<newline/>
<label name="created_date"/>
<field name="created_date" readonly="True"/>
<newline/>
<label name="last_modified"/>
<field name="last_modified" readonly="True"/>
</group>
<separator string="Contract Information" colspan="8"/>
<group id="contract" colspan="8" col="8">
<label name="contract_no"/>
<field name="contract_no"/>
<label name="invoice_no"/>
<field name="invoice_no"/>
<label name="lc_no"/>
<field name="lc_no"/>
<newline/>
<label name="origin"/>
<field name="origin"/>
<label name="commodity"/>
<field name="commodity"/>
</group>
<separator string="Parties Information" colspan="8"/>
<group id="parties" colspan="8" col="8">
<label name="seller"/>
<field name="seller"/>
<newline/>
<label name="buyer"/>
<field name="buyer"/>
<newline/>
<label name="carrier"/>
<field name="carrier"/>
</group>
<separator string="Shipment Information" colspan="8"/>
<group id="shipment" colspan="8" col="8">
<label name="vessel"/>
<field name="vessel"/>
<label name="bl_no"/>
<field name="bl_no"/>
<label name="bl_date"/>
<field name="bl_date"/>
<newline/>
<label name="port_loading"/>
<field name="port_loading"/>
<label name="port_destination"/>
<field name="port_destination"/>
<label name="arrival_date"/>
<field name="arrival_date"/>
<newline/>
<label name="weighing_place"/>
<field name="weighing_place"/>
<label name="weighing_method"/>
<field name="weighing_method"/>
<label name="bales"/>
<field name="bales"/>
</group>
<separator string="Weights Information" colspan="8"/>
<group id="weights" colspan="8" col="8">
<label name="gross_landed_kg"/>
<field name="gross_landed_kg"/>
<label name="tare_kg"/>
<field name="tare_kg"/>
<label name="net_landed_kg"/>
<field name="net_landed_kg"/>
<newline/>
<label name="invoice_net_kg"/>
<field name="invoice_net_kg"/>
<label name="gain_loss_kg"/>
<field name="gain_loss_kg"/>
<label name="gain_loss_percent"/>
<field name="gain_loss_percent"/>
</group>
<!-- <group id="buttons" colspan="8">
<button name="import_json" string="Import JSON"/>
<button name="export_json" string="Export JSON"/>
</group> -->
</form>

View File

@@ -0,0 +1,17 @@
<tree>
<field name="lab"/>
<field name="reference"/>
<field name="file_no"/>
<field name="report_date"/>
<field name="seller"/>
<field name="buyer"/>
<field name="vessel"/>
<field name="bl_no"/>
<field name="commodity"/>
<field name="net_landed_kg"/>
<field name="invoice_net_kg"/>
<field name="gain_loss_kg"/>
<field name="gain_loss_percent"/>
<!-- <button name="import_json" tree_invisible="1"/>
<button name="export_json" tree_invisible="1"/> -->
</tree>

View File

@@ -0,0 +1,65 @@
from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import Pool
import datetime
class WeightReport(ModelSQL, ModelView):
'Weight Report'
__name__ = 'weight.report'
# Identification
lab = fields.Char('Laboratory', required=True)
# Report Information
reference = fields.Char('Reference')
file_no = fields.Char('File Number')
report_date = fields.Date('Report Date')
# Contract Information
contract_no = fields.Char('Contract Number')
invoice_no = fields.Char('Invoice Number')
lc_no = fields.Char('LC Number')
origin = fields.Char('Origin')
commodity = fields.Char('Commodity')
# Parties Information
seller = fields.Many2One('party.party','Seller', required=True)
buyer = fields.Many2One('party.party','Buyer', required=True)
carrier = fields.Many2One('party.party','Carrier')
# Shipment Information
vessel = fields.Many2One('trade.vessel','Vessel')
bl_no = fields.Char('B/L Number')
bl_date = fields.Date('B/L Date')
port_loading = fields.Many2One('stock.location','Port of Loading')
port_destination = fields.Many2One('stock.location','Port of Destination')
arrival_date = fields.Date('Arrival Date')
weighing_place = fields.Char('Weighing Place')
weighing_method = fields.Char('Weighing Method')
bales = fields.Integer('Number of Bales')
# Weights Information
gross_landed_kg = fields.Numeric('Gross Landed (kg)', digits=(16, 2))
tare_kg = fields.Numeric('Tare Weight (kg)', digits=(16, 2))
net_landed_kg = fields.Numeric('Net Landed (kg)', digits=(16, 2))
invoice_net_kg = fields.Numeric('Invoice Net (kg)', digits=(16, 2))
gain_loss_kg = fields.Numeric('Gain/Loss (kg)', digits=(16, 2))
gain_loss_percent = fields.Numeric('Gain/Loss (%)', digits=(16, 2))
@classmethod
def __setup__(cls):
super().__setup__()
cls._order = [('created_date', 'DESC')]
# cls._buttons.update({
# 'import_json': {},
# 'export_json': {},
# })
# @classmethod
# @ModelView.button_action('weight_report.act_import_json')
# def import_json(cls, reports):
# pass
# @classmethod
# @ModelView.button_action('weight_report.act_export_json')
# def export_json(cls, reports):
# pass

View File

@@ -0,0 +1,140 @@
<tryton>
<data>
<!-- Group Configuration -->
<!-- <record model="res.group" id="group_weight_report">
<field name="name">Weight Report</field>
</record>
<record model="res.group" id="group_weight_report_admin">
<field name="name">Weight Report Administration</field>
<field name="parent" ref="group_weight_report"/>
</record> -->
<!-- Assign groups to admin user -->
<!-- <record model="res.user-res.group" id="user_admin_group_weight_report">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_weight_report"/>
</record>
<record model="res.user-res.group" id="user_admin_group_weight_report_admin">
<field name="user" ref="res.user_admin"/>
<field name="group" ref="group_weight_report_admin"/>
</record>
-->
<!-- Icon -->
<!-- <record model="ir.ui.icon" id="weight_report_icon">
<field name="name">tryton-weight</field>
<field name="path">icons/tryton-weight.svg</field>
</record> -->
<!-- Views -->
<record model="ir.ui.view" id="view_weight_report_form">
<field name="model">weight.report</field>
<field name="type">form</field>
<field name="name">weight_report_form</field>
</record>
<record model="ir.ui.view" id="view_weight_report_list">
<field name="model">weight.report</field>
<field name="type">tree</field>
<field name="name">weight_report_list</field>
</record>
<!-- Actions -->
<record model="ir.action.act_window" id="act_weight_report_form">
<field name="name">Weight Reports</field>
<field name="res_model">weight.report</field>
<field name="icon" ref="weight_report_icon"/>
</record>
<record model="ir.action.act_window.view" id="act_weight_report_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="view_weight_report_list"/>
<field name="act_window" ref="act_weight_report_form"/>
</record>
<record model="ir.action.act_window.view" id="act_weight_report_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="view_weight_report_form"/>
<field name="act_window" ref="act_weight_report_form"/>
</record>
<!-- Action Domains -->
<!-- <record model="ir.action.act_window.domain" id="act_weight_report_domain_all">
<field name="name">All</field>
<field name="sequence" eval="10"/>
<field name="domain" eval="[]"/>
<field name="act_window" ref="act_weight_report_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_weight_report_domain_recent">
<field name="name">Recent</field>
<field name="sequence" eval="20"/>
<field name="domain" eval="[('created_date', '&gt;=', '2025-01-01')]"/>
<field name="act_window" ref="act_weight_report_form"/>
</record> -->
<!-- Import/Export Actions -->
<!-- <record model="ir.action.wizard" id="act_import_json">
<field name="name">Import from JSON</field>
<field name="wiz_name">weight_report.import_json</field>
<field name="keyword">import_json</field>
</record>
<record model="ir.action.wizard" id="act_export_json">
<field name="name">Export to JSON</field>
<field name="wiz_name">weight_report.export_json</field>
<field name="keyword">export_json</field>
</record>
-->
<!-- Access Rights -->
<!-- <record model="ir.model.access" id="access_weight_report">
<field name="model">weight.report</field>
<field name="perm_read" eval="False"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_weight_report_group">
<field name="model">weight.report</field>
<field name="group" ref="group_weight_report"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record> -->
<!-- Model Buttons -->
<!-- <record model="ir.model.button" id="weight_report_import_button">
<field name="model">weight.report</field>
<field name="name">import_json</field>
<field name="string">Import JSON</field>
</record>
<record model="ir.model.button" id="weight_report_export_button">
<field name="model">weight.report</field>
<field name="name">export_json</field>
<field name="string">Export JSON</field>
</record> -->
<!-- Menu Structure -->
<menuitem
name="Weight Reports"
sequence="200"
id="menu_weight"
icon="tryton-weight"/>
<menuitem
name="Weight Reports"
action="act_weight_report_form"
parent="menu_weight"
sequence="10"
id="menu_weight_reports"/>
<!-- <menuitem
name="Reports"
parent="purchase_trade.menu_global_reporting"
action="act_weight_report_form"
sequence="30"
id="menu_gr_weight_reports"/> -->
</data>
</tryton>