Compare commits
40 Commits
14.0-mig-s
...
14.0-add-o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bfde2e346 | ||
|
|
de2e5f2121 | ||
|
|
42e014bcb1 | ||
|
|
e70e3b23cf | ||
|
|
50b4944c8b | ||
|
|
96bfda6e1b | ||
|
|
cfb58ed80f | ||
|
|
91e9c1fe33 | ||
|
|
dff4e47cf5 | ||
|
|
452cc399c5 | ||
|
|
f4c22501a7 | ||
|
|
9e8874eb4b | ||
|
|
fc6c0384ed | ||
|
|
96bd915c4f | ||
|
|
f61296cafc | ||
|
|
b585d06489 | ||
|
|
cef81ad749 | ||
|
|
7c1a2fabd3 | ||
|
|
c3f72a9b68 | ||
|
|
a0d73834ad | ||
|
|
66ebc5c6ad | ||
|
|
5c06d79b69 | ||
|
|
034c89b399 | ||
|
|
6356171619 | ||
|
|
771001ca2e | ||
|
|
45d734badf | ||
|
|
0d4ff37786 | ||
|
|
9c30d4ef53 | ||
|
|
b2ce8f0aca | ||
|
|
183bba3752 | ||
|
|
92742dfc9d | ||
|
|
f30bf4791a | ||
|
|
ca6de3adf6 | ||
|
|
5e2d25f7c4 | ||
|
|
d64262099b | ||
|
|
6ad589d4bd | ||
|
|
5496aa38f8 | ||
|
|
b7c0b4720c | ||
|
|
bd25fe4866 | ||
|
|
c3da933e62 |
@@ -25,6 +25,7 @@
|
||||
'views/account_move.xml',
|
||||
'views/account_menu.xml',
|
||||
'views/account_tax.xml',
|
||||
'views/product.xml',
|
||||
'views/res_config_settings.xml',
|
||||
'views/res_partner.xml',
|
||||
'views/account_report.xml',
|
||||
|
||||
@@ -6,3 +6,4 @@ from . import account_journal
|
||||
from . import account_move
|
||||
from . import account_partial_reconcile
|
||||
from . import res_partner
|
||||
from . import product
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import float_is_zero
|
||||
from odoo.tools.misc import format_date
|
||||
from odoo.osv import expression
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
@@ -49,11 +50,11 @@ class AccountMove(models.Model):
|
||||
def _compute_has_attachment(self):
|
||||
iao = self.env['ir.attachment']
|
||||
for move in self:
|
||||
if iao.search([
|
||||
if iao.search_count([
|
||||
('res_model', '=', 'account.move'),
|
||||
('res_id', '=', move.id),
|
||||
('type', '=', 'binary'),
|
||||
('company_id', '=', move.company_id.id)], limit=1):
|
||||
('company_id', '=', move.company_id.id)]):
|
||||
move.has_attachment = True
|
||||
else:
|
||||
move.has_attachment = False
|
||||
@@ -121,7 +122,7 @@ class AccountMove(models.Model):
|
||||
res = []
|
||||
has_sections = False
|
||||
subtotal = 0.0
|
||||
sign = self.type == 'out_refund' and -1 or 1
|
||||
sign = self.move_type == 'out_refund' and -1 or 1
|
||||
for line in self.invoice_line_ids:
|
||||
if line.display_type == 'line_section':
|
||||
# insert line
|
||||
@@ -157,6 +158,24 @@ class AccountMove(models.Model):
|
||||
for x in sales]
|
||||
inv.sale_dates = ", ".join(dates)
|
||||
|
||||
# allow to manually create moves not only in general journals,
|
||||
# but also in cash journal and check journals (= bank journals not linked to a bank account)
|
||||
@api.depends('company_id', 'invoice_filter_type_domain')
|
||||
def _compute_suitable_journal_ids(self):
|
||||
for move in self:
|
||||
if move.invoice_filter_type_domain:
|
||||
super(AccountMove, move)._compute_suitable_journal_ids()
|
||||
else:
|
||||
company_id = move.company_id.id or self.env.company.id
|
||||
domain = expression.AND([
|
||||
[('company_id', '=', company_id)],
|
||||
expression.OR([
|
||||
[('type', 'in', ('general', 'cash'))],
|
||||
[('type', '=', 'bank'), ('bank_account_id', '=', False)]
|
||||
])
|
||||
])
|
||||
move.suitable_journal_ids = self.env['account.journal'].search(domain)
|
||||
|
||||
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = 'account.move.line'
|
||||
@@ -176,6 +195,8 @@ class AccountMoveLine(models.Model):
|
||||
matched_credit_ids = fields.One2many(string='Partial Reconcile Credit')
|
||||
reconcile_string = fields.Char(
|
||||
compute='_compute_reconcile_string', string='Reconcile', store=True)
|
||||
# for optional display in tree view
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
|
||||
def show_account_move_form(self):
|
||||
self.ensure_one()
|
||||
|
||||
45
account_usability/models/product.py
Normal file
45
account_usability/models/product.py
Normal file
@@ -0,0 +1,45 @@
|
||||
# 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).
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
# DON'T put store=True on those fields, because they are company dependent
|
||||
sale_price_type = fields.Selection(
|
||||
'_sale_purchase_price_type_sel', compute='_compute_sale_price_type',
|
||||
string='Sale Price Type', compute_sudo=False, readonly=True)
|
||||
purchase_price_type = fields.Selection(
|
||||
'_sale_purchase_price_type_sel', compute='_compute_purchase_price_type',
|
||||
string='Purchase Price Type', compute_sudo=False, readonly=True)
|
||||
|
||||
@api.model
|
||||
def _sale_purchase_price_type_sel(self):
|
||||
return [('incl', _('Tax incl.')), ('excl', _('Tax excl.'))]
|
||||
|
||||
@api.depends('taxes_id')
|
||||
def _compute_sale_price_type(self):
|
||||
for pt in self:
|
||||
sale_price_type = 'incl'
|
||||
if pt.taxes_id and all([not t.price_include for t in pt.taxes_id if t.amount_type == 'percent']):
|
||||
sale_price_type = 'excl'
|
||||
pt.sale_price_type = sale_price_type
|
||||
|
||||
@api.depends('supplier_taxes_id')
|
||||
def _compute_purchase_price_type(self):
|
||||
for pt in self:
|
||||
purchase_price_type = 'incl'
|
||||
if pt.supplier_taxes_id and all([not t.price_include for t in pt.supplier_taxes_id if t.amount_type == 'percent']):
|
||||
purchase_price_type = 'excl'
|
||||
pt.purchase_price_type = purchase_price_type
|
||||
|
||||
|
||||
class ProductSupplierinfo(models.Model):
|
||||
_inherit = 'product.supplierinfo'
|
||||
|
||||
# DON'T put store=True on those fields, because they are company dependent
|
||||
purchase_price_type = fields.Selection(
|
||||
related='product_tmpl_id.purchase_price_type', related_sudo=False)
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2015-2020 Akretion France (http://www.akretion.com/)
|
||||
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).
|
||||
-->
|
||||
@@ -8,6 +8,18 @@
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_account_form" model="ir.ui.view">
|
||||
<field name="name">account.account.form</field>
|
||||
<field name="model">account.account</field>
|
||||
<field name="inherit_id" ref="account.view_account_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="deprecated" position="before">
|
||||
<field name="reconcile" attrs="{'invisible': ['|', ('internal_type','=','liquidity'), ('internal_group', '=', 'off_balance')]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_account_search" model="ir.ui.view">
|
||||
<field name="name">account.account.search</field>
|
||||
<field name="model">account.account</field>
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
<field name="matching_number" optional="hide"/>
|
||||
<field name="reconcile_string" optional="show"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='product_id']" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -58,6 +61,36 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_move_line_filter" model="ir.ui.view">
|
||||
<field name="name">account_usability.account_move_line_search</field>
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_account_move_line_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<filter name="unposted" position="before">
|
||||
<filter name="current_year" string="Current Year" domain="[('date', '>=', (context_today().strftime('%Y-01-01'))), ('date', '<=', (context_today().strftime('%Y-12-31')))]"/>
|
||||
<filter name="previous_year" string="Previous Year" domain="[('date', '>=', (context_today() + relativedelta(day=1, month=1, years=-1)).strftime('%Y-%m-%d')), ('date', '<=', (context_today() + relativedelta(day=31, month=12, years=-1)).strftime('%Y-%m-%d'))]"/>
|
||||
<separator/>
|
||||
</filter>
|
||||
<field name="partner_id" position="after">
|
||||
<field name="reconcile_string" />
|
||||
<field name="debit" filter_domain="['|', ('debit', '=', self), ('credit', '=', self)]" string="Debit or Credit"/>
|
||||
</field>
|
||||
<filter name="unreconciled" position="before">
|
||||
<filter name="reconciled" string="Fully Reconciled" domain="[('full_reconcile_id', '!=', False)]"/>
|
||||
</filter>
|
||||
<filter name="unreconciled" position="attributes">
|
||||
<attribute name="string">Unreconciled or Partially Reconciled</attribute>
|
||||
</filter>
|
||||
<!--
|
||||
<field name="name" position="attributes">
|
||||
<attribute name="string">Name or Reference</attribute>
|
||||
</field> -->
|
||||
<field name="partner_id" position="attributes">
|
||||
<attribute name="domain">['|', ('parent_id', '=', False), ('is_company', '=', True)]</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account.action_move_journal_line" model="ir.actions.act_window">
|
||||
<field name="context">{'default_move_type': 'entry', 'view_no_maturity': True}</field>
|
||||
<!-- Remove 'search_default_misc_filter': 1 -->
|
||||
|
||||
72
account_usability/views/product.xml
Normal file
72
account_usability/views/product.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2017-2020 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>
|
||||
|
||||
<!-- In the official account module, on product category and product template,
|
||||
some fields/groups are on account.group_account_invoice, some on
|
||||
account.group_account_user and some on account.group_account_manager
|
||||
Here, we set all those fields on account.group_account_invoice
|
||||
-->
|
||||
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<field name="name">account_usability.product.template.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="priority">100</field> <!-- when you replace a field, it's always better to inherit at the end -->
|
||||
<field name="inherit_id" ref="account.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="property_account_income_id" position="attributes">
|
||||
<attribute name="groups">account.group_account_invoice</attribute>
|
||||
</field>
|
||||
<field name="property_account_expense_id" position="attributes">
|
||||
<attribute name="groups">account.group_account_invoice</attribute>
|
||||
</field>
|
||||
<field name="list_price" position="replace">
|
||||
<div name="list_price">
|
||||
<field name="list_price" widget='monetary' options="{'currency_field': 'currency_id'}" class="oe_inline"/>
|
||||
<label for="sale_price_type" string=" "/>
|
||||
<field name="sale_price_type"/>
|
||||
</div>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_category_property_form" model="ir.ui.view">
|
||||
<field name="name">account_usability.product.category.form</field>
|
||||
<field name="model">product.category</field>
|
||||
<field name="inherit_id" ref="account.view_category_property_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="account_property" position="attributes">
|
||||
<attribute name="groups">account.group_account_invoice</attribute>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_form_view" model="ir.ui.view">
|
||||
<field name="name">account_usability.product.supplierinfo.form</field>
|
||||
<field name="model">product.supplierinfo</field>
|
||||
<field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="currency_id" position="after">
|
||||
<field name="purchase_price_type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_tree_view" model="ir.ui.view">
|
||||
<field name="name">account_usability.product.supplierinfo.tree</field>
|
||||
<field name="model">product.supplierinfo</field>
|
||||
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="price" position="after">
|
||||
<field name="purchase_price_type" string="Tax"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -72,7 +72,9 @@
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="name">add.phone_ids.on.partner.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="inherit_id" ref="mail.res_partner_view_form_inherit_mail"/>
|
||||
<!-- This module depends on contacts which depends on mail
|
||||
and the mail module replaces the email field -->
|
||||
<field name="arch" type="xml">
|
||||
<field name="phone" position="after">
|
||||
<field name="phone_ids" nolabel="1" colspan="2"/>
|
||||
@@ -83,9 +85,12 @@
|
||||
<field name="mobile" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="email" position="attributes">
|
||||
<label for="email" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
</label>
|
||||
<xpath expr="//field[@name='email']/.." position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<!-- I can't display phone_ids in the Contacts
|
||||
because there is a very strange thing in the web client: if
|
||||
you have a res.partner.phone on one of the fields,
|
||||
|
||||
@@ -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',
|
||||
|
||||
194
base_usability/i18n/base_usability.pot
Normal file
194
base_usability/i18n/base_usability.pot
Normal file
@@ -0,0 +1,194 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_usability
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \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"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner_bank
|
||||
msgid "Bank Accounts"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank__bank_name
|
||||
msgid "Bank Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Currency"
|
||||
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 "Customer Number:"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_model__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_category__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "E-mail:"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Group By"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_model__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank__id
|
||||
#: 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 ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.view_module_filter
|
||||
msgid "Installable"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_model____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_category____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_ir_mail_server
|
||||
msgid "Mail Server"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Mobile:"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_ir_model
|
||||
msgid "Models"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Name or Code"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.view_res_partner_filter
|
||||
msgid "Name or Email or Reference"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__name_title
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users__name_title
|
||||
msgid "Name with Title"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:res.groups,name:base_usability.group_nobody
|
||||
msgid "Nobody (used to hide native menus)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner_category
|
||||
msgid "Partner Tags"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__ref
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users__ref
|
||||
msgid "Reference"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Search Countries"
|
||||
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 ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_category__name
|
||||
msgid "Tag Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Tel:"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_users
|
||||
msgid "Users"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "VAT Number:"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#, python-format
|
||||
msgid "VAT:"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Website:"
|
||||
msgstr ""
|
||||
194
base_usability/i18n/fr.po
Normal file
194
base_usability/i18n/fr.po
Normal file
@@ -0,0 +1,194 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * base_usability
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \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"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner_bank
|
||||
msgid "Bank Accounts"
|
||||
msgstr "Comptes bancaires"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank__bank_name
|
||||
msgid "Bank Name"
|
||||
msgstr "Nom de la banque"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Sociétés"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Currency"
|
||||
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 :"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_model__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_company__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_category__display_name
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "E-mail:"
|
||||
msgstr "E-mail :"
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Group By"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_model__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_company__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__id
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank__id
|
||||
#: 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 ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.view_module_filter
|
||||
msgid "Installable"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_mail_server____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_ir_model____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_company____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_bank____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_category____last_update
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_ir_mail_server
|
||||
msgid "Mail Server"
|
||||
msgstr "Serveur d'email"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Mobile:"
|
||||
msgstr "Portable :"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_ir_model
|
||||
msgid "Models"
|
||||
msgstr "Modèles"
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Name or Code"
|
||||
msgstr "Nom ou code"
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.view_res_partner_filter
|
||||
msgid "Name or Email or Reference"
|
||||
msgstr "Nom ou e-mail ou référence"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__name_title
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users__name_title
|
||||
msgid "Name with Title"
|
||||
msgstr "Nom avec titre"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:res.groups,name:base_usability.group_nobody
|
||||
msgid "Nobody (used to hide native menus)"
|
||||
msgstr ""
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_partner_category
|
||||
msgid "Partner Tags"
|
||||
msgstr "Étiquettes du partenaire"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner__ref
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_users__ref
|
||||
msgid "Reference"
|
||||
msgstr "Référence"
|
||||
|
||||
#. module: base_usability
|
||||
#: model_terms:ir.ui.view,arch_db:base_usability.res_country_search
|
||||
msgid "Search Countries"
|
||||
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 :"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model.fields,field_description:base_usability.field_res_partner_category__name
|
||||
msgid "Tag Name"
|
||||
msgstr "Nom de l'étiquette"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Tel:"
|
||||
msgstr "Tél :"
|
||||
|
||||
#. module: base_usability
|
||||
#: model:ir.model,name:base_usability.model_res_users
|
||||
msgid "Users"
|
||||
msgstr "Utilisateurs"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "VAT Number:"
|
||||
msgstr "N° TVA :"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#, python-format
|
||||
msgid "VAT:"
|
||||
msgstr "TVA :"
|
||||
|
||||
#. module: base_usability
|
||||
#: code:addons/base_usability/models/res_company.py:0
|
||||
#: code:addons/base_usability/models/res_partner.py:0
|
||||
#, python-format
|
||||
msgid "Website:"
|
||||
msgstr "Site web :"
|
||||
@@ -51,7 +51,7 @@ class ResCompany(models.Model):
|
||||
'label': _('Website:')},
|
||||
'vat': {
|
||||
'value': self.vat,
|
||||
'label': _('TVA :')}, # TODO translate
|
||||
'label': _('VAT:')},
|
||||
}
|
||||
return options
|
||||
|
||||
|
||||
@@ -56,9 +56,8 @@ class ResPartner(models.Model):
|
||||
|
||||
# for reports
|
||||
def _display_full_address(
|
||||
self, details=[
|
||||
'company', 'name', 'address', 'phone',
|
||||
'mobile', 'email'],
|
||||
self,
|
||||
details=['company', 'name', 'address', 'phone', 'mobile', 'email'],
|
||||
icon=True):
|
||||
self.ensure_one()
|
||||
# To make the icons work with py3o with PDF export, on the py3o server:
|
||||
@@ -119,7 +118,28 @@ class ResPartner(models.Model):
|
||||
},
|
||||
'address': {
|
||||
'value': self._display_address(without_company=True),
|
||||
}
|
||||
},
|
||||
'vat': {
|
||||
'value': self.commercial_partner_id.vat,
|
||||
'label': _('VAT Number:'),
|
||||
},
|
||||
'commercial_ref': {
|
||||
'value': self.commercial_partner_id.ref,
|
||||
'label': _('Customer Number:'),
|
||||
},
|
||||
'ref': {
|
||||
'value': self.ref,
|
||||
'label': _('Customer Number:'),
|
||||
},
|
||||
# Same with 'supplier_' prefix, to change the label
|
||||
'supplier_commercial_ref': {
|
||||
'value': self.commercial_partner_id.ref,
|
||||
'label': _('Supplier Number:'),
|
||||
},
|
||||
'supplier_ref': {
|
||||
'value': self.ref,
|
||||
'label': _('Supplier Number:'),
|
||||
},
|
||||
}
|
||||
res = []
|
||||
for detail in details:
|
||||
|
||||
@@ -16,6 +16,19 @@
|
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='title']" position="attributes">
|
||||
<attribute name="attrs"></attribute>
|
||||
</xpath>
|
||||
<!-- Show double VAT partner even when not in editable mode -->
|
||||
<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>
|
||||
|
||||
|
||||
0
pos_product_tree_default/__init__.py
Normal file
0
pos_product_tree_default/__init__.py
Normal file
22
pos_product_tree_default/__manifest__.py
Normal file
22
pos_product_tree_default/__manifest__.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# Copyright 2021 Akretion (http://www.akretion.com)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
{
|
||||
'name': 'POS Product Tree Default',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Product',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Tree view by default instead of kanban for Products',
|
||||
'description': """
|
||||
Replace default kanban view by tree view for product menu in Point of Sale
|
||||
main menu
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['point_of_sale'],
|
||||
'data': [
|
||||
'views/product_template.xml'
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
9
pos_product_tree_default/views/product_template.xml
Normal file
9
pos_product_tree_default/views/product_template.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="point_of_sale.product_template_action_pos_product" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,form,kanban,activity</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
# 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": "POS Usability",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "14.0.1.0.0",
|
||||
"category": "Point of sale",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Misc usability improvement for point of sale",
|
||||
@@ -24,6 +26,10 @@ Akretion:
|
||||
"author": "Akretion",
|
||||
"website": "http://www.akretion.com",
|
||||
"depends": ["point_of_sale"],
|
||||
"data": ["report/pos.xml"],
|
||||
"installable": False,
|
||||
"data": [
|
||||
"report/pos.xml",
|
||||
"views/pos_category.xml",
|
||||
"views/product.xml",
|
||||
],
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
3
pos_usability/models/__init__.py
Normal file
3
pos_usability/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from . import product
|
||||
from . import pos_category
|
||||
from . import pos_payment_method
|
||||
25
pos_usability/models/pos_category.py
Normal file
25
pos_usability/models/pos_category.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# 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 fields, models
|
||||
|
||||
|
||||
class PosCategory(models.Model):
|
||||
_inherit = 'pos.category'
|
||||
|
||||
product_count = fields.Integer(
|
||||
'# Products', compute='_compute_product_count',
|
||||
help="The number of products under this point of sale category "
|
||||
"(does not consider the children categories)")
|
||||
|
||||
# inspired by the code of odoo/addons/product/models/product.py
|
||||
def _compute_product_count(self):
|
||||
read_group_res = self.env['product.template'].read_group(
|
||||
[('pos_categ_id', 'in', self.ids)],
|
||||
['pos_categ_id'], ['pos_categ_id'])
|
||||
group_data = dict(
|
||||
(data['pos_categ_id'][0], data['pos_categ_id_count']) for data
|
||||
in read_group_res)
|
||||
for pos_categ in self:
|
||||
pos_categ.product_count = group_data.get(pos_categ.id, 0)
|
||||
12
pos_usability/models/pos_payment_method.py
Normal file
12
pos_usability/models/pos_payment_method.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# 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 PosPaymentMethod(models.Model):
|
||||
_inherit = 'pos.payment.method'
|
||||
_check_company_auto = True
|
||||
|
||||
cash_journal_id = fields.Many2one(check_company=True)
|
||||
12
pos_usability/models/product.py
Normal file
12
pos_usability/models/product.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# 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 fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
available_in_pos = fields.Boolean(tracking=True)
|
||||
pos_categ_id = fields.Many2one(tracking=True)
|
||||
35
pos_usability/views/pos_category.xml
Normal file
35
pos_usability/views/pos_category.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
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).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="product_pos_category_form_view" model="ir.ui.view">
|
||||
<field name="name">pos_usability.pos.category.form</field>
|
||||
<field name="model">pos.category</field>
|
||||
<field name="inherit_id" ref="point_of_sale.product_pos_category_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<div class="oe_title" position="before">
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button class="oe_stat_button"
|
||||
name="%(product.product_template_action_all)d"
|
||||
icon="fa-th-list"
|
||||
type="action"
|
||||
context="{'search_default_pos_categ_id': active_id}">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<span class="o_stat_value"><field name="product_count"/></span>
|
||||
<span class="o_stat_text"> Products</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
43
pos_usability/views/product.xml
Normal file
43
pos_usability/views/product.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
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).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<!-- put option "available in POS" at the top of product form view -->
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<field name="name">usability.pos.product.template</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="point_of_sale.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@name='pos']//field[@name='available_in_pos']" position="replace"/>
|
||||
<xpath expr="//div[@name='options']//field[@name='sale_ok']/.." position="after">
|
||||
<div name="available_in_pos">
|
||||
<field name="available_in_pos"/>
|
||||
<label for="available_in_pos"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_template_search_view" model="ir.ui.view">
|
||||
<field name="name">pos_usability.product.template.search</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="categ_id" position="after">
|
||||
<field name="pos_categ_id" filter_domain="[('pos_categ_id', 'child_of', raw_value)]"/>
|
||||
</field>
|
||||
<filter name="categ_id" position="after">
|
||||
<filter name="pos_categ_groupby" string="Point of Sale Category" context="{'group_by': 'pos_categ_id'}"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
{
|
||||
'name': 'Product no Translation',
|
||||
'version': '12.0.0.0.1',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Sales Management',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'For companies that work with only one language',
|
||||
@@ -37,5 +37,5 @@ And it reduces the start time of the Point of Sale !
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['product'],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -31,13 +31,6 @@ class ProductTemplate(models.Model):
|
||||
description = fields.Text(translate=False)
|
||||
name = fields.Char(translate=False)
|
||||
|
||||
|
||||
class ProductCategory(models.Model):
|
||||
_inherit = "product.category"
|
||||
|
||||
name = fields.Char(translate=False)
|
||||
|
||||
|
||||
class ProductAttribute(models.Model):
|
||||
_inherit = "product.attribute"
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
|
||||
@@ -17,7 +17,7 @@ This module adds a wizard on product.product form view which allows to generate
|
||||
* regular product barcode stickers. These stickers will show:
|
||||
* product name
|
||||
* product price
|
||||
* EAN13 barcode
|
||||
* EAN13 or EAN8 barcode
|
||||
|
||||
* price/weight barcode stickers. These stickers will show:
|
||||
* product name
|
||||
@@ -26,6 +26,8 @@ This module adds a wizard on product.product form view which allows to generate
|
||||
* price per kg
|
||||
* EAN13 barcode
|
||||
|
||||
It also allows to generate a private barcode for products without barcode. For that, you must configure the sequence "private.product.barcode". This sequence must be configured to produce 12 digits (for EAN13) or 7 digits (for EAN8) ; the checksum will be added automatically.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion
|
||||
<alexis.delattre@akretion.com>.
|
||||
""",
|
||||
@@ -43,6 +45,7 @@ This module has been written by Alexis de Lattre from Akretion
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/product_print_zpl_barcode_view.xml',
|
||||
'views/product.xml',
|
||||
'data/barcode_sequence.xml',
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
26
product_print_zpl_barcode/data/barcode_sequence.xml
Normal file
26
product_print_zpl_barcode/data/barcode_sequence.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<!--
|
||||
GS1 prefixes : https://www.gs1.org/standards/id-keys/company-prefix
|
||||
200 - 299 : Used to issue GS1 Restricted Circulation Numbers
|
||||
within a geographic region (MO defined)
|
||||
21, 22 and 23 are already used by Odoo for Weight, Price & Discount barcodes
|
||||
So I use 298 by default
|
||||
Another option would to be use a small country at the other side of the world,
|
||||
for example 623 : Brunei
|
||||
-->
|
||||
<record id="private_product_barcode_seq" model="ir.sequence">
|
||||
<field name="name">Private Product Barcode</field>
|
||||
<field name="code">private.product.barcode</field>
|
||||
<field name="prefix">298</field>
|
||||
<field name="padding">9</field>
|
||||
<field name="number_next">1</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
1
product_print_zpl_barcode/models/__init__.py
Normal file
1
product_print_zpl_barcode/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import product
|
||||
67
product_print_zpl_barcode/models/product.py
Normal file
67
product_print_zpl_barcode/models/product.py
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2020 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, _
|
||||
from odoo.exceptions import UserError
|
||||
from stdnum.ean import calc_check_digit
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = "product.template"
|
||||
|
||||
must_print_barcode = fields.Boolean(
|
||||
string="Must Print Barcode",
|
||||
help="Enable that option for products for which you must "
|
||||
"print a barcode upon reception in stock.")
|
||||
|
||||
def generate_barcode_from_product_template(self):
|
||||
self.ensure_one()
|
||||
if self.product_variant_count != 1:
|
||||
raise UserError(_(
|
||||
"You cannot call the method "
|
||||
"generate_barcode_from_product_template on product '%s' "
|
||||
"because it has %d variants and not just one.")
|
||||
% (self.display_name, self.product_variant_count))
|
||||
return self.product_variant_ids[0].generate_barcode_from_product_product()
|
||||
|
||||
def print_zpl_barcode_from_product_template(self):
|
||||
self.ensure_one()
|
||||
if self.product_variant_count != 1:
|
||||
raise UserError(_(
|
||||
"You cannot call the method "
|
||||
"print_zpl_barcode_from_product_template on product '%s' "
|
||||
"because it has %d variants and not just one.")
|
||||
% (self.display_name, self.product_variant_count))
|
||||
action = self.env.ref(
|
||||
'product_print_zpl_barcode.product_print_zpl_barcode_action').sudo().read()[0]
|
||||
action['context'] = {
|
||||
'active_id': self.product_variant_ids[0].id,
|
||||
'active_model': 'product.product',
|
||||
}
|
||||
return action
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
def generate_barcode_from_product_product(self):
|
||||
self.ensure_one()
|
||||
if self.barcode:
|
||||
raise UserError(_(
|
||||
"The product '%s' already has a barcode.") % self.display_name)
|
||||
barcode_without_checksum = self.env['ir.sequence'].next_by_code(
|
||||
'private.product.barcode')
|
||||
if len(barcode_without_checksum) not in (7, 12):
|
||||
raise UserError(_(
|
||||
"The sequence 'private.product.barcode' is not properly "
|
||||
"configured. The generated sequence should have 7 digits "
|
||||
"(for EAN-8) or 12 digits (for EAN-13). "
|
||||
"It currently has %d digits." % len(barcode_without_checksum)))
|
||||
checksum = calc_check_digit(barcode_without_checksum)
|
||||
barcode = barcode_without_checksum + str(checksum)
|
||||
self.write({
|
||||
'barcode': barcode,
|
||||
'must_print_barcode': True,
|
||||
})
|
||||
@@ -1,20 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2016 Akretion (http://www.akretion.com/)
|
||||
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>
|
||||
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<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 id="must_print_barcode">
|
||||
<field name="must_print_barcode"/>
|
||||
<label for="must_print_barcode"/>
|
||||
</div>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="product_template_only_form_view" model="ir.ui.view">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_only_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<header position="inside">
|
||||
<button name="generate_barcode_from_product_template" type="object" string="Generate Barcode" attrs="{'invisible': ['|', ('product_variant_count', '>', 1), ('barcode', '!=', False)]}"/>
|
||||
<button name="print_zpl_barcode_from_product_template" type="object" string="Print Barcode" groups="base_report_to_printer.printing_group_user" attrs="{'invisible': ['|', ('product_variant_count', '>', 1), ('barcode', '=', False)]}"/>
|
||||
</header>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="product_normal_form_view" model="ir.ui.view">
|
||||
<field name="name">generate.weight.price.barcode.product.product.form</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view" />
|
||||
<field name="arch" type="xml">
|
||||
<header position="inside">
|
||||
<button name="%(product_print_zpl_barcode.product_print_zpl_barcode_action)d" type="action" string="Print Barcode" groups="base_report_to_printer.printing_group_user"/>
|
||||
<button name="generate_barcode_from_product_product" type="object" string="Generate Barcode" attrs="{'invisible': [('barcode', '!=', False)]}"/>
|
||||
<button name="%(product_print_zpl_barcode.product_print_zpl_barcode_action)d" type="action" string="Print Barcode" groups="base_report_to_printer.printing_group_user" attrs="{'invisible': [('barcode', '=', False)]}"/>
|
||||
</header>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_compare, float_is_zero
|
||||
from stdnum.ean import is_valid
|
||||
import base64
|
||||
import re
|
||||
|
||||
@@ -172,7 +173,8 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
# print "barcode FINAL=", barcode
|
||||
zpl_unicode = self._price_weight_barcode_type_zpl() % {
|
||||
'product_name': self.product_name,
|
||||
'ean13_no_checksum': barcode[:12],
|
||||
'ean_zpl_command': len(self.barcode) == 8 and 'B8' or 'BE',
|
||||
'ean_no_checksum': barcode[:-1],
|
||||
'price_uom': self.price_uom,
|
||||
'price': self.price,
|
||||
'currency_symbol': self.currency_id.symbol,
|
||||
@@ -189,7 +191,7 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
|
||||
@api.model
|
||||
def _price_weight_barcode_type_zpl(self):
|
||||
label = u"""
|
||||
label = """
|
||||
^XA
|
||||
^CI28
|
||||
^PW304
|
||||
@@ -201,7 +203,7 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
^FO15,30^FB270,3,0,C^FD%(product_name)s^FS
|
||||
^CF0,25
|
||||
^FO15,75^FB270,1,0,C^FD%(quantity).3f %(uom_name)s %(price_uom).2f %(currency_symbol)s/%(uom_name)s^FS
|
||||
^FO60,110^BEN,50^FD%(ean13_no_checksum)s^FS
|
||||
^FO60,110^%(ean_zpl_command)sN,50^FD%(ean_no_checksum)s^FS
|
||||
^PQ%(copies)s
|
||||
^XZ
|
||||
"""
|
||||
@@ -209,7 +211,7 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
|
||||
@api.model
|
||||
def _product_barcode_type_zpl(self):
|
||||
label = u"""
|
||||
label = """
|
||||
^XA
|
||||
^CI28
|
||||
^PW304
|
||||
@@ -219,7 +221,7 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
^FO15,0^FB270,1,0,C^FD%(price_uom).2f %(currency_symbol)s^FS
|
||||
^CF0,20
|
||||
^FO15,30^FB270,3,0,C^FD%(product_name)s^FS
|
||||
^FO60,100^BEN,60^FD%(ean13_no_checksum)s^FS
|
||||
^FO60,100^%(ean_zpl_command)sN,60^FD%(ean_no_checksum)s^FS
|
||||
^PQ%(copies)s
|
||||
^XZ
|
||||
"""
|
||||
@@ -228,7 +230,8 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
def _prepare_product_barcode_type(self):
|
||||
zpl_unicode = self._product_barcode_type_zpl() % {
|
||||
'product_name': self.product_name,
|
||||
'ean13_no_checksum': self.barcode[:12],
|
||||
'ean_zpl_command': len(self.barcode) == 8 and 'B8' or 'BE',
|
||||
'ean_no_checksum': self.barcode[:-1],
|
||||
'price_uom': self.price_uom,
|
||||
'currency_symbol': self.currency_id.symbol, # symbol is a required field
|
||||
'copies': self.copies,
|
||||
@@ -242,12 +245,16 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
|
||||
def generate(self):
|
||||
assert self.barcode
|
||||
if len(self.barcode) != 13:
|
||||
if len(self.barcode) not in (8, 13):
|
||||
raise UserError(_(
|
||||
"This wizard only supports EAN13 for the moment. Barcode '%s' "
|
||||
"has %d digits instead of 13") % (
|
||||
"This wizard only supports EAN8 and EAN13 for the moment. "
|
||||
"Barcode '%s' has %d digits.") % (
|
||||
self.barcode,
|
||||
len(self.barcode)))
|
||||
if not is_valid(self.barcode):
|
||||
raise UserError(_(
|
||||
"The barcode '%s' is not a valid EAN barcode "
|
||||
"(wrong checksum).") % self.barcode)
|
||||
if not self.copies:
|
||||
raise UserError(_("The number of copies cannot be 0"))
|
||||
if self.barcode_type in ('price', 'weight'):
|
||||
@@ -263,7 +270,7 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
'zpl_filename': 'barcode_%s.zpl' % vals['barcode'],
|
||||
})
|
||||
self.write(vals)
|
||||
action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').read()[0]
|
||||
action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').sudo().read()[0]
|
||||
action.update({
|
||||
'res_id': self.id,
|
||||
'context': self._context,
|
||||
@@ -278,7 +285,7 @@ class ProductPrintZplBarcode(models.TransientModel):
|
||||
self.zpl_filename, base64.decodebytes(self.zpl_file), format='raw')
|
||||
action = True
|
||||
if self._context.get('print_and_new'):
|
||||
action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').read()[0]
|
||||
action = self.env.ref('product_print_zpl_barcode.product_print_zpl_barcode_action').sudo().read()[0]
|
||||
action.update({
|
||||
'views': False,
|
||||
'context': self._context,
|
||||
|
||||
@@ -14,25 +14,16 @@ class ProductTemplate(models.Model):
|
||||
# in v10, that field was defined in procurement_suggest, but we will
|
||||
# probably not port procurement_suggest because it is native in v14
|
||||
seller_id = fields.Many2one(
|
||||
'res.partner', related='seller_ids.name', string='Main Supplier')
|
||||
'res.partner', related='seller_ids.name', store=True,
|
||||
string='Main Supplier')
|
||||
|
||||
# name = fields.Char(
|
||||
# track_visibility='onchange')
|
||||
|
||||
# type = fields.Selection(
|
||||
# track_visibility='onchange')
|
||||
|
||||
# categ_id = fields.Many2one(
|
||||
# track_visibility='onchange')
|
||||
|
||||
# list_price = fields.Float(
|
||||
# track_visibility='onchange')
|
||||
|
||||
# sale_ok = fields.Boolean(
|
||||
# track_visibility='onchange')
|
||||
|
||||
# purchase_ok = fields.Boolean(
|
||||
# track_visibility='onchange')
|
||||
|
||||
# active = fields.Boolean(
|
||||
# track_visibility='onchange')
|
||||
# in v14, I noticed that the tracking of the fields of product.template
|
||||
# are only shown in the form view of product.template, not in the form
|
||||
# view of product.product
|
||||
name = fields.Char(tracking=10)
|
||||
categ_id = fields.Many2one(tracking=20)
|
||||
type = fields.Selection(tracking=30)
|
||||
list_price = fields.Float(tracking=40)
|
||||
sale_ok = fields.Boolean(tracking=50)
|
||||
purchase_ok = fields.Boolean(tracking=60)
|
||||
active = fields.Boolean(tracking=70)
|
||||
|
||||
@@ -17,4 +17,15 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_supplierinfo_tree_view" model="ir.ui.view">
|
||||
<field name="model">product.supplierinfo</field>
|
||||
<field name="inherit_id" ref="product.product_supplierinfo_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_code" position="attributes">
|
||||
<attribute name="optional">show</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
'name': 'Purchase Product Tree Default',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Product',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Tree view by default instead of kanban for Products',
|
||||
@@ -18,5 +18,5 @@
|
||||
'data': [
|
||||
'views/product_template.xml'
|
||||
],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
from . import purchase
|
||||
from . import models
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Copyright (C) 2014-2019 Akretion (http://www.akretion.com)
|
||||
# Copyright (C) 2014-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': 'Purchase Stock Usability',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Purchases',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Usability improvements on purchase_stock module',
|
||||
@@ -23,7 +23,7 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
||||
'purchase_usability',
|
||||
],
|
||||
'data': [
|
||||
'stock_view.xml',
|
||||
'views/stock_picking.xml',
|
||||
],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
1
purchase_stock_usability/models/__init__.py
Normal file
1
purchase_stock_usability/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import purchase
|
||||
@@ -1,16 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015-2019 Akretion France (http://www.akretion.com)
|
||||
# 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, api
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
picking_type_id = fields.Many2one(track_visibility='onchange')
|
||||
incoterm_id = fields.Many2one(track_visibility='onchange')
|
||||
picking_type_id = fields.Many2one(tracking=True)
|
||||
incoterm_id = fields.Many2one(tracking=True)
|
||||
|
||||
# inherit compute method of the field delivery_partner_id
|
||||
# defined in purchase_usability
|
||||
@@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2017-2019 Akretion (http://www.akretion.com/)
|
||||
Copyright 2017-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_form" model="ir.ui.view">
|
||||
<field name="name">purchase_usability.stock.picking.form</field>
|
||||
<field name="name">purchase_stock_usability.stock.picking.form</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
@@ -42,3 +42,39 @@ class PurchaseOrder(models.Model):
|
||||
self.env, po.amount_untaxed, currency_obj=po.currency_id)
|
||||
result.append((po.id, name))
|
||||
return result
|
||||
|
||||
# for report
|
||||
def py3o_lines_layout(self):
|
||||
self.ensure_one()
|
||||
res = []
|
||||
has_sections = False
|
||||
subtotal = 0.0
|
||||
for line in self.order_line:
|
||||
if line.display_type == 'line_section':
|
||||
# insert line
|
||||
if has_sections:
|
||||
res.append({'subtotal': subtotal})
|
||||
subtotal = 0.0 # reset counter
|
||||
has_sections = True
|
||||
else:
|
||||
if not line.display_type:
|
||||
subtotal += line.price_subtotal
|
||||
res.append({'line': line})
|
||||
if has_sections: # insert last subtotal line
|
||||
res.append({'subtotal': subtotal})
|
||||
# res:
|
||||
# [
|
||||
# {'line': sale_order_line(1) with display_type=='line_section'},
|
||||
# {'line': sale_order_line(2) without display_type},
|
||||
# {'line': sale_order_line(3) without display_type},
|
||||
# {'line': sale_order_line(4) with display_type=='line_note'},
|
||||
# {'subtotal': 8932.23},
|
||||
# ]
|
||||
return res
|
||||
|
||||
|
||||
class PurchaseOrderLine(models.Model):
|
||||
_inherit = 'purchase.order.line'
|
||||
|
||||
# for optional display in tree view
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
<xpath expr="//field[@name='order_line']/form//field[@name='analytic_tag_ids']" position="attributes">
|
||||
<attribute name="groups">analytic.group_analytic_tags</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree//field[@name='product_id']" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -18,10 +18,8 @@
|
||||
},
|
||||
"depends": [
|
||||
"sale_management",
|
||||
"sale_product_configurator"
|
||||
],
|
||||
"data": [
|
||||
"views/product_template_view.xml",
|
||||
"views/sale_order_view.xml",
|
||||
],
|
||||
"demo": [
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="product_template_view_form" model="ir.ui.view">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="sale.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="options" position="attributes">
|
||||
<attribute name="invisible"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
{
|
||||
'name': 'Sale Product Tree Default',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Product',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Tree view by default instead of kanban for Products',
|
||||
@@ -18,5 +18,5 @@
|
||||
'data': [
|
||||
'views/product_template.xml'
|
||||
],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<record id="sale.product_template_action" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,form,kanban,activity</field>
|
||||
<field name="view_id" ref="product.product_template_tree_view"/>
|
||||
<field name="view_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -21,6 +21,9 @@ class SaleOrder(models.Model):
|
||||
fiscal_position_id = fields.Many2one(tracking=True)
|
||||
# for reports
|
||||
has_discount = fields.Boolean(compute='_compute_has_discount')
|
||||
has_attachment = fields.Boolean(
|
||||
compute='_compute_has_attachment',
|
||||
search='_search_has_attachment')
|
||||
|
||||
@api.depends('order_line.discount')
|
||||
def _compute_has_discount(self):
|
||||
@@ -34,6 +37,30 @@ class SaleOrder(models.Model):
|
||||
break
|
||||
order.has_discount = has_discount
|
||||
|
||||
def _compute_has_attachment(self):
|
||||
iao = self.env['ir.attachment']
|
||||
for order in self:
|
||||
if iao.search_count([
|
||||
('res_model', '=', 'sale.order'),
|
||||
('res_id', '=', order.id),
|
||||
('type', '=', 'binary'),
|
||||
('company_id', '=', order.company_id.id)]):
|
||||
order.has_attachment = True
|
||||
else:
|
||||
order.has_attachment = False
|
||||
|
||||
def _search_has_attachment(self, operator, value):
|
||||
att_order_ids = {}
|
||||
if operator == '=':
|
||||
search_res = self.env['ir.attachment'].search_read([
|
||||
('res_model', '=', 'sale.order'),
|
||||
('type', '=', 'binary'),
|
||||
('res_id', '!=', False)], ['res_id'])
|
||||
for att in search_res:
|
||||
att_order_ids[att['res_id']] = True
|
||||
res = [('id', value and 'in' or 'not in', list(att_order_ids))]
|
||||
return res
|
||||
|
||||
# for report
|
||||
def py3o_lines_layout(self):
|
||||
self.ensure_one()
|
||||
@@ -47,9 +74,8 @@ class SaleOrder(models.Model):
|
||||
res.append({'subtotal': subtotal})
|
||||
subtotal = 0.0 # reset counter
|
||||
has_sections = True
|
||||
else:
|
||||
if not line.display_type:
|
||||
subtotal += line.price_subtotal
|
||||
elif not line.display_type:
|
||||
subtotal += line.price_subtotal
|
||||
res.append({'line': line})
|
||||
if has_sections: # insert last subtotal line
|
||||
res.append({'subtotal': subtotal})
|
||||
@@ -67,6 +93,10 @@ class SaleOrder(models.Model):
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
# for optional display in tree view
|
||||
product_barcode = fields.Char(
|
||||
related='product_id.barcode', string="Product Barcode")
|
||||
|
||||
@api.onchange('product_uom', 'product_uom_qty')
|
||||
def product_uom_change(self):
|
||||
# When the user has manually set a custom price
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
<field name="date_order" position="after">
|
||||
<field name="client_order_ref"/>
|
||||
</field>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -62,6 +65,10 @@
|
||||
<filter name="order_month" position="after">
|
||||
<filter string="State" name="state_groupby" context="{'group_by': 'state'}"/>
|
||||
</filter>
|
||||
<filter name="activities_upcoming_all" position="after">
|
||||
<separator/>
|
||||
<filter name="no_attachment" string="Missing Attachment" domain="[('has_attachment', '=', False)]"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright 2019-2020 Akretion France (http://www.akretion.com)
|
||||
# Copyright 2019-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).
|
||||
|
||||
@@ -15,14 +15,13 @@ Stock Account Usability
|
||||
|
||||
The usability enhancements include:
|
||||
|
||||
NONE
|
||||
- show to_refund on stock.move form view
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['stock_account'],
|
||||
'data': [
|
||||
],
|
||||
'installable': False,
|
||||
'depends': ['stock_account', 'stock_usability'],
|
||||
'data': ['views/stock_move.xml'],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
23
stock_account_usability/views/stock_move.xml
Normal file
23
stock_account_usability/views/stock_move.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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="view_move_form" model="ir.ui.view">
|
||||
<field name="name">stock_account_usability.stock.move.form</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock_usability.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="price_unit" position="after">
|
||||
<field name="to_refund" readonly="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -1,2 +0,0 @@
|
||||
from . import stock_return_picking
|
||||
from . import stock_quantity_history
|
||||
@@ -1,10 +1,10 @@
|
||||
# © 2019 Akretion (http://www.akretion.com)
|
||||
# Copyright 2019-2021 Akretion (http://www.akretion.com)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
{
|
||||
'name': 'Stock Product Tree Default',
|
||||
'version': '12.0.1.0.0',
|
||||
'version': '14.0.1.0.0',
|
||||
'category': 'Product',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Tree view by default instead of kanban for Products',
|
||||
@@ -18,5 +18,5 @@
|
||||
'data': [
|
||||
'views/product_template.xml'
|
||||
],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<record id="stock.product_template_action_product" model="ir.actions.act_window">
|
||||
<field name="view_mode">tree,form,kanban,activity</field>
|
||||
<field name="view_id" ref="product.product_template_tree_view"/>
|
||||
<field name="view_id" eval="False"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
from . import models
|
||||
from .post_install import create_config_parameter_immediate_tranfer
|
||||
|
||||
@@ -32,9 +32,12 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
'views/stock_move.xml',
|
||||
'views/stock_picking.xml',
|
||||
'views/stock_warehouse.xml',
|
||||
'views/stock_warehouse_orderpoint.xml',
|
||||
'views/product.xml',
|
||||
'views/procurement_group.xml',
|
||||
'views/procurement_scheduler_log.xml',
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
'post_init_hook': 'create_config_parameter_immediate_tranfer',
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ from . import stock_warehouse_orderpoint
|
||||
from . import stock_quant
|
||||
from . import procurement_group
|
||||
from . import procurement_scheduler_log
|
||||
from . import product_template
|
||||
from . import product
|
||||
from . import res_partner
|
||||
|
||||
31
stock_usability/models/product.py
Normal file
31
stock_usability/models/product.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# Copyright 2016-2021 Akretion France
|
||||
# @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 ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
tracking = fields.Selection(tracking=True)
|
||||
sale_delay = fields.Float(tracking=True)
|
||||
# the 'stock' module adds 'product' in type...
|
||||
# but forgets to make it the default
|
||||
type = fields.Selection(default='product')
|
||||
|
||||
def action_view_stock_move(self):
|
||||
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
|
||||
action['domain'] = [('product_id.product_tmpl_id', 'in', self.ids)]
|
||||
action['context'] = {'search_default_done': True}
|
||||
return action
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
def action_view_stock_move(self):
|
||||
action = self.env.ref('stock.stock_move_action').sudo().read()[0]
|
||||
action['domain'] = [('product_id', 'in', self.ids)]
|
||||
action['context'] = {'search_default_done': True}
|
||||
return action
|
||||
@@ -1,15 +0,0 @@
|
||||
# Copyright 2016-2020 Akretion France
|
||||
# @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 ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
tracking = fields.Selection(tracking=True)
|
||||
sale_delay = fields.Float(tracking=True)
|
||||
# the 'stock' module adds 'product' in type...
|
||||
# but forgets to make it the default
|
||||
type = fields.Selection(default='product')
|
||||
@@ -2,7 +2,7 @@
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models, _
|
||||
from odoo import fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
import logging
|
||||
|
||||
@@ -12,6 +12,9 @@ logger = logging.getLogger(__name__)
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
# for optional display in tree view
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
|
||||
# def name_get(self):
|
||||
# '''name_get of stock_move is important for the reservation of the
|
||||
# quants: so want to add the name of the customer and the expected date
|
||||
@@ -37,7 +40,7 @@ class StockMove(models.Model):
|
||||
picking = move.picking_id
|
||||
if picking:
|
||||
product = move.product_id
|
||||
picking.message_post(_(
|
||||
picking.message_post(body=_(
|
||||
"Product <a href=# data-oe-model=product.product "
|
||||
"data-oe-id=%d>%s</a> qty %s %s <b>unreserved</b>")
|
||||
% (product.id, product.display_name,
|
||||
@@ -49,6 +52,9 @@ class StockMove(models.Model):
|
||||
class StockMoveLine(models.Model):
|
||||
_inherit = 'stock.move.line'
|
||||
|
||||
# for optional display in tree view
|
||||
product_barcode = fields.Char(related='product_id.barcode', string="Product Barcode")
|
||||
|
||||
# TODO: I think it's not complete
|
||||
def button_do_unreserve(self):
|
||||
for moveline in self:
|
||||
@@ -60,7 +66,7 @@ class StockMoveLine(models.Model):
|
||||
picking = moveline.move_id.picking_id
|
||||
if picking:
|
||||
product = moveline.product_id
|
||||
picking.message_post(_(
|
||||
picking.message_post(body=_(
|
||||
"Product <a href=# data-oe-model=product.product "
|
||||
"data-oe-id=%d>%s</a> qty %s %s <b>unreserved</b>")
|
||||
% (product.id, product.display_name,
|
||||
|
||||
26
stock_usability/post_install.py
Normal file
26
stock_usability/post_install.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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).
|
||||
|
||||
import logging
|
||||
from odoo import SUPERUSER_ID, api
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_config_parameter_immediate_tranfer(cr, registry):
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ico = env["ir.config_parameter"]
|
||||
conf_param = ico.search([('key', '=', 'stock.no_default_immediate_tranfer')])
|
||||
if not conf_param:
|
||||
ico.create({
|
||||
'key': 'stock.no_default_immediate_tranfer',
|
||||
'value': 'True',
|
||||
})
|
||||
logger.info(
|
||||
'ir.config_parameter stock.no_default_immediate_tranfer created')
|
||||
else:
|
||||
logger.info(
|
||||
'ir.config_parameter stock.no_default_immediate_tranfer '
|
||||
'already exists')
|
||||
56
stock_usability/views/product.xml
Normal file
56
stock_usability/views/product.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
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).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_stock_product_template_tree" model="ir.ui.view">
|
||||
<field name="name">stock.usability.product.template.tree</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_product_template_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="responsible_id" position="attributes">
|
||||
<attribute name="optional">hide</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_template_form_view_procurement_button" model="ir.ui.view">
|
||||
<field name="name">stock_usability.product.template.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="stock.product_template_form_view_procurement_button"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_view_stock_move_lines" position="before">
|
||||
<button string="Stock Moves"
|
||||
type="object"
|
||||
name= "action_view_stock_move"
|
||||
attrs="{'invisible': [('type', 'not in', ('product', 'consu'))]}"
|
||||
groups="stock.group_stock_user"
|
||||
class="oe_stat_button" icon="fa-exchange"
|
||||
/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_form_view_procurement_button" model="ir.ui.view">
|
||||
<field name="name">stock_usability.product.product.form</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="stock.product_form_view_procurement_button"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_view_stock_move_lines" position="before">
|
||||
<button string="Stock Moves"
|
||||
type="object"
|
||||
name= "action_view_stock_move"
|
||||
attrs="{'invisible': [('type', 'not in', ('product', 'consu'))]}"
|
||||
groups="stock.group_stock_user"
|
||||
class="oe_stat_button" icon="fa-exchange"
|
||||
/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -21,6 +21,9 @@
|
||||
<attribute name="decoration-info">product_qty > theoretical_qty</attribute>
|
||||
<attribute name="decoration-danger">product_qty < theoretical_qty</attribute>
|
||||
</tree>
|
||||
<field name="location_id" position="attributes">
|
||||
<attribute name="invisible">0</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -58,6 +58,9 @@
|
||||
states="partially_available,assigned"
|
||||
icon="fa-ban"/>
|
||||
</field>
|
||||
<field name="product_id" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -78,6 +81,20 @@
|
||||
states="partially_available,assigned"
|
||||
icon="fa-ban"/>
|
||||
</field>
|
||||
<field name="product_id" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- View embedded in picking -->
|
||||
<record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view">
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -30,9 +30,12 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='location_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='location_dest_id']" position="replace"/>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='name']" position="replace"/>
|
||||
<xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_id']" position="after">
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations"/>
|
||||
<field name="product_barcode" optional="hide"/>
|
||||
<field name="name" optional="hide"/>
|
||||
<field name="location_id" groups="stock.group_stock_multi_locations" optional="show"/>
|
||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations" optional="show"/>
|
||||
</xpath>
|
||||
<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"
|
||||
@@ -40,15 +43,6 @@
|
||||
states="partially_available,assigned"
|
||||
icon="fa-ban"/>
|
||||
</xpath>
|
||||
<!-- STOCK MOVE LINE -->
|
||||
<!--
|
||||
<xpath expr="//field[@name='move_line_ids_without_package']/tree/field[@name='location_id']" position="attributes">
|
||||
<attribute name="attrs">{}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='move_line_ids_without_package']/tree/field[@name='location_dest_id']" position="attributes">
|
||||
<attribute name="attrs">{}</attribute>
|
||||
</xpath>
|
||||
-->
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
43
stock_usability/views/stock_warehouse_orderpoint.xml
Normal file
43
stock_usability/views/stock_warehouse_orderpoint.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2014-2020 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_warehouse_orderpoint_form" model="ir.ui.view">
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="product_id" position="after">
|
||||
<field name="trigger"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_warehouse_orderpoint_tree_editable" model="ir.ui.view">
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="trigger" position="attributes">
|
||||
<attribute name="optional">show</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_warehouse_orderpoint_tree_editable_config" model="ir.ui.view">
|
||||
<field name="model">stock.warehouse.orderpoint</field>
|
||||
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree_editable_config" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="trigger" position="attributes">
|
||||
<attribute name="optional">show</attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user