Reference #9 and #10

This commit is contained in:
Deena 2025-08-13 11:07:30 +05:30
parent 611cb5e418
commit 652885bfb7
8 changed files with 73 additions and 18 deletions

View File

@ -40,6 +40,7 @@ class NCMR_Model(models.Model):
qa_action = fields.Selection([ ('scrap', 'Scrap'),('rework', 'Rework')], string="Action") qa_action = fields.Selection([ ('scrap', 'Scrap'),('rework', 'Rework')], string="Action")
dispensed_doc_ref = fields.Char(string="Dispensed Doc Ref") dispensed_doc_ref = fields.Char(string="Dispensed Doc Ref")
dispensed_responsibility = fields.Text(string="Dispensed Responsibility") dispensed_responsibility = fields.Text(string="Dispensed Responsibility")
return_incoming_resposibility = fields.Char(string="Approved Doc Ref")
approved_doc_ref = fields.Char(string="Approved Doc Ref") approved_doc_ref = fields.Char(string="Approved Doc Ref")
approved_responsibility = fields.Text(string="Approved Responsibility") approved_responsibility = fields.Text(string="Approved Responsibility")
customer_complaint_doc_ref = fields.Char(string="Customer Complaint Doc Ref") customer_complaint_doc_ref = fields.Char(string="Customer Complaint Doc Ref")
@ -112,7 +113,7 @@ class NCMR_Model(models.Model):
('sos_return_fir', 'Return BRR FIR Ref'), ('sos_return_fir', 'Return BRR FIR Ref'),
('sos_fir', 'FIR Ref') ('sos_fir', 'FIR Ref')
], ],
string="Incoming Document Reference", string="Document Reference",
compute="_compute_combined_incoming_doc_ref", compute="_compute_combined_incoming_doc_ref",
store=False store=False
) )

View File

@ -77,11 +77,28 @@ class sos__wo(models.Model):
top_management_approved_on = fields.Datetime(string="Approved On") top_management_approved_on = fields.Datetime(string="Approved On")
rounded_total_value = fields.Float(string="Total Value", compute="_compute_total_value", store=True) rounded_total_value = fields.Float(string="Total Value", compute="_compute_total_value", store=True)
adjustment_value = fields.Float(string="Round-off", compute="_compute_total_value", store=True) adjustment_value = fields.Float(string="Round-off", compute="_compute_total_value", store=True)
# @api.model nre_charges = fields.Monetary(string="NRE Charges", currency_field='currency_id')
# def create(self, vals): nre_tax = fields.Integer(default=18,string="Tax (%)")
# record = super(sos__wo, self).create(vals) nre_tax_amount = fields.Float(string="NRE Tax Value", store=True,readonly=True, compute="_compute_nretax")
# record.action_esign_btn() nre_total_value = fields.Float(string="Total", store=True)
# return record
@api.depends('nre_charges', 'nre_tax')
def _compute_nretax(self):
for record in self:
if record.nre_charges:
nre_tax_amount = round((record.nre_tax * record.nre_charges) / 100, 2)
exact_total = round(record.nre_charges + nre_tax_amount, 2)
if math.isnan(exact_total) or exact_total is None:
record.total_value = 0.00
record.nre_total_value = 0.00
else:
rounded_total = round(exact_total)
record.nre_total_value = exact_total
record.nre_tax_amount = nre_tax_amount
else:
record.nre_total_value = 0.00
record.nre_tax_amount = 0.00
def action_amend(self): def action_amend(self):
active_ids = self.env.context.get('active_ids', []) active_ids = self.env.context.get('active_ids', [])
records = self.browse(active_ids) records = self.browse(active_ids)
@ -191,12 +208,12 @@ class sos__wo(models.Model):
for record in self: for record in self:
record.gross_value = round(sum(line.total_price for line in record.line_ids), 2) record.gross_value = round(sum(line.total_price for line in record.line_ids), 2)
@api.depends('gross_value') @api.depends('gross_value','nre_total_value')
def _compute_total_value(self): def _compute_total_value(self):
for record in self: for record in self:
if record.wo_planned_at != "inhouse": if record.wo_planned_at != "inhouse":
if record.gross_value: if record.gross_value:
exact_total = round(record.gross_value, 2) exact_total = round(record.nre_total_value + record.gross_value, 2)
if math.isnan(exact_total) or exact_total is None: if math.isnan(exact_total) or exact_total is None:
record.total_value = 0.00 record.total_value = 0.00
record.rounded_total_value = 0.00 record.rounded_total_value = 0.00

