Compare commits

...

103 Commits

Author SHA1 Message Date
Alexis de Lattre
b973dd2b07 mrp_average_cost : fix bug in multi-uom and when bom qty != 1 2024-03-24 14:54:04 +01:00
Alexis de Lattre
bdb7e04929 sale_stock_usability: only show picking_status on confirmed SO 2023-09-07 18:25:57 +02:00
Alexis de Lattre
04d5b4c5ab sale_down_payment: auto-reconcile when validating invoice 2023-04-25 19:11:58 +02:00
Alexis de Lattre
b2e9f0ecc3 stock_usability: improve stock.move.line form when accessed from menu or product form shortcut 2023-01-10 19:51:44 +01:00
Alexis de Lattre
61c3aaa532 stock_usability: backport improvements from v14 (show reservations on quants tree view)
Also add button to access stock.move.line from lots
2022-12-02 15:37:56 +01:00
Alexis de Lattre
f861685ae8 sale_usability: add client_order_ref in tree view 2022-10-18 15:02:38 +02:00
Alexis de Lattre
0cd6ecd958 purchase_usability: warning when price and/or delay is auto-updated following a qty change
It is similar to the feature present in sale_usability when the qty is
updated and the price unit changes
2022-06-16 18:07:53 +02:00
Alexis de Lattre
0d689b1e95 stock_valuation_xlsx: improve multi-company support
Other small minor improvements/fixes
2022-05-13 17:39:32 +02:00
Alexis de Lattre
8fe2cac892 sale_report: add button to send order acknowledgement 2022-05-06 14:56:12 +02:00
Alexis de Lattre
3b2efaab37 [ADD] module base_dynamic_list 2022-05-06 11:13:03 +02:00
Alexis de Lattre
38a6b1221e account_usability: add name_search on account.incoterms
base_usability: Small improvement in script on res.users
2022-03-04 17:01:38 +01:00
Alexis de Lattre
af806f7bcc stock_usability: usability improvements on inventory and picking form view 2022-01-21 11:24:59 +01:00
Alexis de Lattre
b72d8c44d4 stock_valuation_xlsx: fix crash with using depreciation rules 2021-11-15 16:20:59 +01:00
Alexis de Lattre
49226e814c stock_valuation_xlsx: add depreciation ratios 2021-09-26 23:39:07 +02:00
Benoit
d05b75dbe4 fix migraiton of mail_usability 2021-09-13 21:56:42 +02:00
Chafique
8449c3de80 [FIX] remove notify_email option in README.rst 2021-09-13 21:56:42 +02:00
Chafique
f752fbc9f3 [12.0][MIG] mail_usability 2021-09-13 21:56:42 +02:00
Alexis de Lattre
70d7cbdfda New module link_tracker_usability 2021-09-13 21:56:42 +02:00
Sébastien BEAU
ea4c6df7d6 [FIX] fix helper 2021-09-13 21:56:42 +02:00
Sébastien BEAU
b62f3a3570 [IMP] by default do not send an email when user_id is fill on object 2021-09-13 21:56:42 +02:00
Sébastien BEAU
39855d7b12 [REF] refactor the code in order to split it in several file 2021-09-13 21:56:42 +02:00
Sébastien BEAU
e644b27b7a [IMP] add record_id on mail.message to be able to access to the record 2021-09-13 21:56:42 +02:00
Sébastien BEAU
39bee6e5f7 [IMP] add some extra style css support and add a debugger mode. Update readme 2021-09-13 21:56:42 +02:00
Sébastien BEAU
aec5bb9c91 [IMP] remove the fucking auto_delete!!! 2021-09-13 21:56:42 +02:00
Sébastien BEAU
0f35f8e92b [REF] refactor the code to make it simplifier and avoid hacking the _notify method 2021-09-13 21:56:42 +02:00
Sébastien BEAU
7f64d3c33e [IMP] add readme, remove auto following when sending an email, use light version of email notification to avoid injecting useless link in the mail sent 2021-09-13 21:56:42 +02:00
Sébastien BEAU
b26b3de7ae [IMP] improve the wizard for testing email, allow to search on object and to send email for real check 2021-09-13 21:56:42 +02:00
David Beal
c3f4775a58 UPD Branding 2021-09-13 21:56:42 +02:00
Alexis de Lattre
d34f273fdb mail_usability: add intermediary level to notify_email parameter of res.partner 2021-09-13 21:56:42 +02:00
Alexis de Lattre
1a8588ea24 Port mail_usability to v10 2021-09-13 21:56:42 +02:00
David Beal
453b6ba626 IMP add icons 2021-09-13 21:56:42 +02:00
Alexis de Lattre
6dbbb98774 Mass rename from __openerp__.py to __manifest__.py 2021-09-13 21:56:42 +02:00
Alexis de Lattre
81b78b83ce Set all modules as uninstallable 2021-09-13 21:56:42 +02:00
Benoit
bb4e5d377c [ADD] mail_usability module for improvements on mails 2021-09-13 21:56:42 +02:00
Alexis de Lattre
8da01d0665 Add script to fix old rounding data bug 2021-09-13 21:50:21 +02:00
Alexis de Lattre
9a67836c50 Improve stock inventory tree view 2021-07-20 13:07:36 +02:00
Alexis de Lattre
8e01d32fe6 Add tracking on some fields 2021-07-20 12:23:41 +02:00
Alexis de Lattre
25a177eb76 Add module sale_mrp_usability (backport of a feature of v14) 2021-05-27 23:58:03 +02:00
Alexis de Lattre
dbbd14f58a sale_down_payment: add a hook that can be used for notifications 2021-05-27 23:08:17 +02:00
Raphaël Valyi
592a82a417 fix message_post v12 API in unreserve (#145)
* fix message_post v12 API in unreserve

* import missing UserError
2021-05-12 20:16:19 +02:00
Pierrick Brun (Akretion)
e56654058e Merge pull request #116 from akretion/12.0-fix_account_type_liquidity_for_stripe
[12.0][FIX] account_usability - Fix stripe installation issue due to wrong account_type on transfert …
2021-04-26 16:15:02 +02:00
Alexis de Lattre
9b89661545 Fix crash in sale_down_payment 2021-03-22 12:10:34 +01:00
Alexis de Lattre
97fe8b463d mrp_usability: add tracking on date fields 2021-03-13 00:24:04 +01:00
David Beal
93272fb571 Update menu_view.xml 2021-03-09 10:50:54 +01:00
Alexis de Lattre
872801fd29 stock_valuation_xlsx: add stock.variation.xlsx report (Up-port from v10)
Up-port from v10 other fixes and improvements up to 2021-02-26
2021-02-26 11:09:51 +01:00
Alexis de Lattre
09b73d1994 mrp_usability: remove readonly on location field 2021-01-29 21:55:26 +01:00
Alexis de Lattre
2fe0ad51c7 mrp_usability: add source and dest loc on stock.move.line form view of finished product 2021-01-29 21:54:23 +01:00
Alexis de Lattre
aa804e2dfd Add track_visibility='onchange' on all importants fields of mrp.bom 2021-01-13 15:19:29 +01:00
Alexis de Lattre
05ac567c7a Show location_id in tree view of stock.move.line in raw materials tab 2021-01-11 19:01:24 +01:00
Alexis de Lattre
4076946f48 mrp_usability: add location_dest_id in the tree view of finished product on MO 2020-12-04 18:29:54 +01:00
Alexis de Lattre
2a3ca2d35c sale_usability: up-port warning on price update when qty is changed 2020-12-04 10:49:35 +01:00
Alexis de Lattre
614c1a7ac2 Remove dead file 2020-12-02 20:59:41 +01:00
Alexis de Lattre
03a57798b6 Add drill-through on purchase.report 2020-11-27 10:05:36 +01:00
Florian da Costa
22e9234d23 [FIX] Import failure if element is not part of the domain 2020-11-25 15:44:13 +01:00
Alexis de Lattre
ac89271d5b mrp_average_cost: Remove ACL that depend on sales_team (this module doesn't
depend on sales_team)
2020-11-15 14:36:10 +01:00
Alexis de Lattre
261442d903 Work it work with mrp_subcontracting (without depending on it) 2020-11-12 18:21:04 +01:00
Alexis de Lattre
d63c4b2433 [FIX] stock_valuation_xlsx: bad context key for past stock level 2020-11-03 17:24:36 +01:00
Florian
4dadc8047e Merge pull request #132 from akretion/12-account-fiscal-pos-pay-receivable
12 account fiscal pos pay receivable
2020-11-02 11:54:23 +01:00
Florian da Costa
34ec0dfa27 Black on account_fiscal_position_payable_receivable 2020-11-02 11:33:07 +01:00
Florian da Costa
7a6600431c Migrate account_fiscal_position_payable_receivable to v12 2020-11-02 11:32:38 +01:00
Alexis de Lattre
341717b75d Port account_fiscal_position_payable_receivable to v10 2020-11-02 11:25:52 +01:00
Raphaël Valyi
1061111f9b Merge pull request #130 from akretion/12.0-remove_oe_title_width
[FIX] Remove hard-coded width on product's title
2020-10-31 21:58:41 -03:00
Alexis de Lattre
d28a40e035 Update comment 2020-10-31 17:50:54 +01:00
clementmbr
3f06231c22 [FIX] Remove hard-coded width on product's title 2020-10-20 21:16:37 -03:00
Alexis de Lattre
67d31f9658 Display advanced fields in stock move form views 2020-10-13 17:22:34 +02:00
Alexis de Lattre
1b931d066b stock_usability: add tracking on is_locked field of pickings 2020-10-13 10:07:36 +02:00
David Beal
f605b56a5e FIX mrp_usability: define sold out in bottom page 2020-10-06 16:28:43 +02:00
David Beal
58f01d9673 FIX mrp_usability: round rupture value 2020-10-02 18:23:46 +02:00
David Beal
8878ab5bd1 IMP mrp_usability: define stock move in rupture 2020-10-02 18:13:59 +02:00
Alexis de Lattre
80f5341da0 [FIX] stock_valuation_xlsx: fix report when categ_subtotal is false 2020-09-25 23:57:56 +02:00
Alexis de Lattre
a4ca584e90 stock_valuation_xlsx: Add ability to force cost price to current
Improve headers in XLSX
Improve code
2020-09-25 22:51:39 +02:00
Alexis de Lattre
4d81dee7b4 stock_valuation_xlsx: Replace the right menu 2020-09-25 16:28:24 +02:00
Alexis de Lattre
140217da6e Port module stock_valuation_xlsx from v10 to v12 2020-09-25 16:16:14 +02:00
Sébastien BEAU
a9a0a2a999 [IMP] add module for hiding unwanted feature 2020-09-17 01:03:53 +02:00
Alexis de Lattre
d7f3a70d48 mrp_average_cost: improve code perf 2020-09-11 15:34:29 +02:00
Alexis de Lattre
1074fcba21 Show property_cost_method on product form view 2020-09-11 14:33:05 +02:00
beau sebastien
0ae76be885 Merge pull request #126 from akretion/12.0-MIG-product_no_translation
12.0 mig product no translation
2020-08-20 22:47:33 +02:00
Sébastien BEAU
59cdcbd173 [MIG] migrate product_no_tranlation 2020-08-20 22:44:21 +02:00
david.beal@akretion.com
7cf224cf23 [IMP] icon translation 2020-08-20 22:30:11 +02:00
Alexis de Lattre
d0d65ebbca product_no_translation : translate=False now on all fields declared in addons/product/product.py 2020-08-20 22:30:11 +02:00
Alexis de Lattre
ca10381be8 Add module product_no_translation 2020-08-20 22:30:11 +02:00
clementmbr
44b19dfe60 Merge pull request #124 from akretion/12.0-imp-button-prod-to-bom
[IMP] mrp_usability: improve smart button from products to BoMs
2020-08-05 16:04:24 -03:00
clementmbr
c082baa340 [IMP] mrp_usability: improve smart button from products to BoMs 2020-08-05 14:33:07 -03:00
Alexis de Lattre
15ee1b2f59 Up-port hide_bank_statement_balance on journal from v10
Inherit balance_check on account.bank.statement
2020-06-25 15:51:04 +02:00
clementmbr
b080dd11ab Merge pull request #123 from akretion/12.0-base-usability-remove-oe-title-width
[FIX] Remove hard-coded oe_title class width
2020-06-19 13:26:49 -03:00
clementmbr
568e6b41ac [FIX] Remove hard-coded oe_title class width
I've noticed that this hard-coded `width: 650px` was more than 5 years
old.
Now some specific CSS modules exists like OCA `web_responsive`
or Openworx `backend_theme` that are doing this kind of job in a much
better way... And this kind of hard-code is blocking them, so it looks
better to remove it and use these modules for CSS purpose.
2020-06-18 19:50:55 -03:00
David Beal
0dee23aeba Merge pull request #121 from ACT-Brideco/12-stock_user_default_warehouse_mrp
[12.0][MIG] stock_user_default_warehouse_mrp
2020-06-03 10:12:43 +02:00
David Beal
c7d1e13d0d Merge pull request #120 from ACT-Brideco/12-stock_user_default_warehouse_purchase
[12.0][MIG] stock_user_default_warehouse_purchase
2020-06-03 10:08:07 +02:00
David Beal
e7fae291ee Merge pull request #122 from ACT-Brideco/12-stock_user_default_warehouse_sale
[12.0][MIG] stock_user_default_warehouse_sale
2020-06-03 10:06:20 +02:00
David Beal
bdfe0ce20a Merge pull request #119 from ACT-Brideco/12-stock_user_default_warehouse_base
[12.0][MIG] stock_user_default_warehouse_base
2020-06-03 09:36:28 +02:00
Daniel Luque
32eafedf04 Adds README to stock_user_default_warehouse_base
Also removes class reference in super()
2020-06-02 15:08:30 +02:00
Daniel Luque
ba78791ab1 Adds README to stock_user_default_warehouse_sale 2020-06-02 15:00:12 +02:00
Daniel Luque
946d169665 Adds README to stock_user_default_warehouse_mrp 2020-06-02 14:54:09 +02:00
Daniel Luque
cd51a6784f Adds README to stock_user_default_warehouse_purchase 2020-06-02 14:45:36 +02:00
Alexis de Lattre
c01942b1a8 Add module service_line_qty_update_sale 2020-05-29 23:49:04 +02:00
Alexis de Lattre
e11b29deab Improve view 2020-05-29 23:23:27 +02:00
Alexis de Lattre
28be3e4e6a First working version of service_line_qty_update_* 2020-05-29 23:21:54 +02:00
Alexis de Lattre
5c7985a15c Add modules service_line_qty_update_base service_line_qty_update_purchase 2020-05-29 17:46:57 +02:00
Alexis de Lattre
9b6c34a860 Migrate stock_user_default_warehouse_sale from 10.0 2020-05-28 16:22:41 +02:00
Alexis de Lattre
f735f8a34d Migrate stock_user_default_warehouse_purchase from 10.0 2020-05-28 16:21:06 +02:00
Alexis de Lattre
74665bb2e8 Migrate stock_user_default_warehouse_mrp from 10.0 2020-05-28 15:33:38 +02:00
Alexis de Lattre
d1deeeac31 Migrate stock_user_default_warehouse_base from 10.0 2020-05-28 15:29:16 +02:00
hparfr
d2b63236e3 Fix stripe installation issue due to wrong account_type on transfert account
template
2020-04-29 23:00:08 +02:00
157 changed files with 5872 additions and 269 deletions

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,23 @@
# © 2016-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Fiscal Position Payable Receivable",
"version": "12.0.1.0.0",
"category": "Accounting & Finance",
"license": "AGPL-3",
"summary": "Configure payable/receivable accounts on fiscal positions",
"description": """
Account Fiscal Position Payable Receivable
==========================================
This module allows to configure a special *Partner Receivable Account* and a special *Partner Payable Account* on fiscal positions. This is used in the onchange of the fiscal position of partners.
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
""",
"author": "Akretion",
"website": "http://www.akretion.com",
"depends": ["account"],
"data": ["views/account_fiscal_position_view.xml"],
"installable": True,
}

