add new module

This commit is contained in:
sonal arora
2020-07-21 10:09:46 +00:00
parent 800e7fdceb
commit c0d10e3fbe
1063 changed files with 243750 additions and 5 deletions

View File

@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# For Module Support : mayurmaheshwari07@gmail.com or Skype : mayur_maheshwari1
#
##############################################################################
from . import models
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# For Module Support : mayurmaheshwari07@gmail.com or Skype : mayur_maheshwari1
#
##############################################################################
{
'name': 'Sale Field Service Task',
'version': '13.0.1.0',
'sequence': 1,
'category': 'Generic Modules/Sales Management',
'description':
"""
This Module add below functionality into odoo
1.Sale Field Service Task\n
""",
'summary': 'Sale Field Service Task',
'author': 'Mayur Maheshwari',
'depends': ['sale_management','industry_fsm','project'],
'data': [
'views/res_config_views.xml',
'views/sale_view.xml',
],
'demo': [],
'test': [],
'css': [],
'qweb': [],
'js': [],
'images': [],
'installable': True,
'application': True,
'auto_install': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# For Module Support : mayurmaheshwari07@gmail.com or Skype : mayur_maheshwari1
#
##############################################################################
from . import res_config
from . import sale
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# For Module Support : mayurmaheshwari07@gmail.com or Skype : mayur_maheshwari1
#
##############################################################################
from odoo import models, fields, api
class ResCompany(models.Model):
_inherit = 'res.company'
project_id = fields.Many2one('project.project',string='Project' ,readonly=False)
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
project_id = fields.Many2one(related='company_id.project_id',readonly=False, string='Project')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# For Module Support : mayurmaheshwari07@gmail.com or Skype : mayur_maheshwari1
#
##############################################################################
from odoo import models, fields, api,_
from odoo.exceptions import ValidationError
class sale_order(models.Model):
_inherit='sale.order'
task_id = fields.Many2one('project.task',string='Field Services Task', \
copy=False)
#Vals for create fields task from Sale Order
def services_task_values(self):
if not self.company_id.project_id:
raise ValidationError(_('Project - Field Service Task not configured properly !'))
project_id = self.company_id.project_id and self.company_id.project_id.id \
or False
notes = "Notes:" + '<br/>'+"-----------------------"+'<br/>'+"Product: "\
+'<br/><br/>'
for line in self.order_line:
notes += str(line.product_id.name )+" : "+ str(line.product_uom_qty)\
+" qty" +'<br/>'
vals = {'name':self.name,
'partner_id': self.partner_id and self.partner_id.id or False,
'planned_date_begin': self.date_order,
'planned_date_end': self.date_order,
'project_id':project_id,
'description':notes,
}
return vals
def _prepare_project_task(self,task_values):
project_task_ids = self.env['project.task'].create(task_values)
self.task_id = project_task_ids.id
return True
def action_confirm(self):
res =super(sale_order,self).action_confirm()
task_values = self.services_task_values()
self._prepare_project_task(task_values)
return res
def action_view_task(self):
action = self.env.ref('industry_fsm.project_task_action_fsm').read()[0]
task_id = self.mapped('task_id')
if task_id:
action['views'] = [
(self.env.ref('industry_fsm.project_task_view_form').id, 'form')]
action['res_id'] = task_id.id
return action
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<odoo>
<record id="res_config_sale_project" model="ir.ui.view">
<field name="name">res.config.sale.project</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="50"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@data-key='sale_management']//h2" position="before">
<h2>Project - Field Service Task</h2>
<div class="row mt16 o_settings_container" id="product_deposit">
<div class="col-xs-12 o_setting_box">
<group>
<field name="project_id" domain="[('is_fsm', '=', True)]" style="width:80%%"/>
</group>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="sale_task_view" model="ir.ui.view">
<field name="name">sale.order.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='preview_sale_order']" position="before">
<button type="object" name="action_view_task" attrs="{'invisible': [('state', 'not in',['sale','done'])]}" string='Field Services' class="oe_stat_button" icon="fa-align-justify" />
</xpath>
</field>
</record>
</odoo>