mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
add app_stock_barcode
This commit is contained in:
27
app_stock_barcode/models/stock_pack_operation.py
Normal file
27
app_stock_barcode/models/stock_pack_operation.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.exceptions import Warning
|
||||
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class PackOperation(models.Model):
|
||||
_inherit = "stock.pack.operation"
|
||||
|
||||
weight = fields.Float(
|
||||
'Weight', digits=dp.get_precision('Stock Weight'), related='product_id.weight', readonly=True, store=True,
|
||||
help="The weight of the contents in Kg, not including any packaging, etc.")
|
||||
|
||||
weight_done_subtotal = fields.Float(
|
||||
'Weight Done Subtotal', digits=dp.get_precision('Stock Weight'), compute='_compute_weight_done_subtotal', readonly=True, store=True,
|
||||
help="The weight of the contents in Kg, not including any packaging, etc.")
|
||||
|
||||
@api.depends('weight', 'qty_done')
|
||||
def _compute_weight_done_subtotal(self):
|
||||
for rec in self:
|
||||
rec.weight_done_subtotal = rec.weight * rec.qty_done
|
||||
Reference in New Issue
Block a user