View File

@@ -0,0 +1,2 @@
from . import account_fiscal_position
from . import res_partner

View File

@@ -0,0 +1,21 @@
# © 2016-2017 Akretion (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 AccountFiscalPosition(models.Model):
_inherit = "account.fiscal.position"
receivable_account_id = fields.Many2one(
"account.account",
string="Partner Receivable Account",
company_dependent=True,
domain=[("internal_type", "=", "receivable")],
)
payable_account_id = fields.Many2one(
"account.account",
string="Partner Payable Account",
company_dependent=True,
domain=[("internal_type", "=", "payable")],
)

View File

@@ -0,0 +1,25 @@
# © 2016-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api
class ResPartner(models.Model):
_inherit = "res.partner"
@api.onchange("property_account_position_id")
def fiscal_position_receivable_payable_change(self):
fp = self.property_account_position_id
ipo = self.env["ir.property"]
if fp.receivable_account_id:
self.property_account_receivable_id = fp.receivable_account_id
else:
self.property_account_receivable_id = ipo.get(
"property_account_receivable_id", "res.partner"
)
if fp.payable_account_id:
self.property_account_payable_id = fp.payable_account_id
else:
self.property_account_payable_id = ipo.get(
"property_account_payable_id", "res.partner"
)

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_account_position_form" model="ir.ui.view">
<field name="name">receivable_payable.fiscal_position_form</field>
<field name="model">account.fiscal.position</field>
<field name="inherit_id" ref="account.view_account_position_form" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<field name="receivable_account_id"/>
<field name="payable_account_id"/>
</field>
</field>
</record>
</odoo>

View File