View File

@ -47,7 +47,12 @@
<record id="sos_ncmr_all_records_rule" model="ir.rule"> <record id="sos_ncmr_all_records_rule" model="ir.rule">
<field name="name">Sos NCMR: All Records - Read Access</field> <field name="name">Sos NCMR: All Records - Read Access</field>
<field name="model_id" ref="model_sos_ncmr"/> <field name="model_id" ref="model_sos_ncmr"/>
<field name="domain_force">[('rd_user', '=', user.id), ('rework_responsible_rd_user', '=', user.id)]</field> <field name="domain_force">
['|',
('rd_user', 'in', [user.id]),
('rework_responsible_rd_user', '=', user.id)
]
</field>
<field name="groups" eval="[(4, ref('base.group_user'))]"/> <field name="groups" eval="[(4, ref('base.group_user'))]"/>
<field name="perm_read" eval="1"/> <field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/> <field name="perm_write" eval="1"/>

View File

@ -81,7 +81,7 @@
<notebook> <notebook>
<page string="Finished Goods"> <page string="Finished Goods">
<field name="line_ids_fg"> <field name="line_ids_fg" readonly="scg_head_verified_by">
<tree editable="bottom"> <tree editable="bottom">
<field name="component_id"/> <field name="component_id"/>
<field name="add_production_cost" widget="boolean_toggle"/> <field name="add_production_cost" widget="boolean_toggle"/>
@ -94,7 +94,7 @@
</field> </field>
</page> </page>
<page string="Semi Finished Goods"> <page string="Semi Finished Goods">
<field name="line_ids_sfg"> <field name="line_ids_sfg" readonly="scg_head_verified_by">
<tree editable="bottom"> <tree editable="bottom">
<field name="component_id"/> <field name="component_id"/>
<field name="add_production_cost" widget="boolean_toggle"/> <field name="add_production_cost" widget="boolean_toggle"/>
@ -107,7 +107,7 @@
</field> </field>
</page> </page>
<page string="Materials"> <page string="Materials">
<field name="line_ids_material"> <field name="line_ids_material" readonly="scg_head_verified_by">
<tree editable="bottom"> <tree editable="bottom">
<field name="component_id"/> <field name="component_id"/>
<field name="display_name"/> <field name="display_name"/>
@ -122,7 +122,7 @@
</field> </field>
</page> </page>
<page string="Installation Kit"> <page string="Installation Kit">
<field name="line_ids_installation_kit"> <field name="line_ids_installation_kit" readonly="scg_head_verified_by">
<tree editable="bottom"> <tree editable="bottom">
<field name="component_id"/> <field name="component_id"/>
<field name="display_name"/> <field name="display_name"/>
@ -134,7 +134,7 @@
</field> </field>
</page> </page>
<page string="Miscellaneous"> <page string="Miscellaneous">
<field name="line_ids_miscellaneous"> <field name="line_ids_miscellaneous" readonly="scg_head_verified_by">
<tree editable="bottom"> <tree editable="bottom">
<field name="name"/> <field name="name"/>
<field name="cost"/> <field name="cost"/>

View File

