update report

This commit is contained in:
raman 2025-11-05 15:37:37 +05:30
parent 6391825a36
commit 74c29ffc45
6 changed files with 17 additions and 8 deletions

View File

@ -37,6 +37,13 @@ class MrpProduction(models.Model):
return moves
def action_confirm(self):
res = super(MrpProduction,self).action_confirm()
for rec in self:
rec.product_id.button_bom_cost()
return res
class MrpBomLine(models.Model):
_inherit = 'mrp.bom.line'

View File

@ -68,7 +68,7 @@ class SaleOrderLine(models.Model):
digits='Product Price', store=True, readonly=False, precompute=True,
groups="base.group_user")
@api.depends('product_id', 'company_id', 'product_uom')
@api.depends('product_id', 'company_id', 'product_uom','product_uom_qty')
def _compute_bag_weight(self):
for line in self:
line.bag_weight = line.product_id.weight * line.product_uom_qty

View File

@ -137,12 +137,12 @@ class SamashtiDashboard(models.AbstractModel):
('date_order', '>=', fromDate),
('date_order', '<=', toDate)
],
['id', 'name', 'amount_total', 'partner_id', 'total_production_cost','date_order']
['id', 'name', 'amount_untaxed', 'partner_id', 'total_production_cost','date_order']
)
for r in sale_orders:
cost = r['total_production_cost']
sale_price = r['amount_total']
sale_price = r['amount_untaxed']
margin = sale_price - cost
margin_percent = (margin / sale_price * 100) if sale_price else 0.0
customer = r['partner_id'][-1]
@ -209,7 +209,6 @@ class SamashtiDashboard(models.AbstractModel):
for line in sale_order.order_line.filtered(lambda l: l.product_id.type == 'consu'):
line_cost = line.purchase_price or 0
cost += line_cost * line.product_uom_qty
for line in sale_order.order_line.filtered(lambda l: l.product_id.type == 'service' and l.price_total > 0):
cost += line.price_total

View File

@ -5,6 +5,7 @@ from datetime import datetime
class AssetDetail(models.Model):
_name = "asset.detail"
_description = "Asset Detail"
_inherit = ['mail.thread', 'mail.activity.mixin']
name = fields.Char(string="Name")
asset_image = fields.Binary(string="Image")
@ -20,6 +21,7 @@ class AssetDetail(models.Model):
warranty_start = fields.Date(string="Warranty Start")
warranty_end = fields.Date(string="Warranty End")
note = fields.Html(string="Note")
quantity = fields.Float('Quantity', default=1.0, copy=False, tracking=True)
state = fields.Selection([('draft', 'New'), ('active', 'Active'), ('scrap', 'Scrap')], string='State', default="draft")
@api.model

View File

@ -40,7 +40,7 @@
<field name="purchase_date"/>
<field name="purchase_value"/>
<field name="location_id" options="{'no_create_edit': True, 'no_create': True}"/>
<!-- <field name="employee_id" options="{'no_create_edit': True, 'no_create': True}"/>-->
<field name="quantity"/>
</group>
</group>
<notebook>
@ -55,6 +55,7 @@
</page>
</notebook>
</sheet>
<chatter/>
</form>
</field>
</record>

View File

@ -28,8 +28,8 @@
</div>
<group>
<group>
<field name="vendor_id" readonly="state != 'draft'"/>
<field name="location_id" readonly="state != 'draft'"/>
<field name="vendor_id" readonly="state != 'draft'" options="{'no_create_edit': True, 'no_create': True}"/>
<field name="location_id" readonly="state != 'draft'" options="{'no_create_edit': True, 'no_create': True}"/>
</group>
<group>
<field name="date" readonly="state != 'draft'"/>
@ -47,7 +47,7 @@
<create string="Add a line"/>
<button name="action_add_from_catalog" string="Catalog" type="object" class="px-4 btn-link" context="{'order_id': parent.id}"/>
</control>
<field name="product_id" readonly="parent.state != 'draft'"/>
<field name="product_id" readonly="parent.state != 'draft'" options="{'no_create_edit': True, 'no_create': True}"/>
<field name="quantity" readonly="parent.state != 'draft'"/>
<field name="product_uom_id" readonly="1" string="UoM"/>
<field name="price" readonly="parent.state != 'draft'"/>