-
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] l10n_it_delivery_note: Define common delivery data
A mixin for fields and methods, a report for printing them
- Loading branch information
1 parent
def5e3b
commit fb7dfd7
Showing
9 changed files
with
317 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import delivery_mixin | ||
from . import picking_checker | ||
from . import shipping_updater |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Copyright 2023 Simone Rubino - Aion Tech | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
|
||
from odoo import fields, models | ||
|
||
|
||
def _default_volume_uom(model): | ||
return model.env.ref("uom.product_uom_litre", raise_if_not_found=False) | ||
|
||
|
||
def _domain_volume_uom(model): | ||
uom_category_id = model.env.ref( | ||
"uom.product_uom_categ_vol", raise_if_not_found=False | ||
) | ||
|
||
return [("category_id", "=", uom_category_id.id)] | ||
|
||
|
||
def _default_weight_uom(model): | ||
return model.env.ref("uom.product_uom_kgm", raise_if_not_found=False) | ||
|
||
|
||
def _domain_weight_uom(model): | ||
uom_category_id = model.env.ref( | ||
"uom.product_uom_categ_kgm", raise_if_not_found=False | ||
) | ||
|
||
return [("category_id", "=", uom_category_id.id)] | ||
|
||
|
||
class DeliveryData(models.AbstractModel): | ||
_name = "l10n_it_delivery_note.delivery_mixin" | ||
_description = "Common data for records to be delivered" | ||
|
||
delivery_transport_reason_id = fields.Many2one( | ||
comodel_name="stock.picking.transport.reason", | ||
string="Reason of transport of Delivery", | ||
) | ||
delivery_transport_condition_id = fields.Many2one( | ||
comodel_name="stock.picking.transport.condition", | ||
string="Condition of transport of Delivery", | ||
) | ||
delivery_transport_method_id = fields.Many2one( | ||
comodel_name="stock.picking.transport.method", | ||
string="Method of transport of Delivery", | ||
) | ||
delivery_carrier_id = fields.Many2one( | ||
comodel_name="res.partner", | ||
string="Carrier of Delivery", | ||
) | ||
delivery_goods_appearance_id = fields.Many2one( | ||
comodel_name="stock.picking.goods.appearance", | ||
string="Appearance of goods of Delivery", | ||
) | ||
delivery_volume_uom_id = fields.Many2one( | ||
"uom.uom", | ||
string="Volume of Delivery UoM", | ||
default=_default_volume_uom, | ||
domain=_domain_volume_uom, | ||
) | ||
delivery_volume = fields.Float( | ||
string="Volume of Delivery", | ||
) | ||
delivery_gross_weight_uom_id = fields.Many2one( | ||
"uom.uom", | ||
string="Gross Weight of Delivery UoM", | ||
default=_default_weight_uom, | ||
domain=_domain_weight_uom, | ||
) | ||
delivery_gross_weight = fields.Float( | ||
string="Gross Weight of Delivery", | ||
) | ||
delivery_net_weight_uom_id = fields.Many2one( | ||
"uom.uom", | ||
string="Net Weight of Delivery UoM", | ||
default=_default_weight_uom, | ||
domain=_domain_weight_uom, | ||
) | ||
delivery_net_weight = fields.Float( | ||
string="Net Weight of Delivery", | ||
) | ||
delivery_transport_datetime = fields.Datetime( | ||
string="Transport Date of Delivery", | ||
) | ||
delivery_packages = fields.Integer( | ||
string="Packages of Delivery", | ||
) | ||
delivery_note = fields.Html( | ||
string="Internal note of delivery", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!-- | ||
~ Copyright 2023 Simone Rubino - Aion Tech | ||
~ License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
--> | ||
<odoo> | ||
<template id="delivery_data"> | ||
<div id="delivery_data_information" class="row mb-4"> | ||
<div | ||
class="col" | ||
t-if="doc.transport_reason_id" | ||
name="transport_reason" | ||
> | ||
<strong>Reason of Transport</strong> | ||
<div t-field="doc.transport_reason_id" /> | ||
</div> | ||
<div class="col" t-if="doc.transport_condition_id"> | ||
<strong>Carriage Condition</strong> | ||
<div t-field="doc.transport_condition_id" /> | ||
</div> | ||
<div | ||
class="col" | ||
t-if="doc.transport_method_id and doc.company_id.display_carrier_dn_report" | ||
> | ||
<strong>Method of Transport:</strong> | ||
<div t-field="doc.transport_method_id" /> | ||
</div> | ||
<div | ||
class="col" | ||
t-if="doc.transport_method_id and not doc.company_id.display_carrier_dn_report" | ||
> | ||
<strong>Method of Transport / Carrier</strong> | ||
<div t-field="doc.transport_method_id" /> | ||
<t t-if="doc.transport_method_id and doc.carrier_id"> / </t> | ||
<div t-field="doc.carrier_id" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<template id="parcels_data"> | ||
<div id="parcel_info" class="row"> | ||
<div class="col border" name="good_description"> | ||
<div | ||
class="px-2 pt-2" | ||
style="font-size:10px;" | ||
>Goods Description</div> | ||
<div | ||
class="px-2 pb-2" | ||
style="font-size:12px;" | ||
t-field="doc.goods_appearance_id" | ||
/> | ||
</div> | ||
<div class="col border border-start-0" name="gross_weight"> | ||
<div | ||
class="px-2 pt-2" | ||
style="font-size:10px;" | ||
>Gross Weight</div> | ||
<div | ||
class="px-2 pb-2" | ||
style="font-size:10px;" | ||
t-field="doc.gross_weight" | ||
/> | ||
</div> | ||
<div class="col border border-start-0" name="net_weight"> | ||
<div | ||
class="px-2 pt-2" | ||
style="font-size:10px;" | ||
>Net Weight</div> | ||
<div | ||
class="px-2 pb-2" | ||
style="font-size:10px;" | ||
t-field="doc.net_weight" | ||
/> | ||
</div> | ||
<div class="col border border-start-0" name="transport_date"> | ||
<div | ||
class="px-2 pt-2" | ||
style="font-size:10px;" | ||
>Transport date</div> | ||
<div | ||
class="px-2 pb-2" | ||
style="font-size:12px;" | ||
t-field="doc.transport_datetime" | ||
/> | ||
</div> | ||
<div class="col border border-start-0" name="packages"> | ||
<div | ||
class="px-2 pt-2" | ||
style="font-size:10px;" | ||
>Packages</div> | ||
<div | ||
class="px-2 pb-2" | ||
style="font-size:12px;" | ||
t-field="doc.packages" | ||
/> | ||
</div> | ||
</div> | ||
<div id="parcel_info_note" class="row"> | ||
<div class="col border border-bottom-0" name="note"> | ||
<div class="px-2 pt-2" style="font-size:10px;">Notes</div> | ||
<div | ||
class="px-2 pb-2" | ||
style="font-size:12px;" | ||
t-if="doc.note" | ||
t-field="doc.note" | ||
/> | ||
<div | ||
class="m-3 p-3" | ||
style="font-size:12px;" | ||
t-if="not doc.note" | ||
/> | ||
</div> | ||
</div> | ||
<div id="parcel_info_signature" class="row"> | ||
<div class="col border" name="carrier_signature"> | ||
<div class="px-2 pt-2" style="font-size:10px;">Carrier's Signature</div> | ||
<div class="m-3 p-3" style="font-size:12px;" /> | ||
</div> | ||
<div class="col border border-start-0" name="driver_signature"> | ||
<div class="px-2 pt-2" style="font-size:10px;">Driver's Signature</div> | ||
<div class="m-3 p-3" style="font-size:12px;" /> | ||
</div> | ||
<div class="col border border-start-0" name="recipint_signature"> | ||
<div class="px-2 pt-2" style="font-size:10px;">Recipient's Signature</div> | ||
<div class="m-3 p-3" style="font-size:12px;" /> | ||
</div> | ||
</div> | ||
</template> | ||
</odoo> |
Oops, something went wrong.