@ -173,16 +173,19 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr><td class="column">In-Coming Material (RM/PM)</td><td><field name="combined_incoming_doc_ref"/></td><td><field name="incoming_responsibility"/></td></tr> <tr><td class="column">In-Coming Material (RM/PM)</td><td><field name="incoming_doc_ref"/></td><td><field name="incoming_responsibility"/></td></tr>
<tr><td class="column">Return In-Coming Material (RM/PM)</td><td><field name="return_incoming_doc_ref"/></td><td><field name="return_incoming_resposibility"/></td></tr>
<!--
<tr><td class="column">Dispensed Material (RM/PM)</td><td><field name="dispensed_doc_ref"/></td><td><field name="dispensed_responsibility"/></td></tr> <tr><td class="column">Dispensed Material (RM/PM)</td><td><field name="dispensed_doc_ref"/></td><td><field name="dispensed_responsibility"/></td></tr>
<tr><td class="column">Approved Stored Material (RM/PM)</td><td><field name="approved_doc_ref"/></td><td><field name="approved_responsibility"/></td></tr> <tr><td class="column">Approved Stored Material (RM/PM)</td><td><field name="approved_doc_ref"/></td><td><field name="approved_responsibility"/></td></tr>
<tr><td class="column">Customer Complaint</td><td><field name="customer_complaint_doc_ref"/></td><td><field name="customer_complaint_responsibility"/></td></tr> <tr><td class="column">Customer Complaint</td><td><field name="customer_complaint_doc_ref"/></td><td><field name="customer_complaint_responsibility"/></td></tr>
<tr><td class="column">Approved Finished Products</td><td><field name="approved_fg_doc_ref"/></td><td><field name="approved_fg_responsibility"/></td></tr> -->
<tr><td class="column">Returned Finished Products</td><td><field name="returned_fg_doc_ref"/></td><td><field name="returned_fg_responsibility"/></td></tr> <tr><td class="column">Approved Finished Products</td><td><field name="fir_incoming_doc_ref"/></td><td><field name="approved_fg_responsibility"/></td></tr>
<tr><td class="column">Finished Products(Production Assy)</td><td><field name="finished_fg_assy"/></td><td><field name="finished_fg_assy_responsibility"/></td></tr> <tr><td class="column">Returned Finished Products</td><td><field name="return_fg_incoming_doc_ref"/></td><td><field name="returned_fg_responsibility"/></td></tr>
<tr><td class="column">Finished Products(Production Assy)</td><td><field name="fg_incoming_doc_ref"/></td><td><field name="finished_fg_assy_responsibility"/></td></tr>
</tbody> </tbody>
</table> </table>

View File

@ -147,6 +147,35 @@
</tree> </tree>
</field> </field>
<div class="oe_subtotal_footer" style="float: left;
padding: 20px;
border: solid 1px #ccc;
font-weight: bold;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;">
<!-- Gross Value Field -->
<div style="margin-bottom: 5px;">
<label for="nre_charges" style="font-weight: bold; margin-right: 10px;">Delivery Charges</label>
<field name="nre_charges" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/>
</div>
<!-- Tax Field -->
<div style="margin-bottom: 5px;">
<label for="nre_tax" style="font-weight: bold; margin-right: 10px;">Tax (%)</label>
<field name="nre_tax" class="oe_inline"/>
</div>
<div style="margin-bottom: 5px;">
<label for="nre_tax_amount" style="font-weight: bold; margin-right: 10px;">Tax Amount</label>
<field name="nre_tax_amount" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/>
</div>
<div>
<label for="nre_total_value" style="font-weight: bold; margin-right: 10px;">Final Value</label>
<field name="nre_total_value" widget="monetary" options="{'currency_field': 'currency_id'}" class="oe_inline"/>
</div>
</div>
<div invisible="wo_planned_at == 'inhouse'" class="oe_subtotal_footer" style="float: right; <div invisible="wo_planned_at == 'inhouse'" class="oe_subtotal_footer" style="float: right;
padding: 34px; padding: 34px;
border: solid 1px #ccc; border: solid 1px #ccc;