Compare commits
1 Commits
14.0-web_t
...
14.0-add-o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bfde2e346 |
@@ -11,6 +11,8 @@ from odoo.osv import expression
|
||||
class AccountMove(models.Model):
|
||||
_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
|
||||
# which seems a bit lazy for me...
|
||||
ref = fields.Char(states={'posted': [('readonly', True)]})
|
||||
@@ -121,11 +123,7 @@ class AccountMove(models.Model):
|
||||
has_sections = False
|
||||
subtotal = 0.0
|
||||
sign = self.move_type == 'out_refund' and -1 or 1
|
||||
# Warning: the order of invoice line is forced in the view
|
||||
# <tree editable="bottom" default_order="sequence, date desc, move_name desc, id"
|
||||
# it's not the same as the _order in the class AccountMoveLine
|
||||
lines = self.env['account.move.line'].search([('exclude_from_invoice_tab', '=', False), ('move_id', '=', self.id)], order="sequence, date desc, move_name desc, id")
|
||||
for line in lines:
|
||||
for line in self.invoice_line_ids:
|
||||
if line.display_type == 'line_section':
|
||||
# insert line
|
||||
if has_sections:
|
||||
@@ -178,35 +176,6 @@ class AccountMove(models.Model):
|
||||
])
|
||||
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):
|
||||
_inherit = 'account.move.line'
|
||||
|
||||
@@ -18,20 +18,8 @@
|
||||
<field name="invoice_incoterm_id" position="attributes">
|
||||
<attribute name="widget">selection</attribute>
|
||||
</field>
|
||||
<button name="action_register_payment" position="attributes">
|
||||
<attribute name="class">btn-default</attribute>
|
||||
</button>
|
||||
<button name="action_register_payment" position="before">
|
||||
<button name="%(account.account_invoices)d" type="action" string="Print" attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
</button>
|
||||
<button name="preview_invoice" position="attributes">
|
||||
<attribute name="attrs">{'invisible': 1}</attribute>
|
||||
</button>
|
||||
<!-- move sent field and make it visible -->
|
||||
<field name="is_move_sent" position="replace"/>
|
||||
<field name="invoice_origin" position="attributes">
|
||||
<attribute name="invisible">0</attribute>
|
||||
</field>
|
||||
<field name="invoice_origin" position="after">
|
||||
<field name="is_move_sent" attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))]}"/>
|
||||
</field>
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
<field name="property_account_position_id" position="attributes">
|
||||
<attribute name="widget">selection</attribute>
|
||||
</field>
|
||||
<xpath expr="//field[@name='bank_ids']/tree/field[@name='acc_number']" position="after">
|
||||
<field name="acc_type"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from . import models
|
||||
@@ -1,62 +0,0 @@
|
||||
# Copyright 2020-2021 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Base Dynamic List',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Tools',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Dynamic lists',
|
||||
'description': """
|
||||
Base Dynamic List
|
||||
=================
|
||||
|
||||
Very often during an Odoo implementation, we need to add selection fields on a native objet, and we don't want to have a hard-coded selection list (fields.Selection), but a selection list that can be changed by users (Many2one field). For that, the developper needs to add a new object (with just a 'name' and 'sequence' field) with a form/tree view. The goal of this module is to speed-up this process by defining a dynamic list object that already has all the required views.
|
||||
|
||||
This module provides several ready-to-go objects:
|
||||
|
||||
* simple list : fields *name*, *sequence* and *active*
|
||||
* translatable list : fields *name* with translate=True, *sequence* and *active*
|
||||
* code list : fields *code* (unique), *name*, *sequence* and *active*
|
||||
* translatable code list : fields *code* (unique), *name* with translate=True, *sequence* and *active*
|
||||
|
||||
These objects are readable by the employee group. The system group has full rights on it.
|
||||
|
||||
To use it, you need to do 2 or 3 things :
|
||||
|
||||
1) Add an entry in the domain field and the object you selected:
|
||||
|
||||
domain = fields.Selection(selection_add=[('risk.type', "Risk Type")], ondelete={"risk.type": "cascade"})
|
||||
|
||||
2) Add the many2one field on your object:
|
||||
|
||||
risk_type_id = fields.Many2one(
|
||||
'dynamic.list', string="Risk Type",
|
||||
ondelete='restrict', domain=[('domain', '=', 'risk.type')])
|
||||
|
||||
|
||||
3) Optionally, you can add a dedicated action and a menu entry (otherwize, you can use the generic menu entry under *Settings > Technical > Dynamic Lists*:
|
||||
|
||||
<record id="dynamic_list_risk_type_action" model="ir.actions.act_window">
|
||||
<field name="name">Risk Type</field>
|
||||
<field name="res_model">dynamic.list</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('domain', '=', 'risk.type')]</field>
|
||||
<field name="context">{'default_domain': 'risk.type'}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="dynamic_list_risk_type_menu" action="dynamic_list_risk_type_action"
|
||||
parent="parent_menu_xmlid"/>
|
||||
|
||||
Limitation: when you want to have different access rights on these lists depending on the source object, you should prefer to use dedicated objects.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['base'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/dynamic_list.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
from . import dynamic_list
|
||||
@@ -1,115 +0,0 @@
|
||||
# Copyright 2020-2021 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class DynamicList(models.Model):
|
||||
_name = 'dynamic.list'
|
||||
_description = 'Dynamic List (non translatable)'
|
||||
_order = 'sequence, id'
|
||||
|
||||
name = fields.Char(required=True)
|
||||
sequence = fields.Integer(default=10)
|
||||
active = fields.Boolean(default=True)
|
||||
domain = fields.Selection([], string='Domain', required=True, index=True)
|
||||
|
||||
_sql_constraint = [(
|
||||
'domain_name_uniq',
|
||||
'unique(domain, name)',
|
||||
'This entry already exists!'
|
||||
)]
|
||||
|
||||
|
||||
class DynamicListTranslate(models.Model):
|
||||
_name = 'dynamic.list.translate'
|
||||
_description = 'Translatable Dynamic List'
|
||||
_order = 'sequence, id'
|
||||
|
||||
name = fields.Char(translate=True, required=True)
|
||||
sequence = fields.Integer(default=10)
|
||||
active = fields.Boolean(default=True)
|
||||
domain = fields.Selection([], string='Domain', required=True, index=True)
|
||||
|
||||
_sql_constraint = [(
|
||||
'domain_name_uniq',
|
||||
'unique(domain, name)',
|
||||
'This entry already exists!'
|
||||
)]
|
||||
|
||||
|
||||
class DynamicListCode(models.Model):
|
||||
_name = 'dynamic.list.code'
|
||||
_description = 'Dynamic list with code'
|
||||
_order = 'sequence, id'
|
||||
|
||||
code = fields.Char(required=True)
|
||||
name = fields.Char(translate=True, required=True)
|
||||
sequence = fields.Integer(default=10)
|
||||
active = fields.Boolean(default=True)
|
||||
domain = fields.Selection([], string='Domain', required=True, index=True)
|
||||
|
||||
_sql_constraint = [(
|
||||
'domain_code_uniq',
|
||||
'unique(domain, code)',
|
||||
'This code already exists!'
|
||||
)]
|
||||
|
||||
@api.depends('code', 'name')
|
||||
def name_get(self):
|
||||
res = []
|
||||
for rec in self:
|
||||
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def name_search(
|
||||
self, name='', args=None, operator='ilike', limit=80):
|
||||
if args is None:
|
||||
args = []
|
||||
if name and operator == 'ilike':
|
||||
recs = self.search(
|
||||
[('code', '=', name)] + args, limit=limit)
|
||||
if recs:
|
||||
return recs.name_get()
|
||||
return super().name_search(
|
||||
name=name, args=args, operator=operator, limit=limit)
|
||||
|
||||
|
||||
class DynamicListCodeTranslate(models.Model):
|
||||
_name = 'dynamic.list.code.translate'
|
||||
_description = 'Translatable dynamic list with code'
|
||||
_order = 'sequence, id'
|
||||
|
||||
code = fields.Char(required=True)
|
||||
name = fields.Char(translate=True, required=True)
|
||||
sequence = fields.Integer(default=10)
|
||||
active = fields.Boolean(default=True)
|
||||
domain = fields.Selection([], string='Domain', required=True, index=True)
|
||||
|
||||
_sql_constraint = [(
|
||||
'domain_code_uniq',
|
||||
'unique(domain, code)',
|
||||
'This code already exists!'
|
||||
)]
|
||||
|
||||
@api.depends('code', 'name')
|
||||
def name_get(self):
|
||||
res = []
|
||||
for rec in self:
|
||||
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def name_search(
|
||||
self, name='', args=None, operator='ilike', limit=80):
|
||||
if args is None:
|
||||
args = []
|
||||
if name and operator == 'ilike':
|
||||
recs = self.search(
|
||||
[('code', '=', name)] + args, limit=limit)
|
||||
if recs:
|
||||
return recs.name_get()
|
||||
return super().name_search(
|
||||
name=name, args=args, operator=operator, limit=limit)
|
||||
@@ -1,9 +0,0 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_dynamic_list_read,Read access on dynamic.list to employees,model_dynamic_list,base.group_user,1,0,0,0
|
||||
access_dynamic_list_full,Full access to dynamic.list to System group,model_dynamic_list,base.group_system,1,1,1,1
|
||||
access_dynamic_list_translate_read,Read access on dynamic.list.translate to employees,model_dynamic_list_translate,base.group_user,1,0,0,0
|
||||
access_dynamic_list_translate_full,Full access to dynamic.list.translate to System group,model_dynamic_list_translate,base.group_system,1,1,1,1
|
||||
access_dynamic_list_code_read,Read access on dynamic.list.code to employees,model_dynamic_list_code,base.group_user,1,0,0,0
|
||||
access_dynamic_list_code_full,Full access to dynamic.list.code to System group,model_dynamic_list_code,base.group_system,1,1,1,1
|
||||
access_dynamic_list_code_translate_read,Read access on dynamic.list.code.translate to employees,model_dynamic_list_code_translate,base.group_user,1,0,0,0
|
||||
access_dynamic_list_code_translate_full,Full access to dynamic.list.code.translate to System group,model_dynamic_list_code_translate,base.group_system,1,1,1,1
|
||||
|
@@ -1,220 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2020-2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<menuitem id="dynamic_list_root_menu" name="Dynamic Lists" parent="base.menu_custom" sequence="100"/>
|
||||
|
||||
<record id="dynamic_list_form" model="ir.ui.view">
|
||||
<field name="model">dynamic.list</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<group name="main">
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_main_view')"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_tree" model="ir.ui.view">
|
||||
<field name="model">dynamic.list</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_main_view')"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_search" model="ir.ui.view">
|
||||
<field name="model">dynamic.list</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_action" model="ir.actions.act_window">
|
||||
<field name="name">Simple List</field>
|
||||
<field name="res_model">dynamic.list</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'dynamic_list_main_view': True, 'search_default_domain_groupby': True}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="dynamic_list_menu" action="dynamic_list_action" parent="dynamic_list_root_menu" sequence="10"/>
|
||||
|
||||
<record id="dynamic_list_translate_form" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.translate</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<group name="main">
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_translate_main_view')"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_translate_tree" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.translate</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_translate_main_view')"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_translate_search" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.translate</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_translate_action" model="ir.actions.act_window">
|
||||
<field name="name">Translatable Simple List</field>
|
||||
<field name="res_model">dynamic.list.translate</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'dynamic_list_translate_main_view': True, 'search_default_domain_groupby': True}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="dynamic_list_translate_menu" action="dynamic_list_translate_action" parent="dynamic_list_root_menu" sequence="20"/>
|
||||
|
||||
<record id="dynamic_list_code_form" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.code</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<group name="main">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_code_main_view')"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_code_tree" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.code</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_code_main_view')"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_code_search" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.code</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name" string="Name or Code" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<field name="code"/>
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_code_action" model="ir.actions.act_window">
|
||||
<field name="name">Code List</field>
|
||||
<field name="res_model">dynamic.list.code</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'dynamic_list_code_main_view': True, 'search_default_domain_groupby': True}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="dynamic_list_code_menu" action="dynamic_list_code_action" parent="dynamic_list_root_menu" sequence="30"/>
|
||||
|
||||
<record id="dynamic_list_code_translate_form" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.code.translate</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<group name="main">
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_code_translate_main_view')"/>
|
||||
<field name="active" invisible="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_code_translate_tree" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.code.translate</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="code"/>
|
||||
<field name="name"/>
|
||||
<field name="domain" invisible="not context.get('dynamic_list_code_translate_main_view')"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_code_translate_search" model="ir.ui.view">
|
||||
<field name="model">dynamic.list.code.translate</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name" string="Name or Code" filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]"/>
|
||||
<field name="code"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<group string="Group By" name="groupby">
|
||||
<filter name="domain_groupby" string="Domain" context="{'group_by': 'domain'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="dynamic_list_code_translate_action" model="ir.actions.act_window">
|
||||
<field name="name">Translatable Code List</field>
|
||||
<field name="res_model">dynamic.list.code.translate</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'dynamic_list_code_translate_main_view': True, 'search_default_domain_groupby': True}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="dynamic_list_code_translate_menu" action="dynamic_list_code_translate_action" parent="dynamic_list_root_menu" sequence="40"/>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -46,7 +46,7 @@ class ResPartnerPhone(models.Model):
|
||||
@api.onchange('phone', 'partner_id')
|
||||
def _onchange_phone_validation(self):
|
||||
if self.phone:
|
||||
self.phone = self.phone_format(self.phone, country=self.partner_id.country_id)
|
||||
self.phone = self.phone_format(self.phone)
|
||||
|
||||
@api.constrains('type', 'phone', 'email')
|
||||
def _check_partner_phone(self):
|
||||
|
||||
@@ -28,7 +28,7 @@ class ResPartner(models.Model):
|
||||
|
||||
# START modif of native method
|
||||
if partner.ref:
|
||||
name = "[%s] %s" % (partner.ref, name)
|
||||
name = u"[%s] %s" % (partner.ref, name)
|
||||
# END modif of native method
|
||||
if partner.company_name or partner.parent_id:
|
||||
if not name and partner.type in ['invoice', 'delivery', 'other']:
|
||||
@@ -55,13 +55,3 @@ class ResPartner(models.Model):
|
||||
if self._context.get('show_vat') and partner.vat:
|
||||
name = "%s ‒ %s" % (name, partner.vat)
|
||||
return name
|
||||
|
||||
@api.model
|
||||
def name_search(self, name='', args=None, operator='ilike', limit=100):
|
||||
if args is None:
|
||||
args = []
|
||||
if name and operator == 'ilike':
|
||||
recs = self.search([('ref', '=', name)] + args, limit=limit)
|
||||
if recs:
|
||||
return recs.name_get()
|
||||
return super().name_search(name=name, args=args, operator=operator, limit=limit)
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
'summary': 'Better usability in base module',
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['base'],
|
||||
'depends': ['base', 'contacts'],
|
||||
'data': [
|
||||
'security/group.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
||||
@@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-07-01 10:02+0000\n"
|
||||
"PO-Revision-Date: 2021-07-01 10:02+0000\n"
|
||||
"POT-Creation-Date: 2021-02-17 16:55+0000\n"
|
||||
"PO-Revision-Date: 2021-02-17 16:55+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
|
||||
@@ -6,9 +6,9 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-07-01 10:02+0000\n"
|
||||
"PO-Revision-Date: 2021-07-01 12:15+0200\n"
|
||||
"Last-Translator: Alexis de Lattre <alexis@via.ecp.fr>\n"
|
||||
"POT-Creation-Date: 2021-02-17 16:55+0000\n"
|
||||
"PO-Revision-Date: 2021-02-17 16:55+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -33,15 +33,16 @@ msgstr "Sociétés"
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr "Contact"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Currency"
|
||||
msgstr "Devise"
|
||||
msgstr "Monnaie"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Customer Number:"
|
||||
msgstr "N° client :"
|
||||
@@ -67,7 +68,7 @@ msgstr "E-mail :"
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Group By"
|
||||
msgstr "Grouper par"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server__id
|
||||
@@ -78,12 +79,12 @@ msgstr "Grouper par"
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_category__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users__id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.view_module_filter
|
||||
msgid "Installable"
|
||||
msgstr "Installable"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server____last_update
|
||||
@@ -99,7 +100,7 @@ msgstr "Dernière modification le"
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_ir_mail_server
|
||||
msgid "Mail Server"
|
||||
msgstr "Serveur mail"
|
||||
msgstr "Serveur d'email"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
@@ -131,7 +132,7 @@ msgstr "Nom avec titre"
|
||||
#. module: base_usability
|
||||
#: model:res.groups,name:base_usability.group_nobody
|
||||
msgid "Nobody (used to hide native menus)"
|
||||
msgstr "Personne (utilisé pour cacher des entrées de menu natifs)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner_category
|
||||
@@ -151,6 +152,7 @@ msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Supplier Number:"
|
||||
msgstr "N° fournisseur :"
|
||||
|
||||
@@ -4,5 +4,4 @@ from . import res_partner_bank
|
||||
from . import res_partner_category
|
||||
from . import res_company
|
||||
from . import ir_mail_server
|
||||
from . import ir_actions_report
|
||||
from . import ir_model
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
# Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class IrActionsReport(models.Model):
|
||||
_inherit = "ir.actions.report"
|
||||
|
||||
# since v13, print_report_name is a translatable field
|
||||
# It means that you can't set the value via an inherit of
|
||||
# ir.actions.report as XML
|
||||
# I think it was easier when this field was not translatable
|
||||
print_report_name = fields.Char(translate=False)
|
||||
@@ -8,9 +8,25 @@ from odoo import models, fields, api, _
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
# tracking=True is handled in the 'mail' module, and base_usability
|
||||
# doesn't depend on 'mail', so adding tracking on res.partner fields
|
||||
# has been moved to mail_usability
|
||||
# track_visibility is handled in the 'mail' module, and base_usability
|
||||
# doesn't depend on 'mail', but that doesn't hurt, it will just be
|
||||
# ignored if mail is not installed
|
||||
# TODO move to mail module
|
||||
# name = fields.Char(tracking=True)
|
||||
# parent_id = fields.Many2one(tracking=True)
|
||||
# ref = fields.Char(tracking=True)
|
||||
# lang = fields.Selection(tracking=True)
|
||||
# user_id = fields.Many2one(tracking=True)
|
||||
# vat = fields.Char(tracking=True)
|
||||
# street = fields.Char(tracking=True)
|
||||
# street2 = fields.Char(tracking=True)
|
||||
# zip = fields.Char(tracking=True)
|
||||
# city = fields.Char(tracking=True)
|
||||
# state_id = fields.Many2one(tracking=True)
|
||||
# country_id = fields.Many2one(tracking=True)
|
||||
# is_company = fields.Boolean(tracking=True)
|
||||
# active = fields.Boolean(tracking=True)
|
||||
# company_id = fields.Many2one(tracking=True)
|
||||
ref = fields.Char(copy=False)
|
||||
# For reports
|
||||
name_title = fields.Char(
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<field name="name">base_usability.res.country.search</field>
|
||||
<field name="model">res.country</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<search string="Search Countries">
|
||||
<field name="name" filter_domain="['|', ('name', 'ilike', self), ('code', '=', self)]" string="Name or Code"/>
|
||||
<field name="code"/>
|
||||
<field name="currency_id"/>
|
||||
|
||||
@@ -20,6 +20,15 @@
|
||||
<div attrs="{'invisible': [('same_vat_partner_id', '=', False)]}" position="attributes">
|
||||
<attribute name="class">alert alert-warning</attribute>
|
||||
</div>
|
||||
<!-- Add a kanban button to open child partner -->
|
||||
<xpath expr="//field[@name='child_ids']//kanban/templates/t/div" position="inside">
|
||||
<div class="o_dropdown_kanban">
|
||||
<a class="btn" role="button" title="Open"
|
||||
t-att-href="'/web#id=' + record.id.raw_value + '&action=%(contacts.action_contacts)d' + '&menu_id=%(contacts.menu_contacts)d' + '&view_type=form&cids=1&model=res.partner'">
|
||||
<span class="fa fa-external-link" />
|
||||
</a>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
from . import models
|
||||
from . import stock
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Copyright 2018-2021 Akretion (http://www.akretion.com)
|
||||
# Copyright 2018-2019 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Delivery Usability',
|
||||
'version': '14.0.1.0.0',
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'Stock',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Several usability enhancements in Delivery',
|
||||
@@ -14,6 +14,7 @@ Delivery Usability
|
||||
|
||||
The usability enhancements include:
|
||||
* allow modification of carrier and it's tracking ref. on a done picking
|
||||
* display field 'invoice_shipping_on_delivery' on sale.order form view
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
@@ -21,7 +22,8 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['delivery'],
|
||||
'data': [
|
||||
'views/stock_picking.xml',
|
||||
'sale_view.xml',
|
||||
'stock_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'installable': False,
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from . import stock_picking
|
||||
23
delivery_usability/sale_view.xml
Normal file
23
delivery_usability/sale_view.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018-2019 Akretion
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_order_form_with_carrier" model="ir.ui.view">
|
||||
<field name="name">delivery_usability.sale.order.form</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="delivery.view_order_form_with_carrier"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="sale_pay" position="inside">
|
||||
<field name="invoice_shipping_on_delivery"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2018-2021 Akretion (http://www.akretion.com)
|
||||
# Copyright 2018-2019 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
@@ -8,5 +8,5 @@ from odoo import fields, models
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
carrier_id = fields.Many2one(tracking=True)
|
||||
carrier_tracking_ref = fields.Char(tracking=True)
|
||||
carrier_id = fields.Many2one(track_visibility='onchange')
|
||||
carrier_tracking_ref = fields.Char(track_visibility='onchange')
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018-2021 Akretion France
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
Copyright 2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Copyright 2014-2021 Akretion France (http://www.akretion.com)
|
||||
# Copyright 2014-2019 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
|
||||
{
|
||||
'name': 'Eradicate Quick Create',
|
||||
'version': '14.0.1.0.0',
|
||||
'version': '12.0.2.0.0',
|
||||
'category': 'Tools',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Disable quick create on all objects',
|
||||
@@ -13,7 +13,7 @@ Eradicate Quick Create
|
||||
|
||||
Disable quick create on all objects of Odoo.
|
||||
|
||||
This module uses the module *web_m2x_options* from the OCA *web* project (in v10 and lower, it was using the module *base_optional_quick_create* from the OCA project *server-ux*).
|
||||
This new version of the module uses the module *web_m2x_options* from the OCA *web* project instead of the module *base_optional_quick_create* from the OCA project *server-ux*.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
@@ -21,5 +21,5 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['web_m2x_options'],
|
||||
'post_init_hook': 'web_m2x_options_create',
|
||||
'installable': True,
|
||||
'installable': False,
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2019-2021 Akretion France
|
||||
# Copyright 2019 Akretion France
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
@@ -11,7 +11,7 @@ def web_m2x_options_create(cr, registry):
|
||||
config_parameter = env['ir.config_parameter'].search(
|
||||
[('key', '=', 'web_m2x_options.create')])
|
||||
if config_parameter and config_parameter.value != 'False':
|
||||
config_parameter.write({'value': 'False'})
|
||||
config_parameter.value = 'False'
|
||||
else:
|
||||
env['ir.config_parameter'].create({
|
||||
'key': 'web_m2x_options.create',
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from . import models
|
||||
@@ -1,20 +0,0 @@
|
||||
# Copyright 2021 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'HR Contract Usability',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Human Resources/Contracts',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Usability improvements on HR Contract module',
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': [
|
||||
'hr_contract',
|
||||
],
|
||||
'data': [
|
||||
'views/hr_payroll_structure_type.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
from . import hr_payroll_structure_type
|
||||
@@ -1,10 +0,0 @@
|
||||
# Copyright 2021 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
class HrPayrollStructureType(models.Model):
|
||||
_inherit = 'hr.payroll.structure.type'
|
||||
|
||||
active = fields.Boolean(default=True)
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="hr_payroll_structure_type_form" model="ir.ui.view">
|
||||
<field name="model">hr.payroll.structure.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<group name="main">
|
||||
<field name="name"/>
|
||||
<field name="default_resource_calendar_id"/>
|
||||
<field name="active" invisible="1"/>
|
||||
<field name="country_id"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_structure_type_tree" model="ir.ui.view">
|
||||
<field name="model">hr.payroll.structure.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="default_resource_calendar_id" optional="show"/>
|
||||
<field name="country_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_structure_type_search" model="ir.ui.view">
|
||||
<field name="model">hr.payroll.structure.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="name"/>
|
||||
<separator/>
|
||||
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
|
||||
<group name="groupby">
|
||||
<filter name="country_groupby" string="Country" context="{'group_by': 'country_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_structure_type_action" model="ir.actions.act_window">
|
||||
<field name="name">Salary Structure Types</field>
|
||||
<field name="res_model">hr.payroll.structure.type</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="hr_payroll_structure_type_menu"
|
||||
action="hr_payroll_structure_type_action"
|
||||
parent="hr_contract.menu_human_resources_configuration_contract"
|
||||
sequence="10"/>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -1 +0,0 @@
|
||||
from . import models
|
||||
@@ -1,32 +0,0 @@
|
||||
# Copyright 2016-2021 Akretion France (http://www.akretion.com)
|
||||
# @author Benoît Guillot <benoit.guillot@akretion.com>
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Mail Usability',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Productivity/Discuss',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Usability improvements on mails',
|
||||
'description': """
|
||||
Mail Usability
|
||||
==============
|
||||
|
||||
Small usability improvements on mails:
|
||||
|
||||
* remove link in mail footer (TODO mig v14)
|
||||
|
||||
* remove 'sent by' in notification footer (TODO mig v14)
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['mail'],
|
||||
'data': [
|
||||
#'views/mail_view.xml',
|
||||
#'data/mail_data.xml',
|
||||
#'wizard/email_template_preview_view.xml',
|
||||
#'wizard/mail_compose_message_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
from . import res_partner
|
||||
from . import mail_template
|
||||
@@ -1,11 +0,0 @@
|
||||
# Copyright 2018-2021 Akretion France (http://www.akretion.com).
|
||||
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class MailTemplate(models.Model):
|
||||
_inherit = 'mail.template'
|
||||
|
||||
auto_delete = fields.Boolean(default=False)
|
||||
@@ -1,26 +0,0 @@
|
||||
# Copyright 2015-2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
# tracking=True is handled in the 'mail' module, so it's better
|
||||
# to have this in mail_usability than in base_usability
|
||||
name = fields.Char(tracking=True)
|
||||
parent_id = fields.Many2one(tracking=True)
|
||||
ref = fields.Char(tracking=True)
|
||||
lang = fields.Selection(tracking=True)
|
||||
vat = fields.Char(tracking=True)
|
||||
street = fields.Char(tracking=True)
|
||||
street2 = fields.Char(tracking=True)
|
||||
zip = fields.Char(tracking=True)
|
||||
city = fields.Char(tracking=True)
|
||||
state_id = fields.Many2one(tracking=True)
|
||||
country_id = fields.Many2one(tracking=True)
|
||||
is_company = fields.Boolean(tracking=True)
|
||||
active = fields.Boolean(tracking=True)
|
||||
company_id = fields.Many2one(tracking=True)
|
||||
@@ -12,20 +12,16 @@ class ProductTemplate(models.Model):
|
||||
only one BoM form or a list of BoMs."""
|
||||
self.ensure_one()
|
||||
if self.bom_count == 1:
|
||||
action_xml_id = "mrp.mrp_bom_form_action"
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(action_xml_id)
|
||||
action = self.env.ref("mrp.mrp_bom_form_action").read()[0]
|
||||
bom = self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)])
|
||||
action.update(
|
||||
{
|
||||
"context": {"default_product_tmpl_id": self.id},
|
||||
"views": False,
|
||||
"view_mode": "form,tree",
|
||||
"res_id": bom.id,
|
||||
}
|
||||
)
|
||||
action.update({
|
||||
"context": {"default_product_tmpl_id": self.id},
|
||||
"views": False,
|
||||
"view_mode": "form,tree",
|
||||
"res_id": bom.id,
|
||||
})
|
||||
else:
|
||||
action_xml_id = "mrp.template_open_bom"
|
||||
action = self.env["ir.actions.actions"]._for_xml_id(action_xml_id)
|
||||
action = self.env.ref("mrp.template_open_bom").read()[0]
|
||||
return action
|
||||
|
||||
|
||||
@@ -36,11 +32,9 @@ class ProductProduct(models.Model):
|
||||
action = super().action_view_bom()
|
||||
bom_target_ids = self.env["mrp.bom"].search(action["domain"])
|
||||
if len(bom_target_ids) == 1:
|
||||
action.update(
|
||||
{
|
||||
"views": False,
|
||||
"view_mode": "form,tree",
|
||||
"res_id": bom_target_ids[0].id,
|
||||
}
|
||||
)
|
||||
action.update({
|
||||
"views": False,
|
||||
"view_mode": "form,tree",
|
||||
"res_id": bom_target_ids[0].id,
|
||||
})
|
||||
return action
|
||||
|
||||
@@ -24,6 +24,11 @@ class PurchaseOrder(models.Model):
|
||||
for order in self:
|
||||
order.delivery_partner_id = order.dest_address_id
|
||||
|
||||
def print_order(self):
|
||||
report = self.env.ref('purchase.action_report_purchase_order')
|
||||
action = report.report_action(self)
|
||||
return action
|
||||
|
||||
# Re-write native name_get() to use amount_untaxed instead of amount_total
|
||||
@api.depends('name', 'partner_ref')
|
||||
def name_get(self):
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_rfq_send" states="purchase" position="after">
|
||||
<button name="%(purchase.action_report_purchase_order)d" states="purchase,done" string="Print" type="action"/>
|
||||
<button name="print_order" states="purchase" string="Print Order" type="object"/>
|
||||
</button>
|
||||
<field name="fiscal_position_id" position="attributes">
|
||||
<attribute name="widget">selection</attribute>
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
from . import models
|
||||
from . import wizard
|
||||
@@ -1,38 +0,0 @@
|
||||
# Copyright 2017-2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Sale Confirm Wizard',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Sales',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Open a wizard when you confirm a sale order to update important info',
|
||||
'description': """
|
||||
Sale Confirm Wizard
|
||||
===================
|
||||
|
||||
When you confirm a quotation, Odoo will open a small wizard where you will be able to check and update important information:
|
||||
|
||||
* customer PO number,
|
||||
* delivery address,
|
||||
* invoicing address,
|
||||
* payment terms.
|
||||
|
||||
It will also display the sale warning if the customer's company has one. And it is a blocker warning, the user won't be able to confirm the quotation.
|
||||
|
||||
This module has been developped because the experience has shown, when a sales assistant confirms a quotation in Odoo, it overlooks the important information written in the customer PO that may be different from the information of the quotation in Odoo, which causes many errors in delivery and invoicing.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion
|
||||
<alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['sale'],
|
||||
'data': [
|
||||
'wizard/sale_confirm_view.xml',
|
||||
'views/sale_order.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
from . import sale_order
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright 2020-2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
def sale_confirm_wizard_button(self):
|
||||
"""This method is designed to be inherited.
|
||||
For example, inherit it if you don't want to start the wizard in
|
||||
some scenarios"""
|
||||
action = self.sudo().env.ref(
|
||||
'sale_confirm_wizard.sale_confirm_action').read()[0]
|
||||
return action
|
||||
@@ -1,2 +0,0 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_sale_confirm_wizard,Full access on sale.confirm wizard,model_sale_confirm,sales_team.group_sale_salesman,1,1,1,1
|
||||
|
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017-2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_order_form" model="ir.ui.view">
|
||||
<field name="name">sale.confirm.wizard.sale_order_form</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button id="action_confirm" position="attributes">
|
||||
<attribute name="name">sale_confirm_wizard_button</attribute>
|
||||
</button>
|
||||
<button name="action_confirm" attrs="{'invisible': [('state', 'not in', ['draft'])]}" position="attributes">
|
||||
<attribute name="name">sale_confirm_wizard_button</attribute>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -1 +0,0 @@
|
||||
from . import sale_confirm
|
||||
@@ -1,78 +0,0 @@
|
||||
# Copyright 2017-2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.addons.base.models.res_partner import WARNING_MESSAGE
|
||||
|
||||
|
||||
class SaleConfirm(models.TransientModel):
|
||||
_name = 'sale.confirm'
|
||||
_description = 'Wizard to confirm a sale order'
|
||||
|
||||
sale_id = fields.Many2one(
|
||||
'sale.order', string='Sale Order', readonly=True)
|
||||
client_order_ref = fields.Char(string='Customer PO Number')
|
||||
payment_term_id = fields.Many2one(
|
||||
'account.payment.term', string='Payment Terms')
|
||||
partner_invoice_id = fields.Many2one(
|
||||
'res.partner', 'Invoice Address', required=True)
|
||||
show_partner_invoice_id = fields.Many2one(
|
||||
related='partner_invoice_id',
|
||||
string='Detailed Invoice Address')
|
||||
partner_shipping_id = fields.Many2one(
|
||||
'res.partner', 'Delivery Address', required=True)
|
||||
show_partner_shipping_id = fields.Many2one(
|
||||
related='partner_shipping_id',
|
||||
string='Detailed Delivery Address')
|
||||
sale_warn = fields.Selection(
|
||||
WARNING_MESSAGE, 'Sale Warning Type', readonly=True)
|
||||
sale_warn_msg = fields.Text(string='Sale Warning Message', readonly=True)
|
||||
|
||||
@api.model
|
||||
def _prepare_default_get(self, order):
|
||||
partner = order.partner_id.commercial_partner_id
|
||||
default = {
|
||||
'sale_id': order.id,
|
||||
'client_order_ref': order.client_order_ref,
|
||||
'payment_term_id': order.payment_term_id.id or False,
|
||||
'partner_invoice_id': order.partner_invoice_id.id,
|
||||
'partner_shipping_id': order.partner_shipping_id.id,
|
||||
'sale_warn_msg': partner.sale_warn_msg,
|
||||
'sale_warn': partner.sale_warn,
|
||||
}
|
||||
return default
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
res = super().default_get(fields)
|
||||
assert self._context.get('active_model') == 'sale.order',\
|
||||
'active_model should be sale.order'
|
||||
order = self.env['sale.order'].browse(self._context.get('active_id'))
|
||||
default = self._prepare_default_get(order)
|
||||
res.update(default)
|
||||
return res
|
||||
|
||||
def _prepare_update_so(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'client_order_ref': self.client_order_ref,
|
||||
'payment_term_id': self.payment_term_id.id or False,
|
||||
'partner_invoice_id': self.partner_invoice_id.id,
|
||||
'partner_shipping_id': self.partner_shipping_id.id,
|
||||
}
|
||||
|
||||
def confirm(self):
|
||||
self.ensure_one()
|
||||
partner = self.sale_id.partner_id.commercial_partner_id
|
||||
if partner.sale_warn == 'block':
|
||||
raise UserError(_(
|
||||
"You cannot confirm this quotation because "
|
||||
"customer '%s' has a blocker sale warning:\n\n%s")
|
||||
% (partner.display_name, partner.sale_warn_msg))
|
||||
vals = self._prepare_update_so()
|
||||
self.sale_id.write(vals)
|
||||
# confirm sale order
|
||||
self.sale_id.action_confirm()
|
||||
return True
|
||||
@@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017-2021 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="sale_confirm_form" model="ir.ui.view">
|
||||
<field name="name">sale.confirm.form</field>
|
||||
<field name="model">sale.confirm</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Confirm Order">
|
||||
<div><p>At this stage, you have received the Purchase Order from the customer and you are about to convert the related quotation to an order.</p></div>
|
||||
<group name="warn" groups="sale.group_warning_sale" attrs="{'invisible': ['|', ('sale_warn', '=', False), ('sale_warn', '=', 'no-message')]}" string="Warning" col="4">
|
||||
<field name="sale_warn" nolabel="1"/>
|
||||
<field name="sale_warn_msg" nolabel="1" colspan="3"/>
|
||||
</group>
|
||||
<group name="main" attrs="{'invisible': [('sale_warn', '=', 'block')]}">
|
||||
<field name="sale_id" invisible="1"/>
|
||||
<field name="client_order_ref"/>
|
||||
<field name="partner_invoice_id" context="{'default_type': 'invoice'}"
|
||||
groups="sale.group_delivery_invoice_address"/>
|
||||
<!-- partner_invoice_id can't show the full address because
|
||||
we are in edit mode -->
|
||||
<field name="show_partner_invoice_id" options="{'always_reload': True}"
|
||||
context="{'show_address': 1}"
|
||||
groups="sale.group_delivery_invoice_address"/>
|
||||
<field name="partner_shipping_id"
|
||||
context="{'default_type': 'delivery'}"
|
||||
groups="sale.group_delivery_invoice_address"/>
|
||||
<field name="show_partner_shipping_id" options="{'always_reload': True}"
|
||||
context="{'show_address': 1}"
|
||||
groups="sale.group_delivery_invoice_address"/>
|
||||
<field name="payment_term_id"/>
|
||||
</group>
|
||||
<footer>
|
||||
<button type="object" name="confirm"
|
||||
string="Confirm Sale" class="btn-primary" attrs="{'invisible': [('sale_warn', '=', 'block')]}"/>
|
||||
<button special="cancel" string="Annuler" class="btn-default"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="sale_confirm_action" model="ir.actions.act_window">
|
||||
<field name="name">Confirm Order</field>
|
||||
<field name="res_model">sale.confirm</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -1 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Copyright 2019-2021 Akretion France (http://www.akretion.com/)
|
||||
# Copyright 2019 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Sale Order Route',
|
||||
'version': '14.0.1.0.0',
|
||||
'version': '12.0.1.0.0',
|
||||
'category': 'Sales',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Set route on sale order',
|
||||
@@ -18,5 +18,5 @@ This module has been written by Alexis de Lattre from Akretion
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['sale_stock'],
|
||||
'data': ['views/sale_order.xml'],
|
||||
'installable': True,
|
||||
'installable': False,
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import sale_order
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2019-2021 Akretion France (http://www.akretion.com/)
|
||||
# Copyright 2019 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
@@ -10,17 +10,17 @@ class SaleOrder(models.Model):
|
||||
|
||||
route_id = fields.Many2one(
|
||||
'stock.location.route', string='Route',
|
||||
ondelete='restrict', readonly=True, tracking=True,
|
||||
ondelete='restrict', readonly=True, track_visibility='onchange',
|
||||
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
|
||||
check_company=True,
|
||||
domain="['|', ('company_id', '=', company_id), ('company_id', '=', False), ('sale_selectable', '=', True)]")
|
||||
domain=[('sale_selectable', '=', True)])
|
||||
|
||||
def _action_confirm(self):
|
||||
# Takes into account the scenario where route_id has a value, then SO is
|
||||
# cancelled+back to draft, then route_id = False and SO is confirmed again
|
||||
# Caution: take into account the scenario where
|
||||
# route_id has a value, then SO is cancelled+back to draft,
|
||||
# then route_id = False and SO is confirmed again
|
||||
for order in self:
|
||||
vals = {'route_id': order.route_id.id or False}
|
||||
order.order_line.filtered(
|
||||
lambda l:
|
||||
l.product_id and l.product_id.type in ('product', 'consu')).write(vals)
|
||||
return super()._action_confirm()
|
||||
l.product_id.type in ('product', 'consu')).write(vals)
|
||||
super(SaleOrder, self)._action_confirm()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2019-2021 Akretion France (http://www.akretion.com/)
|
||||
Copyright 2019 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
@@ -7,24 +7,24 @@
|
||||
|
||||
<odoo>
|
||||
|
||||
<!--
|
||||
<record id="account_invoice_form" model="ir.ui.view">
|
||||
<field name="name">sale_usability.customer.invoice.form</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="sale.account_invoice_form" />
|
||||
<field name="groups_id" eval="[(4, ref('sales_team.group_sale_manager'))]" />
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="sale.account_invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button
|
||||
name="show_sale_orders"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-pencil-square-o"
|
||||
attrs="{'invisible': [('sale_count', '=', 0)]}">
|
||||
<field name="sale_count" widget="statinfo" string="Sale Orders" />
|
||||
<button name="show_sale_orders"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-pencil-square-o"
|
||||
attrs="{'invisible': [('sale_count', '=', 0)]}">
|
||||
<field name="sale_count" widget="statinfo" string="Sale Orders"/>
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
-->
|
||||
|
||||
<record id="view_move_form" model="ir.ui.view">
|
||||
<field name="name">sale_usability.account.move.form</field>
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
<field name="date_order" position="after">
|
||||
<field name="client_order_ref"/>
|
||||
</field>
|
||||
<button name="action_quotation_send" states="sent,sale" position="after">
|
||||
<button name="%(sale.action_report_saleorder)d" type="action" string="Print" states="draft,sent,sale,done"/>
|
||||
</button>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</xpath>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
from . import models
|
||||
@@ -1,25 +0,0 @@
|
||||
# Copyright 2014-2021 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
{
|
||||
'name': 'Stock Picking Type Default Partner',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Inventory, Logistics, Warehousing',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Adds a default partner on types of operation',
|
||||
'description': """
|
||||
Stock Picking Type Default Partner
|
||||
==================================
|
||||
|
||||
This module adds a new field on the Types of Operation (stock.picking.type) : *Default Partner*. This is useful for multi-site companies that create inter-site Type of Operations: all the operations that use this Type of Operation should have the same destination partner.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['stock'],
|
||||
'data': ['views/stock_picking_type.xml'],
|
||||
'installable': True,
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
from . import stock_picking
|
||||
@@ -1,31 +0,0 @@
|
||||
# Copyright 2014-2021 Akretion France (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class StockPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
default_partner_id = fields.Many2one(
|
||||
'res.partner', string='Default Partner', ondelete='restrict',
|
||||
help="If set, it will be the default partner on this type of "
|
||||
"pickings.")
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
@api.model
|
||||
def _default_partner_id(self):
|
||||
if self._context.get('default_picking_type_id'):
|
||||
picktype = self.env['stock.picking.type'].browse(
|
||||
self._context.get('default_picking_type_id'))
|
||||
if picktype.default_partner_id:
|
||||
return picktype.default_partner_id
|
||||
return False
|
||||
|
||||
partner_id = fields.Many2one(
|
||||
default=lambda self: self._default_partner_id())
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2015-2021 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_picking_type_form" model="ir.ui.view">
|
||||
<field name="name">default.partner.stock.picking.type.form</field>
|
||||
<field name="model">stock.picking.type</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_type_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="default_location_dest_id" position="after">
|
||||
<field name="default_partner_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -3,7 +3,6 @@ from . import stock_picking
|
||||
from . import stock_location_route
|
||||
from . import stock_warehouse_orderpoint
|
||||
from . import stock_quant
|
||||
from . import stock_inventory
|
||||
from . import procurement_group
|
||||
from . import procurement_scheduler_log
|
||||
from . import product
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
# Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.tools import float_compare, float_is_zero
|
||||
|
||||
|
||||
class StockInventory(models.Model):
|
||||
_inherit = 'stock.inventory'
|
||||
|
||||
prefill_counted_quantity = fields.Selection(
|
||||
readonly=True, states={'draft': [('readonly', False)]})
|
||||
|
||||
|
||||
class StockInventoryLine(models.Model):
|
||||
_inherit = 'stock.inventory.line'
|
||||
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
difference_qty = fields.Float(search="_search_difference_qty_usability")
|
||||
|
||||
def _search_difference_qty_usability(self, operator, value):
|
||||
# Inspired by the method _search_difference_qty() from the
|
||||
# official stock module
|
||||
# So a part of this code is copyright Odoo SA under LGPL licence
|
||||
if not self.env.context.get('default_inventory_id'):
|
||||
raise NotImplementedError(_('Unsupported search on %s outside of an Inventory Adjustment', 'difference_qty'))
|
||||
lines = self.search([('inventory_id', '=', self.env.context.get('default_inventory_id'))])
|
||||
line_ids = []
|
||||
for line in lines:
|
||||
if operator == '=':
|
||||
if float_is_zero(line.difference_qty, line.product_id.uom_id.rounding):
|
||||
line_ids.append(line.id)
|
||||
elif operator == '!=':
|
||||
if not float_is_zero(line.difference_qty, line.product_id.uom_id.rounding):
|
||||
line_ids.append(line.id)
|
||||
elif operator == '>':
|
||||
if float_compare(line.difference_qty, 0, line.product_id.uom_id.rounding) > 0:
|
||||
line_ids.append(line.id)
|
||||
elif operator == '<':
|
||||
if float_compare(line.difference_qty, 0, line.product_id.uom_id.rounding) < 0:
|
||||
line_ids.append(line.id)
|
||||
else:
|
||||
raise NotImplementedError()
|
||||
return [('id', 'in', line_ids)]
|
||||
@@ -2,14 +2,12 @@
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockQuant(models.Model):
|
||||
_inherit = 'stock.quant'
|
||||
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
|
||||
def action_stock_move_lines_reserved(self):
|
||||
self.ensure_one()
|
||||
action = self.action_view_stock_moves()
|
||||
|
||||
@@ -7,28 +7,11 @@
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_inventory_form" model="ir.ui.view">
|
||||
<field name="name">usability.stock.inventory.form</field>
|
||||
<field name="model">stock.inventory</field>
|
||||
<field name="inherit_id" ref="stock.view_inventory_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_open_inventory_lines" states="confirm" position="after">
|
||||
<button name="action_open_inventory_lines" states="done" string="Show Inventory Lines" type="object"/>
|
||||
</button>
|
||||
<field name="prefill_counted_quantity" position="attributes">
|
||||
<attribute name="attrs">{}</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_inventory_line_tree" model="ir.ui.view">
|
||||
<field name="name">usability.stock.inventory.line.tree</field>
|
||||
<field name="model">stock.inventory.line</field>
|
||||
<field name="inherit_id" ref="stock.stock_inventory_line_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</field>
|
||||
<tree position="attributes">
|
||||
<!-- native :
|
||||
decoration-danger="product_qty != theoretical_qty"
|
||||
@@ -44,25 +27,16 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="stock_inventory_line_search" model="ir.ui.view">
|
||||
<field name="name">usability.stock.inventory.line.search</field>
|
||||
<field name="model">stock.inventory.line</field>
|
||||
<field name="inherit_id" ref="stock.stock_inventory_line_search"/>
|
||||
<record id="view_inventory_tree" model="ir.ui.view">
|
||||
<field name="name">usability.stock.inventory.tree</field>
|
||||
<field name="model">stock.inventory</field>
|
||||
<field name="inherit_id" ref="stock.view_inventory_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="categ_id"/>
|
||||
</field>
|
||||
<filter name="difference" position="after">
|
||||
<filter string="Difference = 0"
|
||||
name="counted_equal" domain="[('difference_qty', '=', 0)]"/>
|
||||
<filter string="Counted lower than Theoretical"
|
||||
name="counted_lower" domain="[('difference_qty', '<', 0)]"/>
|
||||
<filter string="Counted higher than Theoretical"
|
||||
name="counted_higher" domain="[('difference_qty', '>', 0)]"/>
|
||||
<separator/>
|
||||
<filter string="Counted" name="counted" domain="[('product_qty', '>', 0)]"/>
|
||||
</filter>
|
||||
<tree position="attributes">
|
||||
<attribute name="decoration-info">state == 'draft'</attribute>
|
||||
<attribute name="decoration-warning">state == 'confirm'</attribute>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -13,9 +13,6 @@
|
||||
<field name="model">stock.quant</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_quant_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</field>
|
||||
<field name="quantity" position="attributes">
|
||||
<attribute name="sum">1</attribute>
|
||||
</field>
|
||||
|
||||
@@ -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