Compare commits
1 Commits
14.0-web_t
...
14.0-imp-m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
279dc7c6c0 |
@@ -11,6 +11,8 @@ from odoo.osv import expression
|
|||||||
class AccountMove(models.Model):
|
class AccountMove(models.Model):
|
||||||
_inherit = 'account.move'
|
_inherit = 'account.move'
|
||||||
|
|
||||||
|
default_move_line_name = fields.Char(
|
||||||
|
string='Default Label', states={'posted': [('readonly', True)]})
|
||||||
# By default, we can still modify "ref" when account move is posted
|
# By default, we can still modify "ref" when account move is posted
|
||||||
# which seems a bit lazy for me...
|
# which seems a bit lazy for me...
|
||||||
ref = fields.Char(states={'posted': [('readonly', True)]})
|
ref = fields.Char(states={'posted': [('readonly', True)]})
|
||||||
@@ -178,35 +180,6 @@ class AccountMove(models.Model):
|
|||||||
])
|
])
|
||||||
move.suitable_journal_ids = self.env['account.journal'].search(domain)
|
move.suitable_journal_ids = self.env['account.journal'].search(domain)
|
||||||
|
|
||||||
def button_draft(self):
|
|
||||||
super().button_draft()
|
|
||||||
# Delete attached pdf invoice
|
|
||||||
try:
|
|
||||||
report_invoice = self.env['ir.actions.report']._get_report_from_name('account.report_invoice')
|
|
||||||
except IndexError:
|
|
||||||
report_invoice = False
|
|
||||||
if report_invoice and report_invoice.attachment:
|
|
||||||
for move in self.filtered(lambda x: x.move_type in ('out_invoice', 'out_refund')):
|
|
||||||
# The pb is that the filename is dynamic and related to move.state
|
|
||||||
# in v12, the feature was native and they used that kind of code:
|
|
||||||
# with invoice.env.do_in_draft():
|
|
||||||
# invoice.number, invoice.state = invoice.move_name, 'open'
|
|
||||||
# attachment = self.env.ref('account.account_invoices').retrieve_attachment(invoice)
|
|
||||||
# But do_in_draft() doesn't exists in v14
|
|
||||||
# If you know how we could do that, please update the code below
|
|
||||||
attachment = self.env['ir.attachment'].search([
|
|
||||||
('name', '=', self._get_invoice_attachment_name()),
|
|
||||||
('res_id', '=', move.id),
|
|
||||||
('res_model', '=', self._name),
|
|
||||||
('type', '=', 'binary'),
|
|
||||||
], limit=1)
|
|
||||||
if attachment:
|
|
||||||
attachment.unlink()
|
|
||||||
|
|
||||||
def _get_invoice_attachment_name(self):
|
|
||||||
self.ensure_one()
|
|
||||||
return '%s.pdf' % (self.name and self.name.replace('/', '_') or 'INV')
|
|
||||||
|
|
||||||
|
|
||||||
class AccountMoveLine(models.Model):
|
class AccountMoveLine(models.Model):
|
||||||
_inherit = 'account.move.line'
|
_inherit = 'account.move.line'
|
||||||
|
|||||||
@@ -12,20 +12,16 @@ class ProductTemplate(models.Model):
|
|||||||
only one BoM form or a list of BoMs."""
|
only one BoM form or a list of BoMs."""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
if self.bom_count == 1:
|
if self.bom_count == 1:
|
||||||
action_xml_id = "mrp.mrp_bom_form_action"
|
action = self.env.ref("mrp.mrp_bom_form_action").read()[0]
|
||||||
action = self.env["ir.actions.actions"]._for_xml_id(action_xml_id)
|
|
||||||
bom = self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)])
|
bom = self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)])
|
||||||
action.update(
|
action.update({
|
||||||
{
|
|
||||||
"context": {"default_product_tmpl_id": self.id},
|
"context": {"default_product_tmpl_id": self.id},
|
||||||
"views": False,
|
"views": False,
|
||||||
"view_mode": "form,tree",
|
"view_mode": "form,tree",
|
||||||
"res_id": bom.id,
|
"res_id": bom.id,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
action_xml_id = "mrp.template_open_bom"
|
action = self.env.ref("mrp.template_open_bom").read()[0]
|
||||||
action = self.env["ir.actions.actions"]._for_xml_id(action_xml_id)
|
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
||||||
@@ -36,11 +32,9 @@ class ProductProduct(models.Model):
|
|||||||
action = super().action_view_bom()
|
action = super().action_view_bom()
|
||||||
bom_target_ids = self.env["mrp.bom"].search(action["domain"])
|
bom_target_ids = self.env["mrp.bom"].search(action["domain"])
|
||||||
if len(bom_target_ids) == 1:
|
if len(bom_target_ids) == 1:
|
||||||
action.update(
|
action.update({
|
||||||
{
|
|
||||||
"views": False,
|
"views": False,
|
||||||
"view_mode": "form,tree",
|
"view_mode": "form,tree",
|
||||||
"res_id": bom_target_ids[0].id,
|
"res_id": bom_target_ids[0].id,
|
||||||
}
|
})
|
||||||
)
|
|
||||||
return action
|
return action
|
||||||
|
|||||||
@@ -7,15 +7,14 @@
|
|||||||
|
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
|
<!--
|
||||||
<record id="account_invoice_form" model="ir.ui.view">
|
<record id="account_invoice_form" model="ir.ui.view">
|
||||||
<field name="name">sale_usability.customer.invoice.form</field>
|
<field name="name">sale_usability.customer.invoice.form</field>
|
||||||
<field name="model">account.move</field>
|
<field name="model">account.invoice</field>
|
||||||
<field name="inherit_id" ref="sale.account_invoice_form"/>
|
<field name="inherit_id" ref="sale.account_invoice_form"/>
|
||||||
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_manager'))]" />
|
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<div name="button_box" position="inside">
|
<div name="button_box" position="inside">
|
||||||
<button
|
<button name="show_sale_orders"
|
||||||
name="show_sale_orders"
|
|
||||||
type="object"
|
type="object"
|
||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
icon="fa-pencil-square-o"
|
icon="fa-pencil-square-o"
|
||||||
@@ -25,6 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
-->
|
||||||
|
|
||||||
<record id="view_move_form" model="ir.ui.view">
|
<record id="view_move_form" model="ir.ui.view">
|
||||||
<field name="name">sale_usability.account.move.form</field>
|
<field name="name">sale_usability.account.move.form</field>
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after">
|
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after">
|
||||||
<field name="product_barcode" optional="hide"/>
|
<field name="product_barcode" optional="hide"/>
|
||||||
<field name="name" optional="hide"/>
|
<field name="name" optional="hide"/>
|
||||||
<field name="location_id" groups="stock.group_stock_multi_locations" optional="show"/>
|
<field name="location_id" groups="stock.group_stock_multi_locations" optional="show" domain="[('id', 'child_of', 'parent.location_id')]" options="{'no_create': True}"/>
|
||||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations" optional="show"/>
|
<field name="location_dest_id" groups="stock.group_stock_multi_locations" optional="show" domain="[('id', 'child_of', 'parent.location_dest_id')]" options="{'no_create': True}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='move_ids_without_package']/tree/button[@name='action_assign_serial']" position="after">
|
<xpath expr="//field[@name='move_ids_without_package']/tree/button[@name='action_assign_serial']" position="after">
|
||||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
# Copyright 2021 Akretion
|
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
|
||||||
|
|
||||||
{
|
|
||||||
'name': 'Web Tab Title',
|
|
||||||
'description': """
|
|
||||||
Automatically set tab document.title when empty.
|
|
||||||
Important limitation: the tab will get its title only once you browse it.
|
|
||||||
""",
|
|
||||||
'version': '14.0.1.0.0',
|
|
||||||
'license': 'AGPL-3',
|
|
||||||
'author': 'Akretion',
|
|
||||||
'website': 'akretion.com',
|
|
||||||
'depends': [
|
|
||||||
'web',
|
|
||||||
],
|
|
||||||
'data': [
|
|
||||||
],
|
|
||||||
'demo': [
|
|
||||||
],
|
|
||||||
"data": ["views/web_tab_title.xml"],
|
|
||||||
"maintainers": ["rvalyi"],
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/* global vis, py */
|
|
||||||
odoo.define("web_tab_title.AbstractWebClient", function (require) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var AbstractWebClient = require('web.AbstractWebClient');
|
|
||||||
|
|
||||||
var TabTitleAbstractWebClient = AbstractWebClient.include({
|
|
||||||
|
|
||||||
_title_changed: function () {
|
|
||||||
// like the original except we change the title
|
|
||||||
// only when it's different from "Odoo" to avoid
|
|
||||||
// resetting the tab title when switching tabs.
|
|
||||||
var parts = _.sortBy(_.keys(this.get("title_part")), function (x) { return x; });
|
|
||||||
var tmp = "";
|
|
||||||
_.each(parts, function (part) {
|
|
||||||
var str = this.get("title_part")[part];
|
|
||||||
if (str) {
|
|
||||||
tmp = tmp ? tmp + " - " + str : str;
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
if (tmp != "Odoo") {
|
|
||||||
document.title = tmp;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return TabTitleAbstractWebClient;
|
|
||||||
});
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/* global vis, py */
|
|
||||||
odoo.define("web_tab_title.FormController", function (require) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var FormController = require('web.FormController');
|
|
||||||
|
|
||||||
var TabTitleController = FormController.include({
|
|
||||||
|
|
||||||
on_attach_callback: function () {
|
|
||||||
this._super.apply(this, arguments);
|
|
||||||
|
|
||||||
if (document.title == "Odoo") {
|
|
||||||
var form_name_elem = $("div.oe_title>h1");
|
|
||||||
if (form_name_elem.length == 0) {
|
|
||||||
form_name_elem = $('span.o_field_char[name="name"]')
|
|
||||||
}
|
|
||||||
var title = form_name_elem.text();
|
|
||||||
if (title !== '') {
|
|
||||||
// alternatively we could access the record
|
|
||||||
// in views/basic/basic_model.js
|
|
||||||
// but we would also we miss the model name
|
|
||||||
document.title = title + " - Odoo";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return TabTitleController;
|
|
||||||
});
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<odoo>
|
|
||||||
<template
|
|
||||||
id="assets_backend"
|
|
||||||
name="web_timeline assets"
|
|
||||||
inherit_id="web.assets_backend"
|
|
||||||
>
|
|
||||||
<xpath expr="." position="inside">
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/web_tab_title/static/src/js/form_controller.js"
|
|
||||||
/>
|
|
||||||
<script
|
|
||||||
type="text/javascript"
|
|
||||||
src="/web_tab_title/static/src/js/abstract_web_client.js"
|
|
||||||
/>
|
|
||||||
</xpath>
|
|
||||||
</template>
|
|
||||||
</odoo>
|
|
||||||
Reference in New Issue
Block a user