Split FSM into separate modules and switch customer to address book
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
"depends": [
|
||||
"base",
|
||||
"mail",
|
||||
"dsrpt_repair_main",
|
||||
"dsrpt_repair_customers",
|
||||
"dsrpt_repair_config",
|
||||
"dsrpt_address_book",
|
||||
"dsrpt_repair_technicians",
|
||||
"dsrpt_repair_materials",
|
||||
],
|
||||
|
||||
@@ -9,18 +9,7 @@ class RepairWorkOrder(models.Model):
|
||||
_order = "id desc"
|
||||
|
||||
name = fields.Char(default="New", copy=False, readonly=True, tracking=True)
|
||||
customer_id = fields.Many2one("repair.customer", required=True, tracking=True)
|
||||
customer_contact_id = fields.Many2one(
|
||||
"repair.customer.contact",
|
||||
domain="[('customer_id', '=', customer_id)]",
|
||||
tracking=True,
|
||||
)
|
||||
address_id = fields.Many2one(
|
||||
"repair.customer.address",
|
||||
domain="[('customer_id', '=', customer_id)]",
|
||||
string="Service Address",
|
||||
tracking=True,
|
||||
)
|
||||
contact_id = fields.Many2one("dsrpt.contact", required=True, tracking=True)
|
||||
zone_id = fields.Many2one("repair.fsm.zone", string="FSM Zone", tracking=True)
|
||||
description = fields.Text()
|
||||
requested_datetime = fields.Datetime(default=fields.Datetime.now)
|
||||
@@ -57,12 +46,6 @@ class RepairWorkOrder(models.Model):
|
||||
rec.total_time_hours = sum(rec.time_line_ids.mapped("hours"))
|
||||
rec.total_material_cost = sum(rec.material_line_ids.mapped("subtotal"))
|
||||
|
||||
@api.onchange("address_id")
|
||||
def _onchange_address_id(self):
|
||||
for rec in self:
|
||||
if rec.address_id and rec.address_id.zone_id:
|
||||
rec.zone_id = rec.address_id.zone_id
|
||||
|
||||
def action_confirm(self):
|
||||
self.write({"state": "confirmed"})
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<list>
|
||||
<field name="name"/>
|
||||
<field name="customer_id"/>
|
||||
<field name="contact_id"/>
|
||||
<field name="zone_id"/>
|
||||
<field name="scheduled_datetime"/>
|
||||
<field name="technician_id"/>
|
||||
@@ -35,9 +35,7 @@
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="customer_id"/>
|
||||
<field name="customer_contact_id"/>
|
||||
<field name="address_id"/>
|
||||
<field name="contact_id"/>
|
||||
<field name="zone_id"/>
|
||||
</group>
|
||||
<group>
|
||||
@@ -88,5 +86,5 @@
|
||||
<field name="view_mode">list,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_repair_work_orders" name="Work Orders" parent="dsrpt_repair_main.menu_repair_root" action="action_repair_work_order" sequence="10"/>
|
||||
<menuitem id="menu_repair_work_orders" name="Work Orders" parent="dsrpt_repair_config.menu_repair_root" action="action_repair_work_order" sequence="10"/>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user