bemade_fsm: Finished a test tour for adding equipment to a sales order.
This commit is contained in:
parent
e1268d2fda
commit
90ba705eef
6 changed files with 59 additions and 36 deletions
|
|
@ -49,7 +49,7 @@
|
|||
'assets': {
|
||||
'web.assets_tests': [
|
||||
'bemade_fsm/static/tests/tours/task_template_tour.js',
|
||||
'bemade_fsm/static/tests/tours/task_equipment_tour.js',
|
||||
'bemade_fsm/static/tests/tours/equipment_tour.js',
|
||||
],
|
||||
},
|
||||
'installable': True,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ class Equipment(models.Model):
|
|||
partner_location_id = fields.Many2one('res.partner',
|
||||
string="Physical Address",
|
||||
tracking=True,
|
||||
required=True,
|
||||
ondelete='cascade')
|
||||
|
||||
location_notes = fields.Text(string="Physical Location Notes",
|
||||
|
|
|
|||
|
|
@ -22,13 +22,14 @@ class SaleOrder(models.Model):
|
|||
compute='_compute_equipment',
|
||||
inverse='_inverse_equipment',
|
||||
string='Equipment to Service',
|
||||
store=True)
|
||||
store=True,
|
||||
ondelete='restrict')
|
||||
|
||||
@api.depends('partner_id')
|
||||
def _compute_default_contacts(self):
|
||||
for rec in self:
|
||||
rec.site_contacts = rec.partner_id.site_contacts
|
||||
rec.work_order_contacts = rec.partner_id.work_order_contacts
|
||||
rec.site_contacts = rec.partner_shipping_id.site_contacts
|
||||
rec.work_order_contacts = rec.partner_shipping_id.work_order_contacts
|
||||
|
||||
def _inverse_default_contacts(self):
|
||||
pass
|
||||
|
|
@ -36,7 +37,8 @@ class SaleOrder(models.Model):
|
|||
@api.depends('partner_id')
|
||||
def _compute_equipment(self):
|
||||
for rec in self:
|
||||
rec.equipment_ids = self.partner_id.equipment_ids if len(self.partner_id.equipment_ids) <= 1 else False
|
||||
rec.equipment_ids = self.partner_shipping_id.equipment_ids if len(
|
||||
self.partner_shipping_id.equipment_ids) <= 1 else False
|
||||
|
||||
def _inverse_equipment(self):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -101,6 +101,26 @@ tour.register('equipment_sale_order_tour', {
|
|||
trigger: 'a.nav-link[role="tab"]:contains(Field Service)'
|
||||
}, {
|
||||
content: 'Check that default equipment shows up.',
|
||||
trigger: `tr:has(label.o_form_label:contains(Site Equipment)) td.o_field_cell:contains(${TEST_EQPT1})`
|
||||
},
|
||||
trigger: `.o_field_cell:contains(${TEST_EQPT1})`,
|
||||
}, {
|
||||
content: 'Add test equipment 2',
|
||||
trigger: `div[name="equipment_ids"] a:contains(Add a line)`,
|
||||
}, {
|
||||
content: 'Click create',
|
||||
trigger: '.modal-footer > button:has(span:contains(Create))',
|
||||
}, {
|
||||
content: 'Name the new equipment',
|
||||
trigger: 'input.o_field_widget[name="name"]',
|
||||
run: `text ${TEST_EQPT2}`,
|
||||
}, {
|
||||
content: 'Save & Close',
|
||||
trigger: 'button:has(span:contains(Save & Close))',
|
||||
}, {
|
||||
content: 'Save',
|
||||
trigger: 'button.o_form_button_save',
|
||||
}, {
|
||||
content: 'Check that the new equipment was added',
|
||||
trigger: `.o_field_cell:contains(${TEST_EQPT2})`,
|
||||
run: function () {},
|
||||
}
|
||||
]);
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
</field>
|
||||
<field name="work_order_contacts" attrs="{'invisible': [('company_type','=','person')]}">
|
||||
<tree editable="bottom">
|
||||
<field name="name" widget="res_partner_many2one"/>
|
||||
<field name="name" widget="res_partner_many2one" />
|
||||
<field name="email" widget="email"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
|
|
|
|||
|
|
@ -9,33 +9,35 @@
|
|||
<xpath expr="//page[@name='other_information']" position="before">
|
||||
<page name="field_service" string="Field Service">
|
||||
<group name="contacts">
|
||||
<field name="site_contacts">
|
||||
<tree editable="bottom">
|
||||
<field name="name" widget="res_partner_many2one"/>
|
||||
<field name="email" widget="email"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="work_order_contacts">
|
||||
<tree editable="bottom">
|
||||
<field name="name" widget="res_partner_many2one"/>
|
||||
<field name="email" widget="email"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="equipment_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="pid_tag"/>
|
||||
<field name="name"/>
|
||||
<field name="location_notes"/>
|
||||
<button name="action_view_equipment"
|
||||
type="object"
|
||||
string="Details"
|
||||
icon="fa-external-link"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="site_contacts">
|
||||
<tree editable="bottom">
|
||||
<field name="name" widget="res_partner_many2one"/>
|
||||
<field name="email" widget="email"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="work_order_contacts">
|
||||
<tree editable="bottom">
|
||||
<field name="name" widget="res_partner_many2one"/>
|
||||
<field name="email" widget="email"/>
|
||||
<field name="phone" widget="phone"/>
|
||||
<field name="mobile" widget="phone"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="equipment_ids"
|
||||
domain="[('partner_location_id', '=', partner_shipping_id)]"
|
||||
context="{'default_partner_location_id': partner_shipping_id}">
|
||||
<tree editable="bottom">
|
||||
<field name="pid_tag"/>
|
||||
<field name="name"/>
|
||||
<field name="location_notes"/>
|
||||
<button name="action_view_equipment"
|
||||
type="object"
|
||||
string="Details"
|
||||
icon="fa-external-link"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
|
|
|
|||
Loading…
Reference in a new issue