Template Melya
This commit is contained in:
@@ -1645,7 +1645,7 @@
|
||||
<table:table-column table:style-name="Tableau3.B"/>
|
||||
<table:table-row>
|
||||
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
|
||||
<text:p text:style-name="P24"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T8"><text:placeholder text:placeholder-type="text"><if test="invoice.report_rate_rows"></text:placeholder></text:span></text:span></text:p>
|
||||
<text:p text:style-name="P24"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T8"><text:placeholder text:placeholder-type="text"><if test="invoice.report_melya_rate_rows"></text:placeholder></text:span></text:span></text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
|
||||
<text:p text:style-name="P9"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T8"/></text:span></text:p>
|
||||
@@ -1653,7 +1653,7 @@
|
||||
</table:table-row>
|
||||
<table:table-row>
|
||||
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
|
||||
<text:p text:style-name="P11"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T8"><text:placeholder text:placeholder-type="text"><for each="pc in invoice.report_rate_rows"></text:placeholder></text:span></text:span><text:soft-page-break/></text:p>
|
||||
<text:p text:style-name="P11"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T8"><text:placeholder text:placeholder-type="text"><for each="pc in invoice.report_melya_rate_rows"></text:placeholder></text:span></text:span><text:soft-page-break/></text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="Tableau3.A1" office:value-type="string">
|
||||
<text:p text:style-name="P9"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T9"/></text:span></text:p>
|
||||
|
||||
@@ -931,6 +931,10 @@ class Invoice(metaclass=PoolMeta):
|
||||
'amount': None,
|
||||
} for line in self._get_report_rate_line_details()]
|
||||
|
||||
@property
|
||||
def report_melya_rate_rows(self):
|
||||
return self._get_report_price_composition_rows()
|
||||
|
||||
def _get_report_rate_line_details(self):
|
||||
details = []
|
||||
for line in self._get_report_invoice_lines():
|
||||
|
||||
@@ -3453,7 +3453,7 @@ class LotAddLine(ModelView):
|
||||
__name__ = "lot.add.line"
|
||||
|
||||
lal = fields.Many2One('lot.add.lot',"Lots")
|
||||
lot_qt = fields.Numeric("Quantity")
|
||||
lot_qt = fields.Numeric("Packing detail")
|
||||
lot_unit = fields.Many2One('product.uom', "Unit",required=True)
|
||||
lot_quantity = fields.Numeric("Net weight")
|
||||
lot_gross_quantity = fields.Numeric("Gross weight")
|
||||
|
||||
@@ -623,6 +623,34 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
return None
|
||||
return getattr(line, 'sale', None) or getattr(line, 'purchase', None)
|
||||
|
||||
@staticmethod
|
||||
def _get_report_sale_from_lot(lot):
|
||||
sale_line = getattr(lot, 'sale_line', None) if lot else None
|
||||
sale = getattr(sale_line, 'sale', None) if sale_line else None
|
||||
return sale
|
||||
|
||||
def _get_report_sales(self):
|
||||
sales = []
|
||||
seen = set()
|
||||
|
||||
def add_sale(sale):
|
||||
if not sale:
|
||||
return
|
||||
sale_id = getattr(sale, 'id', None)
|
||||
key = sale_id if sale_id is not None else id(sale)
|
||||
if key in seen:
|
||||
return
|
||||
seen.add(key)
|
||||
sales.append(sale)
|
||||
|
||||
for move in (self.incoming_moves or self.moves or []):
|
||||
add_sale(self._get_report_sale_from_lot(
|
||||
getattr(move, 'lot', None)))
|
||||
for lot_qt in getattr(self, 'lotqt', []) or []:
|
||||
add_sale(self._get_report_sale_from_lot(
|
||||
getattr(lot_qt, 'lot_s', None)))
|
||||
return sales
|
||||
|
||||
def _get_report_weight_totals(self):
|
||||
net = Decimal('0')
|
||||
gross = Decimal('0')
|
||||
@@ -677,6 +705,17 @@ class ShipmentIn(metaclass=PoolMeta):
|
||||
def report_insurance_certificate_number(self):
|
||||
return self.bl_number or self.number or ''
|
||||
|
||||
@property
|
||||
def report_insurance_order_reference(self):
|
||||
sales = self._get_report_sales()
|
||||
if len(sales) != 1:
|
||||
return ''
|
||||
sale = sales[0]
|
||||
return (
|
||||
getattr(sale, 'report_melya_proforma_number', None)
|
||||
or getattr(sale, 'report_deal', None)
|
||||
or '')
|
||||
|
||||
@property
|
||||
def report_insurance_account_of(self):
|
||||
line = self._get_report_trade_line()
|
||||
|
||||
@@ -2776,7 +2776,11 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
shipment.supplier = Mock(rec_name='MELYA SA')
|
||||
|
||||
sale_party = Mock(rec_name='SGT FR')
|
||||
sale = Mock(party=sale_party)
|
||||
sale = Mock(
|
||||
id=1,
|
||||
party=sale_party,
|
||||
report_melya_proforma_number='P-12 S-34',
|
||||
)
|
||||
product = Mock(name='COTTON UPLAND', description='RAW WHITE COTTON')
|
||||
line = Mock(product=product, sale=sale)
|
||||
lot = Mock(sale_line=line, line=None)
|
||||
@@ -2815,6 +2819,8 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertEqual(
|
||||
shipment.report_insurance_goods_description,
|
||||
'COTTON UPLAND - RAW WHITE COTTON')
|
||||
self.assertEqual(
|
||||
shipment.report_insurance_order_reference, 'P-12 S-34')
|
||||
self.assertEqual(
|
||||
shipment.report_insurance_amount, 'USD 1234.56')
|
||||
self.assertEqual(
|
||||
@@ -2857,6 +2863,23 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertEqual(
|
||||
shipment.report_insurance_surveyor, 'SGS')
|
||||
|
||||
def test_shipment_insurance_order_reference_falls_back_to_lot_qt(self):
|
||||
'insurance order reference can read sale deal through matching lot.qt'
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
shipment = ShipmentIn()
|
||||
sale = Mock(
|
||||
id=1,
|
||||
report_melya_proforma_number='',
|
||||
report_deal='P-12 S-34',
|
||||
)
|
||||
sale_lot = Mock(sale_line=Mock(sale=sale))
|
||||
shipment.incoming_moves = []
|
||||
shipment.moves = []
|
||||
shipment.lotqt = [Mock(lot_s=sale_lot)]
|
||||
|
||||
self.assertEqual(
|
||||
shipment.report_insurance_order_reference, 'P-12 S-34')
|
||||
|
||||
def test_shipment_packing_helpers_use_today_and_trade_unit(self):
|
||||
'packing list helpers expose today date and trade line unit'
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
@@ -2998,6 +3021,29 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
{'label': 'FREIGHT value in EUR', 'amount': Decimal('25')},
|
||||
])
|
||||
|
||||
def test_invoice_report_melya_rate_rows_has_no_price_fallback(self):
|
||||
'invoice_melya rate block stays empty without price composition'
|
||||
Invoice = Pool().get('account.invoice')
|
||||
line = Mock(
|
||||
type='line',
|
||||
report_rate_currency_upper='USD',
|
||||
report_rate_value=Decimal('2050'),
|
||||
report_rate_unit_upper='MT',
|
||||
report_rate_price_words='TWO THOUSAND FIFTY DOLLARS',
|
||||
report_rate_pricing_text='',
|
||||
)
|
||||
invoice = Invoice()
|
||||
invoice.lines = [line]
|
||||
|
||||
self.assertEqual(invoice.report_melya_rate_rows, [])
|
||||
self.assertEqual(
|
||||
invoice.report_rate_rows,
|
||||
[{
|
||||
'label': 'USD 2050.0000 PER MT '
|
||||
'(TWO THOUSAND FIFTY DOLLARS)',
|
||||
'amount': None,
|
||||
}])
|
||||
|
||||
def test_fee_delete_detects_generated_ordered_purchase(self):
|
||||
'ordered fee deletion targets only its generated service purchase'
|
||||
Fee = Pool().get('fee.fee')
|
||||
|
||||
@@ -5,6 +5,4 @@
|
||||
<field name="lot_quantity" symbol="lot_unit_line"/>
|
||||
<field name="lot_gross_quantity"/>
|
||||
<field name="lot_unit_line"/>
|
||||
<field name="lot_premium" width="80"/>
|
||||
<field name="lot_chunk_key"/>
|
||||
</tree>
|
||||
|
||||
@@ -1036,6 +1036,7 @@
|
||||
<text:p text:style-name="P20"/>
|
||||
<text:p text:style-name="P21"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T12">Marine Insurance</text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T13"> </text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T12">Policy</text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T14"> </text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T12">No. 4.008.227.782<text:tab/>the following shipment: Description of goods and/or</text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T15"> </text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T12">services:</text:span></text:span></text:p>
|
||||
<text:p text:style-name="Text_20_body"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T16"><text:s text:c="2"/></text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T5"><text:placeholder text:placeholder-type="text"><records[0].report_insurance_goods_description or ''></text:placeholder></text:span></text:span></text:p>
|
||||
<text:p text:style-name="Text_20_body"><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T12">Order reference: </text:span></text:span><text:span text:style-name="Police_20_par_20_défaut"><text:span text:style-name="T5"><text:placeholder text:placeholder-type="text"><records[0].report_insurance_order_reference or ''></text:placeholder></text:span></text:span></text:p>
|
||||
<text:p text:style-name="P22"/>
|
||||
<text:p text:style-name="P22"/>
|
||||
<text:p text:style-name="P22"/>
|
||||
|
||||
Reference in New Issue
Block a user