Add surveyor on shipment

This commit is contained in:
2026-04-07 11:09:52 +02:00
parent 5179d98289
commit 3480eb8a7a
5 changed files with 34 additions and 5 deletions

View File

@@ -315,6 +315,7 @@ Source code: `modules/purchase_trade/stock.py`
- `report_insurance_incoming_amount`
- `report_insurance_amount_insured`
- `report_insurance_surveyor`
- `report_insurance_contact_surveyor`
- `report_insurance_issue_place_and_date`
Usage typique:
@@ -326,6 +327,9 @@ Usage typique:
(`lot.line.unit_price * lot.get_current_quantity_converted()`)
- `report_insurance_amount_insured`: `110%` de
`report_insurance_incoming_amount`
- `report_insurance_contact_surveyor`: surveyor affiche sous
`Contact the following surveyor` (priorite au champ shipment `surveyor`,
puis fallback controller / fee `Insurance`)
- base de travail pour un certificat d'assurance lie a un shipment
## 10) Recommandations

View File

@@ -443,6 +443,7 @@ class ShipmentIn(metaclass=PoolMeta):
)
shipment_wr = fields.One2Many('shipment.wr','shipment_in',"WR")
controller = fields.Many2One('party.party',"Controller")
surveyor = fields.Many2One('party.party', "Surveyor")
controller_target = fields.Char("Targeted controller")
send_instruction = fields.Boolean("Send instruction")
instructions = fields.Text("Instructions")
@@ -625,12 +626,18 @@ class ShipmentIn(metaclass=PoolMeta):
@property
def report_insurance_surveyor(self):
if self.surveyor:
return self.surveyor.rec_name or ''
if self.controller:
return self.controller.rec_name or ''
fee = self._get_report_insurance_fee()
supplier = getattr(fee, 'supplier', None) if fee else None
return getattr(supplier, 'rec_name', '') or ''
@property
def report_insurance_contact_surveyor(self):
return self.report_insurance_surveyor
@property
def report_insurance_issue_place_and_date(self):
Date = Pool().get('ir.date')

View File

@@ -530,6 +530,19 @@ class PurchaseTradeTestCase(ModuleTestCase):
self.assertEqual(
shipment.report_insurance_amount, 'USD 550.00')
def test_shipment_insurance_contact_surveyor_prefers_shipment_surveyor(self):
'insurance contact surveyor property uses shipment surveyor first'
ShipmentIn = Pool().get('stock.shipment.in')
shipment = ShipmentIn()
shipment.surveyor = Mock(rec_name='SGS')
shipment.controller = Mock(rec_name='CONTROL UNION')
shipment.fees = []
self.assertEqual(
shipment.report_insurance_contact_surveyor, 'SGS')
self.assertEqual(
shipment.report_insurance_surveyor, 'SGS')
def test_sale_report_multi_line_helpers_aggregate_all_lines(self):
'sale report helpers aggregate quantity, price lines and shipment periods'
Sale = Pool().get('sale.sale')

View File

@@ -137,5 +137,9 @@ this repository contains the full copyright notices and license terms. -->
<newline/>
<field name="shipment_wr" colspan="4" mode="tree" view_ids="purchase_trade.shipment_wr_view_tree"/>
</page>
<page string="Surveyor" col="4" id="surveyor">
<label name="surveyor"/>
<field name="surveyor"/>
</page>
</xpath>
</data>

View File

@@ -1051,7 +1051,7 @@
<text:p text:style-name="P32">applicable) and strike as per hte according Clauses.</text:p>
<text:p text:style-name="P34"/>
<text:h text:style-name="P43" text:outline-level="2">In case of loss and/or damage, contact the following surveyor:</text:h>
<text:h text:style-name="P44" text:outline-level="2"><text:placeholder text:placeholder-type="text">&lt;records[0].report_insurance_surveyor or &apos;&apos;&gt;</text:placeholder></text:h>
<text:h text:style-name="P44" text:outline-level="2"><text:placeholder text:placeholder-type="text">&lt;records[0].report_insurance_contact_surveyor or &apos;&apos;&gt;</text:placeholder></text:h>
<text:p text:style-name="P23"/>
<text:p text:style-name="P23"/>
<text:p text:style-name="P17">Surveyor&apos;s functions are limited to that of an independent observer retained for the sole purpose of reporting on the nature extent and proximate cause of loss; the surveyor has no authority to represent underwriters with regard to the terms and conditions of the contract.</text:p>
@@ -1071,3 +1071,4 @@
</office:text>
</office:body>
</office:document>