Skip to content

Commit

Permalink
inserted weight_manual_uom_id, gross_weight_uom_id and volume_uom_id …
Browse files Browse the repository at this point in the history
…in invoice
  • Loading branch information
fredzamoabg committed Sep 10, 2021
1 parent b6443af commit 7171ad8
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 6 deletions.
1 change: 1 addition & 0 deletions l10n_it_ddt/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'stock_account',
'stock_picking_package_preparation_line',
'product_expiry',
'uom',
],
'data': [
'security/ir.model.access.csv',
Expand Down
12 changes: 12 additions & 0 deletions l10n_it_ddt/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ class AccountInvoice(models.Model):
weight = fields.Float(string="Weight")
gross_weight = fields.Float(string="Gross Weight")
volume = fields.Float('Volume')
weight_manual_uom_id = fields.Many2one(
'uom.uom', 'Net Weight UoM',
default=lambda self: self.env.ref(
'uom.product_uom_kgm', raise_if_not_found=False))
gross_weight_uom_id = fields.Many2one(
'uom.uom', 'Gross Weight UoM',
default=lambda self: self.env.ref(
'uom.product_uom_kgm', raise_if_not_found=False))
volume_uom_id = fields.Many2one(
'uom.uom', 'Volume UoM',
default=lambda self: self.env.ref(
'uom.product_uom_litre', raise_if_not_found=False))
ddt_ids = fields.One2many(
'stock.picking.package.preparation', 'invoice_id', string='TD')

Expand Down
16 changes: 16 additions & 0 deletions l10n_it_ddt/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ def _compute_ddt_ids(self):
"invoiced from DDT. This parameter can be set on partners and "
"automatically applied to Sale Orders.")

weight_manual_uom_id = fields.Many2one(
'uom.uom', 'Net Weight UoM',
default=lambda self: self.env.ref(
'uom.product_uom_kgm', raise_if_not_found=False))
gross_weight_uom_id = fields.Many2one(
'uom.uom', 'Gross Weight UoM',
default=lambda self: self.env.ref(
'uom.product_uom_kgm', raise_if_not_found=False))
volume_uom_id = fields.Many2one(
'uom.uom', 'Volume UoM',
default=lambda self: self.env.ref(
'uom.product_uom_litre', raise_if_not_found=False))

@api.multi
@api.onchange('partner_id')
def onchange_partner_id(self):
Expand Down Expand Up @@ -90,6 +103,9 @@ def _prepare_invoice(self):
'weight': self.weight,
'gross_weight': self.gross_weight,
'volume': self.volume,
'weight_manual_uom_id': self.weight_manual_uom_id.id,
'gross_weight_uom_id': self.gross_weight_uom_id.id,
'volume_uom_id': self.volume_uom_id.id,
})
return vals

Expand Down
3 changes: 3 additions & 0 deletions l10n_it_ddt/models/stock_picking_package_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ def _prepare_invoice(self):
'weight': self.weight,
'gross_weight': self.gross_weight,
'volume': self.volume,
'weight_manual_uom_id': self.weight_manual_uom_id.id,
'gross_weight_uom_id': self.gross_weight_uom_id.id,
'volume_uom_id': self.volume_uom_id.id,
})
return res

Expand Down
18 changes: 15 additions & 3 deletions l10n_it_ddt/views/account.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,21 @@
<field name="carrier_tracking_ref" />
<field name="dimension" />
<field name="parcels" />
<field name="weight" />
<field name="gross_weight" />
<field name="volume" />
<label for="weight"/>
<div class="o_row">
<field name="weight"/>
<field name="weight_manual_uom_id" groups="uom.group_uom" widget="selection"/>
</div>
<label for="gross_weight"/>
<div class="o_row">
<field name="gross_weight"/>
<field name="gross_weight_uom_id" groups="uom.group_uom" widget="selection"/>
</div>
<label for="volume"/>
<div class="o_row">
<field name="volume"/>
<field name="volume_uom_id" groups="uom.group_uom" widget="selection"/>
</div>
</group>
<newline/>
<group string="TD" name="ddt">
Expand Down
18 changes: 15 additions & 3 deletions l10n_it_ddt/views/sale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@
widget="selection"/>
<field name="ddt_carrier_id" />
<field name="parcels" />
<field name="weight" />
<field name="gross_weight"/>
<field name="volume" />
<label for="weight"/>
<div class="o_row">
<field name="weight"/>
<field name="weight_manual_uom_id" groups="uom.group_uom" widget="selection"/>
</div>
<label for="gross_weight"/>
<div class="o_row">
<field name="gross_weight"/>
<field name="gross_weight_uom_id" groups="uom.group_uom" widget="selection"/>
</div>
<label for="volume"/>
<div class="o_row">
<field name="volume"/>
<field name="volume_uom_id" groups="uom.group_uom" widget="selection"/>
</div>
</group>
<group>
<field name="create_ddt"/>
Expand Down

0 comments on commit 7171ad8

Please sign in to comment.