forked from OCA/hr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request OCA#33 from leemannd/bsrtl159
[WIP] bsrtl159 - Ghost Product & new state on SO
- Loading branch information
Showing
10 changed files
with
281 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo noupdate="1"> | ||
|
||
<record id="rtl_eng_validation" model="res.groups"> | ||
<field name="name">Roctool Engineering Managers</field> | ||
<field name="users" eval="[(4, ref('base.user_root'))]"/> | ||
</record> | ||
<record id="rtl_sys_manager" model="res.groups"> | ||
<field name="name">Roctool Process Managers</field> | ||
<field name="users" eval="[(4, ref('base.user_root'))]"/> | ||
</record> | ||
<record id="rtl_pro_manager" model="res.groups"> | ||
<field name="name">Roctool System Managers</field> | ||
<field name="users" eval="[(4, ref('base.user_root'))]"/> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
odoo/local-src/specific_sale/models/mail_compose_message.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# -*- coding: utf-8 -*- | ||
# Author: Denis Leemann | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, api | ||
|
||
|
||
class MailComposeMessage(models.TransientModel): | ||
_inherit = 'mail.compose.message' | ||
|
||
@api.multi | ||
def onchange_template_id(self, | ||
template_id, | ||
composition_mode, | ||
model, | ||
res_id): | ||
values = super(MailComposeMessage, self).onchange_template_id( | ||
template_id, composition_mode, model, res_id | ||
) | ||
|
||
if model != 'sale.order': | ||
return values | ||
|
||
order = self.env['sale.order'].browse(res_id) | ||
if not order.sales_condition: | ||
return values | ||
|
||
# xmlids of email.template in which we join the sales condition | ||
# document | ||
sale_condition_xmlids = ( | ||
'sale.email_template_edi_sale', | ||
) | ||
condition_template_ids = [] | ||
for xmlid in sale_condition_xmlids: | ||
template = self.env.ref(xmlid, raise_if_not_found=False) | ||
condition_template_ids.append(template.id) | ||
|
||
# sending a mail quote | ||
if template_id not in condition_template_ids: | ||
return values | ||
|
||
attachment = self.env['ir.attachment'].search( | ||
[('res_model', '=', 'sale.order'), | ||
('res_field', '=', 'sales_condition'), | ||
('res_id', '=', order.id), | ||
], | ||
limit=1, | ||
) | ||
fname = order.sales_condition_filename | ||
# Replicate what's done in | ||
# addons/mail_template/wizard/mail_compose_message.py | ||
# The attachment should be cleaned by odoo later | ||
data_attach = { | ||
'name': fname, | ||
'datas': attachment.datas, | ||
'datas_fname': fname, | ||
'res_model': 'mail.compose.message', | ||
'res_id': 0, | ||
'type': 'binary', | ||
} | ||
new_attachment = self.env['ir.attachment'].create(data_attach) | ||
value = values['value'] | ||
if 'attachment_ids' in value: | ||
# add the new attachment to the existing command created | ||
# by the super onchange | ||
for cmd in value['attachment_ids']: | ||
if cmd[0] == 6: | ||
ids = cmd[2] | ||
ids.append(new_attachment.id) | ||
else: | ||
raise Exception('unhandled') | ||
else: | ||
value['attachment_id'] = [(6, 0, new_attachment.ids)] | ||
|
||
return values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# -*- coding: utf-8 -*- | ||
# Author: Denis Leemann | ||
# Copyright 2017 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models, fields | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = 'product.template' | ||
|
||
is_ghost = fields.Boolean( | ||
string='Ghost Product', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<odoo> | ||
|
||
<record id="view_template_property_form" model="ir.ui.view"> | ||
<field name="name">product.ghost</field> | ||
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="product.product_template_form_view"/> | ||
<field name="arch" type="xml"> | ||
<div name="options" position="inside"> | ||
<div> | ||
<field name="is_ghost"/> | ||
<label for="is_ghost"/> | ||
</div> | ||
</div> | ||
</field> | ||
</record> | ||
|
||
<record id="product_template_only_form_view" model="ir.ui.view"> | ||
<field name="name">product.template.ghost.form</field> | ||
<field name="model">product.template</field> | ||
<field name="inherit_id" ref="product.product_template_only_form_view"/> | ||
<field name="arch" type="xml"> | ||
<div name="options" position="inside"> | ||
<div> | ||
<field name="is_ghost"/> | ||
<label for="is_ghost"/> | ||
</div> | ||
</div> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,4 @@ migration: | |
addons: | ||
upgrade: | ||
- specific_crm | ||
- specific_sale |