@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api, _
from odoo.tools import float_compare, float_is_zero
from odoo.tools import float_compare, float_is_zero, float_round
from odoo.tools.misc import formatLang
from odoo.exceptions import UserError, ValidationError
from odoo.osv import expression
@@ -83,7 +83,7 @@ class AccountInvoice(models.Model):
# top of the screen
# That's why we have to cut the name_get() when it's too long
def name_get(self):
old_res = super(AccountInvoice, self).name_get()
old_res = super().name_get()
res = []
for old_re in old_res:
name = old_re[1]
@@ -103,9 +103,8 @@ class AccountInvoice(models.Model):
# 2) the 'name' field of the account.move.line is used in the overdue
# letter, and '/' is not meaningful for our customer !
# TODO mig to v12
# @api.multi
# def action_move_create(self):
# res = super(AccountInvoice, self).action_move_create()
# res = super().action_move_create()
# for inv in self:
# self._cr.execute(
# "UPDATE account_move_line SET name= "
@@ -216,7 +215,15 @@ class AccountInvoiceLine(models.Model):
class AccountJournal(models.Model):
_inherit = 'account.journal'
@api.multi
hide_bank_statement_balance = fields.Boolean(
string='Hide Bank Statement Balance',
help="You may want to enable this option when your bank "
"journal is generated from a bank statement file that "
"doesn't handle start/end balance (QIF for instance) and "
"you don't want to enter the start/end balance manually: it "
"will prevent the display of wrong information in the accounting "
"dashboard and on bank statements.")
@api.depends(
'name', 'currency_id', 'company_id', 'company_id.currency_id', 'code')
def name_get(self):
@@ -262,7 +269,6 @@ class AccountJournal(models.Model):
class AccountAccount(models.Model):
_inherit = 'account.account'
@api.multi
@api.depends('name', 'code')
def name_get(self):
if self._context.get('account_account_show_code_only'):
@@ -271,7 +277,7 @@ class AccountAccount(models.Model):
res.append((record.id, record.code))
return res
else:
return super(AccountAccount, self).name_get()
return super().name_get()
# https://github.com/odoo/odoo/issues/23040
# TODO mig to v12
@@ -312,7 +318,6 @@ class AccountAccount(models.Model):
logger.info("END of the script 'fix bank and cash account types'")
return True
# TODO mig to v12
@api.model
def create_account_groups(self, level=2, name_prefix=u'Comptes '):
'''Should be launched by a script. Make sure the account_group module is installed
@@ -354,7 +359,6 @@ class AccountAccount(models.Model):
class AccountAnalyticAccount(models.Model):
_inherit = 'account.analytic.account'
@api.multi
def name_get(self):
if self._context.get('analytic_account_show_code_only'):
res = []
@@ -362,7 +366,7 @@ class AccountAnalyticAccount(models.Model):
res.append((record.id, record.code or record.name))
return res
else:
return super(AccountAnalyticAccount, self).name_get()
return super().name_get()
_sql_constraints = [(
'code_company_unique',
@@ -403,6 +407,58 @@ class AccountMove(models.Model):
move.default_credit = default_credit
move.default_debit = default_debit
@api.model
def _fix_debit_credit_round_bug(self):
logger.info('START script _fix_debit_credit_round_bug')
moves = self.sudo().search([]) # sudo to search in all companies
bug_move_ids = []
for move in moves:
buggy = False
for l in move.line_ids:
if not float_is_zero(l.debit, precision_digits=2):
debit_rounded = float_round(l.debit, precision_digits=2)
if float_compare(l.debit, debit_rounded, precision_digits=6):
logger.info('Bad move to fix ID %d company_id %d name %s ref %s date %s journal %s (line ID %d debit=%s)', move.id, move.company_id.id, move.name, move.ref, move.date, move.journal_id.code, l.id, l.debit)
buggy = True
break
else:
credit_rounded = float_round(l.credit, precision_digits=2)
if float_compare(l.credit, credit_rounded, precision_digits=6):
logger.info('Bad move to fix ID %d company_id %d name %s ref %s date %s journal %s (line ID %d credit=%s)', move.id, move.company_id.id, move.name, move.ref, move.date, move.journal_id.code, l.id, l.credit)
buggy = True
break
if buggy:
bug_move_ids.append(move.id)
bal = 0.0
max_credit = (False, 0)
for l in move.line_ids:
if not float_is_zero(l.debit, precision_digits=2):
new_debit = float_round(l.debit, precision_digits=2)
self._cr.execute(
'UPDATE account_move_line set debit=%s, balance=%s where id=%s',
(new_debit, new_debit, l.id))
bal -= new_debit
elif not float_is_zero(l.credit, precision_digits=2):
new_credit = float_round(l.credit, precision_digits=2)
self._cr.execute(
'UPDATE account_move_line set credit=%s, balance=%s where id=%s',
(new_credit, new_credit * -1, l.id))
bal += new_credit
if new_credit > max_credit[1]:
max_credit = (l, new_credit)
if not float_is_zero(bal, precision_digits=2):
assert abs(bal) < 0.05
l = max_credit[0]
new_credit = max_credit[1]
new_new_credit = float_round(new_credit - bal, precision_digits=2)
assert new_new_credit > 0
self._cr.execute(
'UPDATE account_move_line set credit=%s, balance=%s where id=%s',
(new_new_credit, new_new_credit * -1, l.id))
logger.info('Move ID %d fixed', move.id)
logger.info('%d buggy moves fixed (IDs: %s)', len(bug_move_ids), bug_move_ids)
logger.info('END _fix_debit_credit_round_bug')
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
@@ -509,8 +565,9 @@ class AccountBankStatement(models.Model):
end_date = fields.Date(
compute='_compute_dates', string='End Date', readonly=True,
store=True)
hide_bank_statement_balance = fields.Boolean(
related='journal_id.hide_bank_statement_balance', readonly=True)
@api.multi
@api.depends('line_ids.date')
def _compute_dates(self):
for st in self:
@@ -518,7 +575,14 @@ class AccountBankStatement(models.Model):
st.start_date = dates and min(dates) or False
st.end_date = dates and max(dates) or False
@api.multi
def _balance_check(self):
for stmt in self:
if stmt.hide_bank_statement_balance:
continue
else:
super(AccountBankStatement, stmt)._balance_check()
return True
@api.depends('name', 'start_date', 'end_date')
def name_get(self):
res = []
@@ -556,15 +620,14 @@ class AccountBankStatementLine(models.Model):
# search_reconciliation_proposition=False, context=None):
# # Make variable name shorted for PEP8 !
# search_rec_prop = search_reconciliation_proposition
# return super(AccountBankStatementLine, self).\
# return super().\
# get_data_for_reconciliations(
# cr, uid, ids, excluded_ids=excluded_ids,
# search_reconciliation_proposition=search_rec_prop,
# context=context)
def _prepare_reconciliation_move(self, move_ref):
vals = super(AccountBankStatementLine, self).\
_prepare_reconciliation_move(move_ref)
vals = super()._prepare_reconciliation_move(move_ref)
# By default, ref contains the name of the statement + name of the
# statement line. It causes 2 problems:
# 1) The 'ref' field is too big
@@ -661,6 +724,16 @@ class AccountIncoterms(models.Model):
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 AccountReconciliation(models.AbstractModel):
_inherit = 'account.reconciliation.widget'
@@ -669,8 +742,7 @@ class AccountReconciliation(models.AbstractModel):
# bank statement
@api.model
def _domain_move_lines(self, search_str):
str_domain = super(AccountReconciliation, self)._domain_move_lines(
search_str)
str_domain = super()._domain_move_lines(search_str)
account_code_domain = [('account_id.code', '=ilike', search_str + '%')]
str_domain = expression.OR([str_domain, account_code_domain])
return str_domain
@@ -683,8 +755,9 @@ class AccountReconciliation(models.AbstractModel):
st_line, aml_accounts, partner_id,
excluded_ids=excluded_ids, search_str=search_str)
# We want to replace a domain item by another one
position = domain.index(('payment_id', '<>', False))
domain[position] = ['journal_id', '=', st_line.journal_id.id]
if ('payment_id', '<>', False) in domain:
position = domain.index(('payment_id', '<>', False))
domain[position] = ['journal_id', '=', st_line.journal_id.id]
return domain
@@ -693,3 +766,22 @@ class ResConfigSettings(models.TransientModel):
transfer_account_id = fields.Many2one(
related='company_id.transfer_account_id', readonly=False)
class AccountChartTemplate(models.Model):
_inherit = "account.chart.template"
@api.model
def _prepare_transfer_account_template(self):
"""Change the type of default account in order to be
compliant with _check_account_type_on_bank_journal
Used at installation of payment modules like stripe
See https://github.com/akretion/odoo-usability/issues/115
"""
vals = super()._prepare_transfer_account_template()
current_assets_type = self.env.ref(
'account.data_account_type_liquidity', raise_if_not_found=False)
vals.update({
'user_type_id': current_assets_type and current_assets_type.id or False,
})
return vals

View File

@@ -409,6 +409,31 @@ module -->
</field>
</record>
<record id="view_account_journal_form" model="ir.ui.view">
<field name="name">usability.account.journal.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="bank_statements_source" position="after">
<field name="hide_bank_statement_balance" groups="account.group_account_user"/>
</field>
</field>
</record>
<record id="account_journal_dashboard_kanban_view" model="ir.ui.view">
<field name="name">usability.account.journal.dashboard</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.account_journal_dashboard_kanban_view"/>
<field name="arch" type="xml">
<field name="kanban_dashboard" position="after">
<field name="hide_bank_statement_balance"/>
</field>
<xpath expr="//div[@name='latest_statement']/.." position="attributes">
<attribute name="t-if">dashboard.last_balance != dashboard.account_balance &amp;&amp; !record.hide_bank_statement_balance.raw_value</attribute>
</xpath>
</field>
</record>
<record id="view_account_journal_tree" model="ir.ui.view">
<field name="name">usability.account.journal.tree</field>
<field name="model">account.journal</field>
@@ -447,10 +472,26 @@ module -->
<field name="date" position="after">
<field name="start_date"/>
<field name="end_date"/>
<field name="hide_bank_statement_balance" invisible="1"/>
</field>
<field name="date" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<label for="balance_start" position="attributes">
<attribute name="attrs">{'invisible': [('hide_bank_statement_balance', '=', True)]}</attribute>
</label>
<label for="balance_end_real" position="attributes">
<attribute name="attrs">{'invisible': [('hide_bank_statement_balance', '=', True)]}</attribute>
</label>
<xpath expr="//field[@name='balance_start']/.." position="attributes">
<attribute name="attrs">{'invisible': [('hide_bank_statement_balance', '=', True)]}</attribute>
</xpath>
<xpath expr="//field[@name='balance_end_real']/.." position="attributes">
<attribute name="attrs">{'invisible': [('hide_bank_statement_balance', '=', True)]}</attribute>
</xpath>
<group name="sale_total" position="attributes">
<attribute name="attrs">{'invisible': [('hide_bank_statement_balance', '=', True)]}</attribute>
</group>
</field>
</record>

View File

@@ -31,6 +31,7 @@ This modules adds the following functions:
* don't attach PDF upon invoice report generation on supplier invoices/refunds
* Add filter on debit and credit amount for Move Lines
* Add supplier invoice number in invoice tree view
* Change type from current_assets to liquidity for transfert account template.
Together with this module, I recommend the use of the following modules:

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,62 @@
# Copyright 2020-2022 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': '12.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,
}

View File

@@ -0,0 +1 @@
from . import dynamic_list

View File

@@ -0,0 +1,115 @@
# Copyright 2020-2022 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)

View File

@@ -0,0 +1,9 @@
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 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_dynamic_list_read Read access on dynamic.list to employees model_dynamic_list base.group_user 1 0 0 0
3 access_dynamic_list_full Full access to dynamic.list to System group model_dynamic_list base.group_system 1 1 1 1
4 access_dynamic_list_translate_read Read access on dynamic.list.translate to employees model_dynamic_list_translate base.group_user 1 0 0 0
5 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
6 access_dynamic_list_code_read Read access on dynamic.list.code to employees model_dynamic_list_code base.group_user 1 0 0 0
7 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
8 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
9 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

View File

@@ -0,0 +1,240 @@
<?xml version="1.0" encoding="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).
-->
<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>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<group name="main">
<field name="name"/>
<field name="domain" invisible="not context.get('dynamic_list_main_view')"/>
</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>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<group name="main">
<field name="name"/>
<field name="domain" invisible="not context.get('dynamic_list_translate_main_view')"/>
</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>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<group name="main">
<field name="code"/>
<field name="name"/>
<field name="domain" invisible="not context.get('dynamic_list_code_main_view')"/>
</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>
<div class="oe_button_box" name="button_box">
<button name="toggle_active" type="object"
class="oe_stat_button" icon="fa-archive">
<field name="active" widget="boolean_button"
options='{"terminology": "archive"}'/>
</button>
</div>
<group name="main">
<field name="code"/>
<field name="name"/>
<field name="domain" invisible="not context.get('dynamic_list_code_translate_main_view')"/>
</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>

View File

@@ -23,12 +23,9 @@ class ResUsers(models.Model):
@api.model
def _script_partners_linked_to_users_no_company(self):
if self.env.user.id != SUPERUSER_ID:
raise UserError(_('You must run this script as admin user'))
logger.info(
'START to set company_id=False on partners related to users')
users = self.search(
['|', ('active', '=', True), ('active', '=', False)])
users = self.sudo().with_context(active_test=False).search([])
for user in users:
if user.partner_id.company_id:
user.partner_id.company_id = False
@@ -37,4 +34,3 @@ class ResUsers(models.Model):
user.login, user.id)
logger.info(
'END setting company_id=False on partners related to users')
return True

View File

@@ -12,10 +12,6 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<!-- Wider 'name' field -->
<xpath expr="//sheet/div[hasclass('oe_title')]" position="attributes">
<attribute name="style">width: 650px;</attribute>
</xpath>
<xpath expr="//field[@name='child_ids']/form//field[@name='email']" position="attributes">
<attribute name="widget">email</attribute>
</xpath>

View File

@@ -2,7 +2,7 @@
<odoo>
<menuitem id="conf_tech" parent="base.menu_administration" name="🧰" groups="base.group_erp_manager" sequence="100"/>
<menuitem id="conf_tech" parent="base.menu_administration" name="🧰" groups="base.group_erp_manager" sequence="1"/>
<menuitem id="model" name="Model" parent="conf_tech" action="base.action_model_model" sequence="10"/>
<menuitem id="view" name="View" parent="conf_tech" action="base.action_ui_view" sequence="20" />
<menuitem id="rec_rule" name="Record Rule" parent="conf_tech" action="base.action_rule" sequence="30" />

19
mail_usability/README.rst Normal file
View File

@@ -0,0 +1,19 @@
# Mail Usability
Take back the control on your email
## Feature
- do not follow automatically a object when sending an email
- better email preview, allow to select between the whole database object and not only the last 10
- use a light template version for notification without link (link should be explicit)
- add some additional style in the white list when santizing html field (see tools.py)
- make the email template by default not 'auto_delete'
## TIPS
Never, never tick the 'auto_delete' on mail template because it fucking hard to debug
and understand what have been sent (we should create a module with a crontask, that drop them latter)
If the template of mail do not look like the same when saving it in odoo, maybe the sanitize style have drop some balise
please run odoo with "LOG_STYLE_SANITIZE=True odoo" to understand what have been drop, magic warning logger will tell you everthing

View File

@@ -0,0 +1,2 @@
from . import models
from . import wizard

View File

@@ -0,0 +1,33 @@
# Copyright 2020 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': '12.0.1.0.0',
'category': 'Base',
'license': 'AGPL-3',
'summary': 'Usability improvements on mails',
'description': """
Mail Usability
==============
Small usability improvements on mails:
* remove link in mail footer
* remove 'sent by' in notification footer
* add a new entry *All Messages Except Notifications* to the field *Receive Inbox Notifications by Email* of partners (becomes the default value)
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['mail'],
'data': [
'views/mail_view.xml',
'data/mail_data.xml',
'wizard/email_template_preview_view.xml',
],
'installable': True,
}

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo noupdate="1">
<!--Default Notification Email template -->
<record id="mail_template_notification" model="mail.template">
<field name="name">Notification Email</field>
<field name="subject">${object.subject}</field>
<field name="model_id" ref="mail.model_mail_message"/>
<field name="auto_delete" eval="True"/>
<field name="body_html">${object.body | safe}</field>
</record>
<template id="message_notification_email_usability">
<div t-raw="message.body"/>
</template>
</odoo>

View File

@@ -0,0 +1,5 @@
from . import mail
from . import tools
from . import mail_template
from . import mail_message
from . import res_partner

View File

@@ -0,0 +1,36 @@
# Copyright 2016-2017 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, api
import logging
_logger = logging.getLogger(__name__)
class MailThread(models.AbstractModel):
_inherit = 'mail.thread'
def _active_message_auto_subscribe_notify(self):
_logger.debug('Skip automatic subscribe notification')
return False
def _message_auto_subscribe_notify(self, partner_ids, template):
if self._active_message_auto_subscribe_notify():
return super(MailThread, self)._message_auto_subscribe_notify(
partner_ids, template)
else:
return True
@api.multi
@api.returns('self', lambda value: value.id)
def message_post(self, body='', subject=None, message_type='notification',
subtype=None, parent_id=False, attachments=None,
content_subtype='html', **kwargs):
if not 'mail_create_nosubscribe' in self._context:
# Do not implicitly follow an object by just sending a message
self = self.with_context(mail_create_nosubscribe=True)
return super(MailThread, self).message_post(
body=body, subject=subject, message_type=message_type,
subtype=subtype, parent_id=parent_id, attachments=attachments,
content_subtype=content_subtype, **kwargs)

View File

@@ -0,0 +1,19 @@
# Copyright 2019 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 models
class MailMessage(models.Model):
_inherit = 'mail.message'
@property
def record_id(self):
# we do not use a reference field here as mail message
# are used everywhere and many model are not yet loaded
# so odoo raise exception
if self:
self.ensure_one()
return self.env[self.model].browse(self.res_id)
return None

View File

@@ -0,0 +1,11 @@
# Copyright 2018 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 openerp import fields, models
class MailTemplate(models.Model):
_inherit = 'mail.template'
auto_delete = fields.Boolean(default=False)

View File

@@ -0,0 +1,27 @@
# Copyright 2016-2019 Akretion France (http://www.akretion.com)
# @author Sébastien BEAU <sebastien.beau@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 ResPartner(models.Model):
_inherit = 'res.partner'
opt_out = fields.Boolean(track_visibility='onchange')
@api.model
def _notify(self, message, rdata, record, force_send=False,
send_after_commit=True, model_description=False,
mail_auto_delete=True):
# use an empty layout for notification by default
if not message.layout:
message.layout = 'mail_usability.message_notification_email_usability'
# Never auto delete notification email
# fucking to hard to debug when message have been delete
mail_auto_delete = False
return super(ResPartner, self)._notify(
message=message, rdata=rdata, record=record,
force_send=force_send, send_after_commit=send_after_commit,
model_description=model_description, mail_auto_delete=mail_auto_delete)

View File

@@ -0,0 +1,43 @@
# Copyright 2018 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.tools.mail import _Cleaner
import os
import logging
_logger = logging.getLogger(__name__)
_Cleaner._style_whitelist += [
'word-wrap',
'display'
'border-top',
'border-bottom',
'border-left',
'border-right',
'text-transform',
]
if os.getenv('LOG_STYLE_SANITIZE'):
# Monkey patch the parse style method to debug
# the missing style
def parse_style(self, el):
attributes = el.attrib
styling = attributes.get('style')
if styling:
valid_styles = {}
styles = self._style_re.findall(styling)
for style in styles:
if style[0].lower() in self._style_whitelist:
valid_styles[style[0].lower()] = style[1]
# START HACK
else:
_logger.warning('Remove style %s %s', *style)
# END HACK
if valid_styles:
el.attrib['style'] = '; '.join(
'%s:%s' % (key, val)
for (key, val) in valid_styles.iteritems())
else:
del el.attrib['style']
_Cleaner.parse_style = parse_style

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_mail_tree" model="ir.ui.view">
<field name="model">mail.mail</field>
<field name="inherit_id" ref="mail.view_mail_tree"/>
<field name="arch" type="xml">
<field name="email_from" position="replace"/>
<field name="date" position="after">
<field name="email_from"/>
<field name="email_to"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
from . import email_template_preview

View File

@@ -0,0 +1,43 @@
# Copyright 2019 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 openerp import api, fields, models
class TemplatePreview(models.TransientModel):
_inherit = "email_template.preview"
res_id = fields.Integer(compute='_compute_res_id')
object_id = fields.Reference(selection='_reference_models')
@api.model
def default_get(self, fields):
result = super(TemplatePreview, self).default_get(fields)
if result.get('model_id'):
model = self.env['ir.model'].browse(result['model_id'])
result['object_id'] = model.model
return result
def _reference_models(self):
result = self.default_get(['model_id'])
if result.get('model_id'):
model = self.env['ir.model'].browse(result['model_id'])
return [(model.model, model.name)]
else:
ir_models = self.env['ir.model'].search([('state', '!=', 'manual')])
return [(ir_model.model, ir_model.name)
for ir_model in ir_models
if not ir_model.model.startswith('ir.')]
@api.depends('object_id')
def _compute_res_id(self):
for record in self:
if self.object_id:
record.res_id = self.object_id.id
def send(self):
template = self.env['mail.template'].browse(
self._context['template_id'])
template.send_mail(
self.res_id, force_send=True, raise_exception=True)

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="email_template_preview_form" model="ir.ui.view">
<field name="model">email_template.preview</field>
<field name="inherit_id" ref="mail.email_template_preview_form"/>
<field name="arch" type="xml">
<field name="res_id" position="attributes">
<attribute name="invisible">True</attribute>
</field>
<field name="res_id" position="after">
<field name="object_id"/>
</field>
<footer position="inside">
<button
string="Send"
name="send"
class="btn-primary"
type='object'/>
</footer>
</field>
</record>
</odoo>

View File

@@ -17,7 +17,7 @@ class MrpBomLabourLine(models.Model):
bom_id = fields.Many2one(
comodel_name='mrp.bom',
string='Labour Lines',
string='Bill of Material',
ondelete='cascade')
labour_time = fields.Float(
@@ -75,7 +75,7 @@ class MrpBom(models.Model):
total_labour_cost = fields.Float(
compute='_compute_total_labour_cost', readonly=True,
digits=dp.get_precision('Product Price'),
string="Total Labour Cost", store=True)
string="Total Labour Cost", store=True, track_visibility='onchange')
extra_cost = fields.Float(
string='Extra Cost', track_visibility='onchange',
digits=dp.get_precision('Product Price'),
@@ -117,15 +117,18 @@ class MrpBom(models.Model):
wproduct = bom.product_id
if not wproduct:
wproduct = bom.product_tmpl_id
bom_cost_per_unit_in_product_uom = 0
qty_product_uom = bom.product_uom_id._compute_quantity(bom.product_qty, wproduct.uom_id)
if qty_product_uom:
bom_cost_per_unit_in_product_uom = bom.total_cost / qty_product_uom
if float_compare(
wproduct.standard_price, bom.total_cost,
wproduct.standard_price, bom_cost_per_unit_in_product_uom,
precision_digits=precision):
wproduct.with_context().write(
{'standard_price': bom.total_cost})
{'standard_price': bom_cost_per_unit_in_product_uom})
logger.info(
'Cost price updated to %s on product %s',
bom.total_cost, wproduct.display_name)
return True
bom_cost_per_unit_in_product_uom, wproduct.display_name)
class MrpBomLine(models.Model):
@@ -196,6 +199,7 @@ class MrpProduction(models.Model):
mo_total_price = 0.0 # In the UoM of the M0
labor_cost_per_unit = 0.0 # In the UoM of the product
extra_cost_per_unit = 0.0 # In the UoM of the product
subcontract_cost_per_unit = 0.0
# I read the raw materials MO, not on BOM, in order to make
# it work with the "dynamic" BOMs (few raw material are auto-added
# on the fly on MO)
@@ -231,6 +235,13 @@ class MrpProduction(models.Model):
assert bom_qty_product_uom > 0, 'BoM qty should be positive'
labor_cost_per_unit = bom.total_labour_cost / bom_qty_product_uom
extra_cost_per_unit = bom.extra_cost / bom_qty_product_uom
if bom.type == 'subcontract':
one_finished_move = self.env['stock.move'].search([
('production_id', '=', self.id),
('product_id', '=', self.product_id.id),
('move_dest_ids', '!=', False)], limit=1)
if one_finished_move:
subcontract_cost_per_unit = one_finished_move.move_dest_ids[0].price_unit
# mo_standard_price and labor_cost_per_unit are
# in the UoM of the product (not of the MO/BOM)
mo_qty_product_uom = self.product_uom_id._compute_quantity(
@@ -238,10 +249,13 @@ class MrpProduction(models.Model):
assert mo_qty_product_uom > 0, 'MO qty should be positive'
mo_standard_price = mo_total_price / mo_qty_product_uom
logger.info(
'MO %s: labor_cost_per_unit=%s extra_cost_per_unit=%s',
self.name, labor_cost_per_unit, extra_cost_per_unit)
'MO %s: labor_cost_per_unit=%s extra_cost_per_unit=%s '
'subcontract_cost_per_unit=%s',
self.name, labor_cost_per_unit, extra_cost_per_unit,
subcontract_cost_per_unit)
mo_standard_price += labor_cost_per_unit
mo_standard_price += extra_cost_per_unit
mo_standard_price += subcontract_cost_per_unit
return mo_standard_price
def post_inventory(self):
@@ -252,9 +266,9 @@ class MrpProduction(models.Model):
for order in self:
if order.product_id.cost_method == 'average':
unit_cost = order.compute_order_unit_cost()
order.unit_cost = unit_cost
order.write({'unit_cost': unit_cost})
logger.info('MO %s: unit_cost=%s', order.name, unit_cost)
for finished_move in order.move_finished_ids.filtered(
lambda x: x.product_id == order.product_id):
finished_move.price_unit = unit_cost
order.move_finished_ids.filtered(
lambda x: x.product_id == order.product_id).write({
'price_unit': unit_cost})
return super(MrpProduction, self).post_inventory()

View File

@@ -1,9 +1,7 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_labour_cost_profile_read,Read access on labour.cost.profile to MRP user,model_labour_cost_profile,mrp.group_mrp_user,1,0,0,0
access_labour_cost_profile_read_sale,Read access on labour.cost.profile to Sale user,model_labour_cost_profile,sales_team.group_sale_salesman,1,0,0,0
access_labour_cost_profile_read_stock,Read access on labour.cost.profile to Stock user,model_labour_cost_profile,stock.group_stock_user,1,0,0,0
access_labour_cost_profile_full,Full access on labour.cost.profile to MRP manager,model_labour_cost_profile,mrp.group_mrp_manager,1,1,1,1
access_mrp_bom_labour_line_read,Read access on mrp.bom.labour.line to MRP user,model_mrp_bom_labour_line,mrp.group_mrp_user,1,0,0,0
access_mrp_bom_labour_line_read_sale,Read access on mrp.bom.labour.line to Sale user,model_mrp_bom_labour_line,sales_team.group_sale_salesman,1,0,0,0
access_mrp_bom_labour_line_read_stock,Read access on mrp.bom.labour.line to Stock user,model_mrp_bom_labour_line,stock.group_stock_user,1,0,0,0
access_mrp_bom_labour_line_full,Full access on mrp.bom.labour.line to MRP manager,model_mrp_bom_labour_line,mrp.group_mrp_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_labour_cost_profile_read Read access on labour.cost.profile to MRP user model_labour_cost_profile mrp.group_mrp_user 1 0 0 0
access_labour_cost_profile_read_sale Read access on labour.cost.profile to Sale user model_labour_cost_profile sales_team.group_sale_salesman 1 0 0 0
3 access_labour_cost_profile_read_stock Read access on labour.cost.profile to Stock user model_labour_cost_profile stock.group_stock_user 1 0 0 0
4 access_labour_cost_profile_full Full access on labour.cost.profile to MRP manager model_labour_cost_profile mrp.group_mrp_manager 1 1 1 1
5 access_mrp_bom_labour_line_read Read access on mrp.bom.labour.line to MRP user model_mrp_bom_labour_line mrp.group_mrp_user 1 0 0 0
access_mrp_bom_labour_line_read_sale Read access on mrp.bom.labour.line to Sale user model_mrp_bom_labour_line sales_team.group_sale_salesman 1 0 0 0
6 access_mrp_bom_labour_line_read_stock Read access on mrp.bom.labour.line to Stock user model_mrp_bom_labour_line stock.group_stock_user 1 0 0 0
7 access_mrp_bom_labour_line_full Full access on mrp.bom.labour.line to MRP manager model_mrp_bom_labour_line mrp.group_mrp_manager 1 1 1 1

View File

@@ -37,7 +37,7 @@
</group>
</page>
</notebook>
<xpath expr="//field[@name='bom_line_ids']/tree/field[@name='product_uom_id']" position="after">
<xpath expr="//field[@name='bom_line_ids']/tree/field[@name='operation_id']" position="after">
<field name="standard_price"/>
</xpath>
</field>

View File

@@ -31,6 +31,8 @@ Small usability improvements on MRP:
* complete Manufacturing Order report with unvailable products
* improve smart button from products to BoMs (display BoM form if only one instead of displaying a list of one)
**Table of contents**
.. contents::

View File

@@ -1 +1 @@
from . import mrp
from . import models

View File

@@ -13,7 +13,8 @@
'website': 'http://www.akretion.com',
'depends': ['mrp'],
'data': [
'mrp_view.xml',
'views/mrp_views.xml',
'views/product_views.xml',
'report/mrp_report.xml'
],
'installable': True,

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-16 13:56+0000\n"
"PO-Revision-Date: 2019-07-16 16:01+0200\n"
"POT-Creation-Date: 2020-10-06 13:37+0000\n"
"PO-Revision-Date: 2020-10-06 15:38+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -15,41 +15,52 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: fr\n"
"X-Generator: Poedit 2.0.6\n"
"X-Generator: Poedit 2.3\n"
#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.mrp_production_form_view
msgid "Are you sure you want to cancel this manufacturing order?"
msgstr "Etes vous sur de vouloir annuler cet ordre de production"
#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.product_template_form_view_bom_button
msgid "Bill of Materials"
msgstr "Nomenclature"
#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.report_mrporder
msgid "Lot"
msgstr ""
#. module: mrp_usability
#: model:ir.model,name:mrp_usability.model_product_product
#: model_terms:ir.ui.view,arch_db:mrp_usability.report_mrporder
msgid "Product"
msgstr "Article"
#. module: mrp_usability
#: model:ir.model,name:mrp_usability.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"
#. module: mrp_usability
#: model:ir.model,name:mrp_usability.model_mrp_production
msgid "Production Order"
msgstr "Ordre de production"
msgstr ""
#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.report_mrporder
msgid "Quantity"
msgstr "Quantité"
msgid "Sold Out Quantity"
msgstr "Quantité en Rupture"
#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.report_mrporder
msgid ""
"These products were unavailable (or partially) while edition of this Manufacturing Order.\n"
" Here is complete quantities for these."
" Here is missing quantities."
msgstr ""
"Les produits ci-dessous étaient indisponibles (complètement ou partiellement) lors de l'édition de l'OF.<br/>\n"
"Voici les quantités totales de ceux-ci."
"Voici les quantités manquantes."
#. module: mrp_usability
#: model_terms:ir.ui.view,arch_db:mrp_usability.view_mrp_bom_filter

View File

@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import mrp, product

View File

@@ -0,0 +1,37 @@
# 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 MrpProduction(models.Model):
_inherit = 'mrp.production'
_order = 'id desc'
date_planned_start = fields.Datetime(track_visibility='onchange')
date_planned_finished = fields.Datetime(track_visibility='onchange')
@api.model
def get_stock_move_sold_out_report(self, move):
lines = move.active_move_line_ids
qty_in_lots = sum([x.product_uom_qty for x in lines])
diff = round(move.product_qty - qty_in_lots, 3)
if diff == 0.0:
return ""
return diff
class MrpBom(models.Model):
_inherit = 'mrp.bom'
code = fields.Char(track_visibility='onchange')
type = fields.Selection(track_visibility='onchange')
product_tmpl_id = fields.Many2one(track_visibility='onchange')
product_id = fields.Many2one(track_visibility='onchange')
product_qty = fields.Float(track_visibility='onchange')
product_uom_id = fields.Many2one(track_visibility='onchange')
routing_id = fields.Many2one(track_visibility='onchange')
ready_to_produce = fields.Selection(track_visibility='onchange')
picking_type_id = fields.Many2one(track_visibility='onchange')

View File

@@ -0,0 +1,44 @@
# Copyright (C) 2020 - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models
class ProductTemplate(models.Model):
_inherit = "product.template"
def action_view_bom(self):
"""Replace native action `template_open_bom` to distinguish if we will display
only one BoM form or a list of BoMs."""
self.ensure_one()
act_window_xml_id = "mrp.mrp_bom_form_action"
act_window = self.env.ref(act_window_xml_id).read()[0]
if self.bom_count > 1:
act_window["context"] = {
"default_product_tmpl_id": self.id,
"search_default_product_tmpl_id": self.id,
}
else:
act_window["context"] = {"default_product_tmpl_id": self.id}
act_window["views"] = [(self.env.ref("mrp.mrp_bom_form_view").id, "form")]
act_window["res_id"] = (
self.env["mrp.bom"].search([("product_tmpl_id", "=", self.id)]).id
)
return act_window
class ProductProduct(models.Model):
_inherit = "product.product"
def action_view_bom(self):
res = super().action_view_bom()
bom_target_ids = self.env["mrp.bom"].search(res["domain"])
if len(bom_target_ids) == 1:
res["views"] = [(self.env.ref("mrp.mrp_bom_form_view").id, "form")]
res["res_id"] = bom_target_ids[0].id
return res

View File

@@ -1,11 +0,0 @@
# © 2015-2016 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 models
class MrpProduction(models.Model):
_inherit = 'mrp.production'
_order = 'id desc'

View File

@@ -9,3 +9,5 @@ Small usability improvements on MRP:
* show bom type in tree view + add group by
* complete Manufacturing Order report with unvailable products
* improve smart button from products to BoMs (display BoM form if only one instead of displaying a list of one)

View File

@@ -16,27 +16,26 @@
t-value="any(o.move_raw_ids.filtered(lambda x: x.product_uom_qty &gt; x.reserved_availability))"/>
<h4 if="has_product_unavailable">
These products were unavailable (or partially) while edition of this Manufacturing Order.
Here is complete quantities for these.
Here is missing quantities.
</h4>
<table class="table table-sm" t-if="o.move_raw_ids and has_product_unavailable">
<thead>
<tr>
<th>Product</th>
<th>Quantity</th>
<th>Sold Out Quantity</th>
</tr>
</thead>
<tbody>
<t t-set="lines"
<t t-set="moves"
t-value="o.move_raw_ids.filtered(lambda x: x.product_uom_qty &gt; x.reserved_availability)"/>
<t t-foreach="lines" t-as="ml">
<t t-foreach="moves" t-as="m">
<tr>
<td>
<span t-field="ml.product_id"/>
<span t-field="m.product_id"/>
</td>
<td>
<span t-esc="ml.product_uom_qty" t-if="ml.state !='done'"/>
<span t-esc="ml.qty_done" t-if="ml.state =='done'"/>
<span t-field="ml.product_uom" groups="uom.group_uom"/>
<span t-esc="o.get_stock_move_sold_out_report(m)" t-if="m.state !='done'"/>
<span t-field="m.product_uom" groups="uom.group_uom"/>
</td>
</tr>
</t>

View File

@@ -26,6 +26,26 @@
<button name="action_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this manufacturing order?</attribute>
</button>
<xpath expr="//field[@name='finished_move_line_ids']/tree/field[@name='product_uom_id']" position="replace"/>
<xpath expr="//field[@name='finished_move_line_ids']/tree/field[@name='qty_done']" position="after">
<field name="product_uom_id" groups="uom.group_uom"/> <!-- Move after qty -->
<field name="location_dest_id" groups="stock.group_stock_multi_locations"/>
</xpath>
</field>
</record>
<record id="view_stock_move_lots" model="ir.ui.view">
<field name="model">stock.move</field>
<field name="inherit_id" ref="mrp.view_stock_move_lots" />
<field name="arch" type="xml">
<xpath expr="//field[@name='active_move_line_ids']/tree/field[@name='lot_id']" position="before">
<xpath expr="//field[@name='active_move_line_ids']/tree/field[@name='location_id']" position="move"/>
</xpath>
<xpath expr="//field[@name='active_move_line_ids']/tree/field[@name='location_id']" position="attributes">
<attribute name="invisible">0</attribute>
<attribute name="readonly">0</attribute>
<attribute name="groups">stock.group_stock_multi_locations</attribute>
</xpath>
</field>
</record>
@@ -40,6 +60,17 @@
</field>
</record>
<record id="view_finisehd_move_line" model="ir.ui.view">
<field name="model">stock.move.line</field>
<field name="inherit_id" ref="mrp.view_finisehd_move_line" />
<field name="arch" type="xml">
<field name="lot_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>
</field>
</record>
<record id="mrp_bom_tree_view" model="ir.ui.view">
<field name="model">mrp.bom</field>
<field name="inherit_id" ref="mrp.mrp_bom_tree_view"/>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<odoo>
<record id="product_template_form_view_bom_button" model="ir.ui.view">
<field name="name">product.template.procurement</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="mrp.product_template_form_view_bom_button" />
<field name="arch" type="xml">
<xpath expr="//field[@name='bom_count']/.." position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='bom_count']/.." position="after">
<button class="oe_stat_button" name="action_view_bom" type="object"
attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"
icon="fa-flask">
<field string="Bill of Materials" name="bom_count"
widget="statinfo" />
</button>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,23 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Product No Translation module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import product

View File

@@ -0,0 +1,40 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Product No Translation module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Product no Translation',
'version': '12.0.0.0.1',
'category': 'Sales Management',
'license': 'AGPL-3',
'summary': 'For companies that work with only one language',
'description': """
This module sets the translatable fields of the product object (name,
descriptions) to non-translatable fields.
This change is usefull for companies that work with only one language.
And it reduces the start time of the Point of Sale !
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['product'],
}

View File

@@ -0,0 +1,62 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Product No Translation module for Odoo
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import models, fields
class ProductTemplate(models.Model):
_inherit = "product.template"
description_sale = fields.Text(translate=False)
description_purchase = fields.Text(translate=False)
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"
name = fields.Char(translate=False)
class ProductAttributeValue(models.Model):
_inherit = "product.attribute.value"
name = fields.Char(translate=False)
class UomCategory(models.Model):
_inherit = 'uom.category'
name = fields.Char(translate=False)
class UomUom(models.Model):
_inherit = 'uom.uom'
name = fields.Char(translate=False)

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@@ -16,11 +16,6 @@
<field name="standard_price" class="oe_inline" position="after">
<button name="show_product_price_history" class="oe_inline oe_link" type="object" string="Show History" context="{'active_id': active_id}"/>
</field>
<!-- Don't make it too big, othesize computers with small resolutions
will see the product name + image under the block of buttons -->
<div class="oe_title" position="attributes">
<attribute name="style">width: 650px;</attribute>
</div>
</field>
</record>

View File

@@ -3,8 +3,9 @@
# @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 models, fields, api, _
from odoo.tools.misc import formatLang
from odoo.tools import float_compare
class PurchaseOrder(models.Model):
@@ -42,6 +43,51 @@ class PurchaseOrder(models.Model):
if po.partner_ref:
name += ' (' + po.partner_ref + ')'
if self.env.context.get('show_total_amount') and po.amount_total:
name += ': ' + formatLang(self.env, po.amount_untaxed, currency_obj=po.currency_id)
name += ': ' + formatLang(
self.env, po.amount_untaxed, currency_obj=po.currency_id)
result.append((po.id, name))
return result
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
@api.onchange('product_qty', 'product_uom')
def _onchange_quantity(self):
# When the user has manually set a price and/or planned_date
# he is often upset when Odoo changes it when he changes the qty
# So we add a warning...
res = {}
old_price = self.price_unit
old_date_planned = self.date_planned
super()._onchange_quantity()
new_price = self.price_unit
new_date_planned = self.date_planned
prec = self.env['decimal.precision'].precision_get('Product Price')
price_compare = float_compare(old_price, new_price, precision_digits=prec)
if price_compare or old_date_planned != new_date_planned:
res['warning'] = {
'title': _('Updates'),
'message': _(
"Due to the update of the ordered quantity on line '%s', "
"the following data has been updated using the supplier info "
"of the product:"
) % self.name
}
if price_compare:
res['warning']['message'] += _(
"\nOld price: %s\nNew price: %s") % (
formatLang(
self.env, old_price,
currency_obj=self.order_id.currency_id),
formatLang(
self.env, new_price,
currency_obj=self.order_id.currency_id))
if old_date_planned != new_date_planned:
res['warning']['message'] += _(
"\nOld delivery date: %s\nNew delivery date: %s") % (
old_date_planned,
new_date_planned,
)
return res

View File

@@ -172,5 +172,40 @@
<!-- The menu entry should be added in customer-specific module -->
<record id="purchase.action_purchase_order_report_all" model="ir.actions.act_window">
<field name="view_mode">pivot,graph,tree</field> <!--- native order is graph,pivot. Switch order and add tree -->
</record>
<record id="view_purchase_order_pivot" model="ir.ui.view">
<field name="model">purchase.report</field>
<field name="inherit_id" ref="purchase.view_purchase_order_pivot"/>
<field name="arch" type="xml">
<pivot position="attributes">
<attribute name="disable_linking"></attribute>
</pivot>
<field name="unit_quantity" position="replace"/> <!-- it's stupid to display a unit_quantity by default... it will sum qty of different products, which doesn't make a lot of sense -->
<field name="price_average" position="replace"/> <!-- it's stupid to display a price_average by default... it will average between different products, which is a non-sense -->
</field>
</record>
<record id="view_purchase_order_tree" model="ir.ui.view">
<field name="name">purchase.report.tree</field>
<field name="model">purchase.report</field>
<field name="arch" type="xml">
<tree>
<field name="commercial_partner_id"/>
<field name="date_order"/>
<field name="date_approve"/>
<field name="product_id"/>
<field name="unit_quantity" sum="1"/>
<field name="product_uom"/>
<field name="price_total" sum="1"/>
<field name="account_analytic_id"/>
<field name="currency_id" invisible="1"/>
<field name="user_id"/>
<field name="state"/>
</tree>
</field>
</record>
</odoo>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 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).
-->
<openerp>
<data>
<record id="view_picking_form" model="ir.ui.view">
<field name="name">purchase_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">
<field name="origin" position="after">
<field name="purchase_id" attrs="{'invisible': [('picking_type_code', '!=', 'incoming')]}" context="{'show_purchase': True}"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,27 @@
# Copyright 2023 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, models
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def action_invoice_open(self):
res = super().action_invoice_open()
amlo = self.env['account.move.line']
for inv in self:
if inv.state == 'open' and inv.type == 'out_invoice':
sales = inv.invoice_line_ids.mapped('sale_line_ids').\
mapped('order_id')
if sales:
mlines = amlo.search([('sale_id', 'in', sales.ids)])
if mlines:
receivable_lines = inv.move_id.mapped('line_ids').filtered(
lambda l: l.account_id == inv.account_id)
mlines |= receivable_lines
mlines.remove_move_reconcile()
mlines.reconcile()
return res

View File

@@ -30,3 +30,8 @@ class AccountMoveLine(models.Model):
def sale_advance_payement_account_id_change(self):
if self.sale_id and self.account_id.user_type_id.type != 'receivable':
self.sale_id = False
def _sale_down_payment_hook(self):
# can be used for notifications
self.ensure_one()

View File

@@ -25,6 +25,14 @@ class AccountPayment(models.Model):
res['sale_id'] = self.sale_id.id
return res
def _create_payment_entry(self, amount):
move = super()._create_payment_entry(amount)
if hasattr(self, 'sale_id') and self.sale_id:
for line in move.line_ids:
if line.sale_id and line.account_id.internal_type == 'receivable':
line._sale_down_payment_hook()
return move
class AccountAbstractPayment(models.AbstractModel):
_inherit = "account.abstract.payment"
@@ -49,7 +57,7 @@ class AccountAbstractPayment(models.AbstractModel):
def _compute_payment_amount(self, invoices=None, currency=None):
amount = super(AccountAbstractPayment, self)._compute_payment_amount(
invoices=invoices, currency=currency)
if self.sale_id:
if hasattr(self, 'sale_id') and self.sale_id:
payment_currency = currency
if not payment_currency:
payment_currency = self.sale_id.currency_id

View File

@@ -64,7 +64,9 @@ class AccountBankStatementSale(models.TransientModel):
self.ensure_one()
for line in self.line_ids:
if line.move_line_id.sale_id != line.sale_id:
line.move_line_id.sale_id = line.sale_id.id
line.move_line_id.write({'sale_id': line.sale_id.id or False})
if line.sale_id:
line.move_line_id._sale_down_payment_hook()
class AccountBankStatementSaleLine(models.TransientModel):

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,23 @@
# 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).
{
'name': 'Sale MRP Usability',
'version': '12.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Usability improvements on sale_mrp module',
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': [
'sale_mrp',
'stock_usability',
],
'data': [
# Native in v14. Do no up-port to v14
'views/mrp_production.xml',
'views/sale_order.xml',
],
'installable': True,
}

View File

@@ -0,0 +1,2 @@
from . import sale
from . import mrp_production

View File

@@ -0,0 +1,39 @@
# Backport from Odoo v14
# Copyright Odoo SA
# Same licence as Odoo (LGPL)
from odoo import api, fields, models, _
class MrpProduction(models.Model):
_inherit = 'mrp.production'
sale_order_count = fields.Integer(
"Count of Source SO",
compute='_compute_sale_order_count',
groups='sales_team.group_sale_salesman')
@api.depends('move_dest_ids.group_id.sale_id')
def _compute_sale_order_count(self):
for production in self:
production.sale_order_count = len(production.move_dest_ids.mapped('group_id').mapped('sale_id'))
def action_view_sale_orders(self):
self.ensure_one()
sale_order_ids = self.move_dest_ids.mapped('group_id').mapped('sale_id').ids
action = {
'res_model': 'sale.order',
'type': 'ir.actions.act_window',
}
if len(sale_order_ids) == 1:
action.update({
'view_mode': 'form',
'res_id': sale_order_ids[0],
})
else:
action.update({
'name': _("Sources Sale Orders of %s" % self.name),
'domain': [('id', 'in', sale_order_ids)],
'view_mode': 'tree,form',
})
return action

View File

@@ -0,0 +1,39 @@
# This code is a backport from odoo v14
# Copyright Odoo SA
# Same licence as Odoo (LGPL)
from odoo import api, fields, models, _
class SaleOrder(models.Model):
_inherit = 'sale.order'
mrp_production_count = fields.Integer(
"Count of MO generated",
compute='_compute_mrp_production_count',
groups='mrp.group_mrp_user')
@api.depends('procurement_group_id.stock_move_ids.created_production_id')
def _compute_mrp_production_count(self):
for sale in self:
sale.mrp_production_count = len(sale.procurement_group_id.stock_move_ids.mapped('created_production_id'))
def action_view_mrp_production(self):
self.ensure_one()
mrp_production_ids = self.procurement_group_id.stock_move_ids.mapped('created_production_id').ids
action = {
'res_model': 'mrp.production',
'type': 'ir.actions.act_window',
}
if len(mrp_production_ids) == 1:
action.update({
'view_mode': 'form',
'res_id': mrp_production_ids[0],
})
else:
action.update({
'name': _("Manufacturing Orders Generated by %s" % self.name),
'domain': [('id', 'in', mrp_production_ids)],
'view_mode': 'tree,form',
})
return action

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Backport from odoo v14
Copyright Odoo SA
Same licence as Odoo (LGPL) -->
<odoo>
<record id="mrp_production_form_view" model="ir.ui.view">
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="groups_id" eval="[(6, 0, [ref('sales_team.group_sale_salesman_all_leads')])]"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button class="oe_stat_button" name="action_view_sale_orders" type="object" icon="fa-dollar" attrs="{'invisible': [('sale_order_count', '=', 0)]}" groups="sales_team.group_sale_salesman">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="sale_order_count"/></span>
<span class="o_stat_text">Sales</span>
</div>
</button>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Backport from Odoo v14
Copyright Odoo SA
Same licence as Odoo (LGPL)
-->
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="groups_id" eval="[(6, 0, [ref('mrp.group_mrp_user')])]"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button class="oe_stat_button" name="action_view_mrp_production" type="object" icon="fa-wrench" attrs="{'invisible': [('mrp_production_count', '=', 0)]}" groups="mrp.group_mrp_user">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value"><field name="mrp_production_count"/></span>
<span class="o_stat_text">Manufacturing</span>
</div>
</button>
</xpath>
</field>
</record>
</odoo>

View File

View File

@@ -0,0 +1,31 @@
# Copyright 2020 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale no configurator button",
"summary": "Hide 'configure a product' from sale line",
"version": "12.0.1.0.0",
"category": "Usabability",
"website": "www.akretion.com",
"author": " Akretion",
"license": "AGPL-3",
"application": False,
"installable": True,
"external_dependencies": {
"python": [],
"bin": [],
},
"depends": [
"sale",
],
"data": [
"views/sale_view.xml",
],
"demo": [
],
"qweb": [
]
}

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="sale_order_view_form" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//control/create[@groups='product.group_product_variant']" position="replace"/>
</field>
</record>
</odoo>

View File

View File

@@ -0,0 +1,30 @@
# Copyright 2020 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale no optional product",
"summary": "Hide optional product",
"version": "12.0.1.0.0",
"category": "Usability",
"website": "www.akretion.com",
"author": " Akretion",
"license": "AGPL-3",
"application": False,
"installable": True,
"external_dependencies": {
"python": [],
"bin": [],
},
"depends": [
"sale_management",
],
"data": [
"views/product_template_view.xml",
"views/sale_order_view.xml",
],
"demo": [
],
"qweb": [
]
}

View File

@@ -0,0 +1,14 @@
<?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>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="sale_order_form_quote" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_management.sale_order_form_quote"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='sale_order_option_ids']/.." position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
</odoo>

View File

View File

@@ -0,0 +1,31 @@
# Copyright 2020 Akretion (https://www.akretion.com).
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Sale no preview button",
"summary": "Hide 'preview' from sale",
"version": "12.0.1.0.0",
"category": "Usabability",
"website": "www.akretion.com",
"author": " Akretion",
"license": "AGPL-3",
"application": False,
"installable": True,
"external_dependencies": {
"python": [],
"bin": [],
},
"depends": [
"sale",
],
"data": [
"views/sale_view.xml",
],
"demo": [
],
"qweb": [
]
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<button name="preview_sale_order" position="attributes">
<attribute name="invisible">1</attribute>
</button>
</field>
</record>
</odoo>

View File

@@ -1,106 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_stock_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-07-13 12:36+0000\n"
"PO-Revision-Date: 2016-07-13 14:37+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: fr\n"
"X-Generator: Poedit 1.8.7.1\n"
#. module: sale_stock_usability
#: view:sale.order:sale_stock_usability.view_order_form_inherit
msgid "Delivery Orders"
msgstr "Livraisons"
#. module: sale_stock_usability
#: view:procurement.group:sale_stock_usability.procurement_group_form_view
#: field:procurement.group,picking_ids:0
msgid "Pickings"
msgstr "Préparations"
#. module: sale_stock_usability
#: model:ir.model,name:sale_stock_usability.model_procurement_group
msgid "Procurement Requisition"
msgstr "Demande d'approvisionnement"
#. module: sale_stock_usability
#: view:procurement.group:sale_stock_usability.procurement_group_form_view
#: field:procurement.group,sale_ids:0
msgid "Sale Orders"
msgstr "Sale Orders"
#. module: sale_stock_usability
#: model:ir.model,name:sale_stock_usability.model_sale_order
msgid "Sales Order"
msgstr "Bon de commande"
#. module: sale_stock_usability
#: model:ir.model,name:sale_stock_usability.model_sale_order_line
msgid "Sales Order Line"
msgstr "Ligne de commandes de vente"
#. module: sale_stock_usability
#: selection:sale.order,picking_status:0
msgid "Delivery Cancelled"
msgstr "Livraison annulée"
#. module: sale_stock_usability
#: model_terms:ir.ui.view,arch_db:sale_stock_usability.view_sales_order_filter
#: selection:sale.order,picking_status:0
msgid "Fully Delivered"
msgstr "Entierement Livré "
#. module: sale_stock_usability
#: model:ir.model.fields,field_description:sale_stock_usability.field_sale_order__incoterm
msgid "Incoterms"
msgstr "Incoterms"
#. module: sale_stock_usability
#: model:ir.model.fields,help:sale_stock_usability.field_sale_order__incoterm
msgid "International Commercial Terms are a series of predefined commercial terms used in international transactions."
msgstr "Les Incoterms sont une série de termes commerciaux prédéfinie utilisés dans les transactions internationales."
#. module: sale_stock_usability
#: model_terms:ir.ui.view,arch_db:sale_stock_usability.view_sales_order_filter
msgid "Not Fully Delivered"
msgstr "Livraison à faire"
#. module: sale_stock_usability
#: selection:sale.order,picking_status:0
msgid "Nothing to Deliver"
msgstr "Rien à livrer"
#. module: sale_stock_usability
#: selection:sale.order,picking_status:0
msgid "Partially Delivered"
msgstr "Livré partielement"
#. module: sale_stock_usability
#: model:ir.model.fields,field_description:sale_stock_usability.field_sale_order__picking_status
msgid "Picking Status"
msgstr "Status de BL"
#. module: sale_stock_usability
#: model:ir.model,name:sale_stock_usability.model_sale_order
msgid "Sale Order"
msgstr "Bon de commande"
#. module: sale_stock_usability
#: selection:sale.order,picking_status:0
msgid "To Deliver"
msgstr "Prêt à livrer"
#. module: sale_stock_usability
#: model:ir.model.fields,field_description:sale_stock_usability.field_sale_order__warehouse_id
msgid "Warehouse"
msgstr "Entrepôt"

View File

@@ -36,7 +36,7 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="pricelist_id" position="after">
<field name="picking_status"/>
<field name="picking_status" states="sale,done"/>
</field>
</field>
</record>

View File

@@ -2,8 +2,9 @@
# @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.tools import float_is_zero
from odoo import models, fields, api, _
from odoo.tools import float_is_zero, float_compare
from odoo.tools.misc import formatLang
class SaleOrder(models.Model):
@@ -11,6 +12,7 @@ class SaleOrder(models.Model):
date_order = fields.Datetime(track_visibility='onchange')
confirmation_date = fields.Datetime(track_visibility='onchange')
commitment_date = fields.Datetime(track_visibility='onchange')
client_order_ref = fields.Char(track_visibility='onchange')
# for partner_id, the 'sale' module sets track_visibility='always'
partner_id = fields.Many2one(track_visibility='onchange')
@@ -63,3 +65,35 @@ class SaleOrder(models.Model):
# {'subtotal': 8932.23},
# ]
return res
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
@api.onchange('product_uom', 'product_uom_qty')
def product_uom_change(self):
# When the user has manually set a custom price
# he is often upset when Odoo changes it when he changes the qty
# So we add a warning in which we recall the old price.
res = {}
old_price = self.price_unit
super().product_uom_change()
new_price = self.price_unit
prec = self.env['decimal.precision'].precision_get('Product Price')
if float_compare(old_price, new_price, precision_digits=prec):
pricelist = self.order_id.pricelist_id
res['warning'] = {
'title': _('Price updated'),
'message': _(
"Due to the update of the ordered quantity on line '%s', "
"the price has been updated according to pricelist '%s'.\n"
"Old price: %s\n"
"New price: %s") % (
self.name,
pricelist.display_name,
formatLang(
self.env, old_price, currency_obj=pricelist.currency_id),
formatLang(
self.env, new_price, currency_obj=pricelist.currency_id))
}
return res

View File

@@ -26,6 +26,9 @@
<field name="confirmation_date" position="after">
<field name="client_order_ref"/>
</field>
<button name="preview_sale_order" position="after">
<button name="action_quotation_send" type="object" string="Send Order Acknowledgement" attrs="{'invisible': ['|', ('state', 'not in', ('sale', 'done')), ('invoice_count','&gt;=',1)]}"/>
</button>
</field>
</record>
@@ -51,6 +54,9 @@
<field name="state" position="attributes">
<attribute name="invisible">0</attribute>
</field>
<field name="partner_id" position="after">
<field name="client_order_ref"/>
</field>
</field>
</record>

View File

@@ -0,0 +1 @@
from . import wizard

View File

@@ -0,0 +1,18 @@
# 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).
{
'name': 'Service Line Qty Update Base',
'version': '12.0.1.0.0',
'category': 'Tools',
'license': 'AGPL-3',
'summary': 'Update delivery qty on service lines - Base module',
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['product'],
'data': [
'wizard/service_qty_update_view.xml',
],
'installable': True,
}

View File

@@ -0,0 +1 @@
from . import service_qty_update

View File

@@ -0,0 +1,70 @@
# 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.tools import float_compare, float_is_zero
import odoo.addons.decimal_precision as dp
from odoo.exceptions import UserError
class ServiceQtyUpdate(models.TransientModel):
_name = 'service.qty.update'
_description = 'Wizard to update delivery qty on service lines'
line_ids = fields.One2many('service.qty.update.line', 'parent_id', string="Lines")
def run(self):
self.ensure_one()
prec = self.env['decimal.precision'].precision_get('Product Unit of Measure')
for line in self.line_ids:
if float_compare(line.post_delivered_qty, line.order_qty, precision_digits=prec) > 0:
raise UserError(_(
"On line '%s', the total delivered qty (%s) is superior to the ordered qty (%s).") % (line.name, line.post_delivered_qty, line.order_qty))
fc_added = float_compare(line.added_delivered_qty, 0, precision_digits=prec)
if fc_added < 0:
raise UserError(_(
"On line '%s', the added quantity is negative.") % line.name)
if fc_added > 0:
line.process_line()
return True
class ServiceQtyUpdateLine(models.TransientModel):
_name = 'service.qty.update.line'
_description = 'Lines of the wizard that updates delivery qty on service lines'
parent_id = fields.Many2one(
'service.qty.update', string='Wizard', ondelete='cascade')
product_id = fields.Many2one('product.product', string='Product', readonly=True)
name = fields.Char()
name_readonly = fields.Char(related='name', string='Description')
order_qty = fields.Float(
string='Order Qty',
digits=dp.get_precision('Product Unit of Measure'))
order_qty_readonly = fields.Float(related='order_qty', string='Product Unit of Measure')
pre_delivered_qty = fields.Float(
digits=dp.get_precision('Product Unit of Measure'))
pre_delivered_qty_readonly = fields.Float(related='pre_delivered_qty', string='Current Delivered Qty')
added_delivered_qty = fields.Float(
string='Added Delivered Qty',
digits=dp.get_precision('Product Unit of Measure'))
post_delivered_qty = fields.Float(
compute='_compute_post_delivered_qty',
string='Total Delivered Qty',
digits=dp.get_precision('Product Unit of Measure'))
uom_id = fields.Many2one('uom.uom', string='UoM', readonly=True)
comment = fields.Char(string='Comment')
@api.depends('pre_delivered_qty', 'added_delivered_qty')
def _compute_post_delivered_qty(self):
for line in self:
line.post_delivered_qty = line.pre_delivered_qty + line.added_delivered_qty
def process_line(self):
# Write and message_post
return
# sale : qty_delivered
# purchase : qty_received

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="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).
-->
<odoo>
<record id="service_qty_update_form" model="ir.ui.view">
<field name="model">service.qty.update</field>
<field name="arch" type="xml">
<form>
<group name="main">
<field name="line_ids" nolabel="1">
<tree editable="bottom">
<field name="product_id"/>
<field name="name" invisible="0"/>
<field name="name_readonly"/>
<field name="order_qty" invisible="1"/>
<field name="order_qty_readonly"/>
<field name="pre_delivered_qty" invisible="1"/>
<field name="pre_delivered_qty_readonly"/>
<field name="added_delivered_qty"/>
<field name="post_delivered_qty"/>
<field name="uom_id" groups="uom.group_uom"/>
<field name="comment"/>
</tree>
</field>
</group>
<footer>
<button name="run" type="object" string="Validate" class="btn-primary"/>
<button special="cancel" string="Cancel" class="btn-default"/>
</footer>
</form>
</field>
</record>
<record id="service_qty_update_action" model="ir.actions.act_window">
<field name="name">Service Order Lines - Update Delivered Qty</field>
<field name="res_model">service.qty.update</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -0,0 +1,2 @@
from . import models
from . import wizard

View File

@@ -0,0 +1,22 @@
# 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).
{
'name': 'Service Line Qty Update Purchase',
'version': '12.0.1.0.0',
'category': 'Tools',
'license': 'AGPL-3',
'summary': 'Update delivery qty on service lines - Purchase module',
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': [
'purchase',
'service_line_qty_update_base',
'purchase_reception_status',
],
'data': [
'views/purchase_order.xml',
],
'installable': True,
}

View File

@@ -0,0 +1 @@
from . import purchase_order

View File

@@ -0,0 +1,21 @@
# 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
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
has_service = fields.Boolean(compute='_compute_has_service')
@api.depends('order_line.product_id.type')
def _compute_has_service(self):
for order in self:
has_service = False
for l in order.order_line:
if l.product_id.type == 'service':
has_service = True
break
order.has_service = has_service

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="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).
-->
<odoo>
<record id="purchase_order_form" model="ir.ui.view">
<field name="name">purchase.order.form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<button name="action_view_invoice" position="after">
<button name="%(service_line_qty_update_base.service_qty_update_action)d" type="action" string="Update Service Qty" attrs="{'invisible': ['|', '|', ('state', 'not in', ('purchase', 'done')), ('has_service', '=', False), ('reception_status', '=', 'received')]}" groups="purchase.group_purchase_user"/>
<field name="has_service" invisible="1"/>
</button>
<xpath expr="//field[@name='order_line']/tree/field[@name='qty_received']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
from . import service_qty_update

View File

@@ -0,0 +1,62 @@
# 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.tools import float_compare
from odoo.exceptions import UserError
class ServiceQtyUpdate(models.TransientModel):
_inherit = 'service.qty.update'
@api.model
def default_get(self, fields_list):
res = super().default_get(fields_list)
prec = self.env['decimal.precision'].precision_get('Product Unit of Measure')
if self._context.get('active_model') == 'purchase.order' and self._context.get('active_id'):
lines = []
order = self.env['purchase.order'].browse(self._context['active_id'])
for l in order.order_line.filtered(lambda x: x.product_id.type == 'service'):
if float_compare(l.product_qty, l.qty_received, precision_digits=prec) > 0:
lines.append((0, 0, {
'purchase_line_id': l.id,
'product_id': l.product_id.id,
'name': l.name,
'name_readonly': l.name,
'order_qty': l.product_qty,
'order_qty_readonly': l.product_qty,
'pre_delivered_qty': l.qty_received,
'pre_delivered_qty_readonly': l.qty_received,
'uom_id': l.product_uom.id,
}))
if lines:
res['line_ids'] = lines
else:
raise UserError(_(
"All service lines are fully received."))
return res
class ServiceQtyUpdateLine(models.TransientModel):
_inherit = 'service.qty.update.line'
purchase_line_id = fields.Many2one('purchase.order.line', string='Purchase Line', readonly=True)
def process_line(self):
po_line = self.purchase_line_id
if po_line:
new_qty = po_line.qty_received + self.added_delivered_qty
po_line.write({'qty_received': new_qty})
body = """
<p>Received qty updated on service line <b>%s</b>:
<ul>
<li>Added received qty: <b>%s</b></li>
<li>Total received qty: %s</li>
</ul></p>
""" % (self.name, self.added_delivered_qty, new_qty)
if self.comment:
body += '<p>Comment: %s</p>' % self.comment
po_line.order_id.message_post(body=body)
return super().process_line()

View File

@@ -0,0 +1,2 @@
from . import models
from . import wizard

View File

@@ -0,0 +1,22 @@
# 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).
{
'name': 'Service Line Qty Update Sale',
'version': '12.0.1.0.0',
'category': 'Tools',
'license': 'AGPL-3',
'summary': 'Update delivery qty on service lines - Sale module',
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': [
'sale',
'service_line_qty_update_base',
# 'purchase_reception_status',
],
'data': [
'views/sale_order.xml',
],
'installable': True,
}

View File

@@ -0,0 +1 @@
from . import sale_order

View File

@@ -0,0 +1,21 @@
# 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
class SaleOrder(models.Model):
_inherit = 'sale.order'
has_service = fields.Boolean(compute='_compute_has_service')
@api.depends('order_line.product_id.type')
def _compute_has_service(self):
for order in self:
has_service = False
for l in order.order_line:
if l.product_id.type == 'service':
has_service = True
break
order.has_service = has_service

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="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).
-->
<odoo>
<record id="view_order_form" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<button name="action_quotation_send" position="after">
<button name="%(service_line_qty_update_base.service_qty_update_action)d" type="action" string="Update Service Qty" attrs="{'invisible': ['|', ('state', 'not in', ('sale', 'done')), ('has_service', '=', False)]}" groups="sales_team.group_sale_salesman"/>
<field name="has_service" invisible="1"/>
</button>
<xpath expr="//field[@name='order_line']/tree/field[@name='qty_delivered']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
from . import service_qty_update

View File

@@ -0,0 +1,62 @@
# 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.tools import float_compare
from odoo.exceptions import UserError
class ServiceQtyUpdate(models.TransientModel):
_inherit = 'service.qty.update'
@api.model
def default_get(self, fields_list):
res = super().default_get(fields_list)
prec = self.env['decimal.precision'].precision_get('Product Unit of Measure')
if self._context.get('active_model') == 'sale.order' and self._context.get('active_id'):
lines = []
order = self.env['sale.order'].browse(self._context['active_id'])
for l in order.order_line.filtered(lambda x: x.product_id.type == 'service'):
if float_compare(l.product_qty, l.qty_delivered, precision_digits=prec) > 0:
lines.append((0, 0, {
'sale_line_id': l.id,
'product_id': l.product_id.id,
'name': l.name,
'name_readonly': l.name,
'order_qty': l.product_uom_qty,
'order_qty_readonly': l.product_uom_qty,
'pre_delivered_qty': l.qty_delivered,
'pre_delivered_qty_readonly': l.qty_delivered,
'uom_id': l.product_uom.id,
}))
if lines:
res['line_ids'] = lines
else:
raise UserError(_(
"All service lines are fully delivered."))
return res
class ServiceQtyUpdateLine(models.TransientModel):
_inherit = 'service.qty.update.line'
sale_line_id = fields.Many2one('sale.order.line', string='Sale Line', readonly=True)
def process_line(self):
so_line = self.sale_line_id
if so_line:
new_qty = so_line.qty_delivered + self.added_delivered_qty
so_line.write({'qty_delivered': new_qty})
body = """
<p>Delivered qty updated on service line <b>%s</b>:
<ul>
<li>Added delivered qty: <b>%s</b></li>
<li>Total delivered qty: %s</li>
</ul></p>
""" % (self.name, self.added_delivered_qty, new_qty)
if self.comment:
body += '<p>Comment: %s</p>' % self.comment
so_line.order_id.message_post(body=body)
return super().process_line()

Some files were not shown because too many files have changed in this diff Show More