Compare commits

...

55 Commits

Author SHA1 Message Date
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
Pierrick Brun
e96c3d72eb [ADD] Simple OCA-style Readme to several modules (#114) 2020-03-18 15:55:42 +01:00
Alexis de Lattre
a545c8dbb6 product-usability: remove field that was added in native view
Add delay in supplierinfo tree view
2020-02-20 22:00:40 +01:00
Alexis de Lattre
07824a0570 Add sale_id in procurement.group form view 2020-02-20 18:45:02 +01:00
Alexis de Lattre
12bd157ad4 sale_order_route: take into account the scenario where route_id has a value, then SO is cancelled+back to draft, then route_id = False and SO is confirmed again 2020-02-13 10:55:25 +01:00
Alexis de Lattre
53f6ab5d0f Fix version number 2020-02-04 16:15:04 +01:00
Mourad
cc88dd994b [FIX] update fr.po 2020-01-30 14:47:51 +01:00
Alexis de Lattre
b99659dcc9 Merge branch '12.0' of https://github.com/akretion/odoo-usability into 12.0 2020-01-14 16:58:36 +01:00
Alexis de Lattre
581bfe78d8 Finish port of intrastat_product_type 2020-01-14 16:58:20 +01:00
Alexis de Lattre
9a174c257d account_usability: add transfer_account_id to invoicing config page 2020-01-03 13:29:49 +01:00
Alexis de Lattre
941c610c96 sale_usability: add product categ menu entry 2019-12-12 20:26:18 +01:00
David Beal
34a4c573b1 FIX inactive view_production_lot_form_simple (#112) 2019-12-03 09:20:16 +01:00
Alexis de Lattre
f64d190ac3 account_usability: FIX potential problem in view inheritance 2019-11-27 22:59:37 +01:00
David Beal
c633660e73 REMove pos_usability: delete index.html file 2019-11-27 11:38:06 +01:00
Alexis de Lattre
0dfe8df8e4 Remove code from patch, because david Beal added it via inherit of code 2019-11-27 00:31:48 +01:00
David Beal
0e4a562263 IMP acc_usability: improve domain reconciliation widget (#111) 2019-11-27 00:30:36 +01:00
Alexis de Lattre
253a5ebebe FIX show move from bank statement line button 2019-11-27 00:20:18 +01:00
Alexis de Lattre
73c622956f Port account_several_improvements.diff to v12 2019-11-26 00:04:25 +01:00
Alexis de Lattre
38db0da20a Update sale_down_payment 2019-11-25 17:13:03 +01:00
Alexis de Lattre
361f5d3aae Update patch invoice_register_payment_writeoff_analytic.diff for v12 2019-11-20 13:53:16 +01:00
Alexis de Lattre
499d363daf Fix icon display on bank statement 2019-11-15 00:12:45 +01:00
Alexis de Lattre
035a3dfd1e Rename module sale_advance_payment_management to sale_down_payment
Add field amount_down_payment on sale.order
2019-11-14 23:02:42 +01:00
Alexis de Lattre
83fec9264f Initial check-in of the module sale_advance_payment_management 2019-11-13 00:53:56 +01:00
David Beal
9762b5392b IMP branding 2019-10-11 15:12:46 +02:00
David Beal
fc4ea217e0 ADD module pos_usability 2019-10-11 15:12:21 +02:00
David Beal
1812c7f5af IMP base_usa: sequence view and FIX module view
- add prefix field in sequence search view
- replace @class by hasclass() in module view
2019-10-10 10:38:06 +02:00
Alexis de Lattre
92a4b0d6ac Add module stock_no_product_template_menu 2019-09-30 22:44:05 +02:00
Alexis de Lattre
33f67279fb stock_usability: Add patch stock_add_product_reserved_qty_free_qty.diff for those who want to know the reserved/free qty of a product (and not use for OCA modules for perf. reasons) 2019-09-19 18:33:20 +02:00
Alexis de Lattre
66c845f3cf stock_usability: add/improve unreserve buttons 2019-09-19 18:31:18 +02:00
Alexis de Lattre
8a9c75790a sale_usability: Add sale_ids and sale_count on account.invoice
Show sale_line_ids on invoice line form view
2019-09-17 18:53:47 +02:00
Alexis de Lattre
0de8425cfa base_partner_ref: display_name on res.partner is a stored field defined in base. As we inherit this field, we need a hack to be able to invalidate it to force recompute. 2019-09-17 11:29:38 +02:00
Alexis de Lattre
f8563c1667 account_usability: add ability to search by account code in the bank statement work intf 2019-09-17 11:28:54 +02:00
Alexis de Lattre
60cda426a9 base_usability: partner search view: add separator between inactive and customer/supplier filters 2019-09-17 11:28:13 +02:00
Alexis de Lattre
fe7f2c00c5 sale_stock_usability: Minor view improvement for field picking status 2019-09-17 11:27:28 +02:00
Alexis de Lattre
76b113ed28 Fix crash upon click on "Show History" on product form 2019-09-17 11:27:04 +02:00
mourad-ehm
5140094633 [IMP] ADD picking_status on sale order (#104)
* [IMP] ADD picking_status on sale order
2019-09-16 10:24:15 +02:00
147 changed files with 7006 additions and 287 deletions

View File

@@ -0,0 +1,96 @@
=================
Account Usability
=================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github
:target: https://github.com/akretion/odoo-usability/tree/12.0/account_usability
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
This modules adds the following functions:
* Add an *Overdue* filter on invoice search view (this feature was previously
located in te module *account_invoice_overdue_filter*)
* Increase the default limit of 80 lines in account move and account move line view.
* disable reconciliation "guessing"
* fast search on *Reconcile Ref* for account move line.
* add sale dates to invoice report to be compliant with
https://www.service-public.fr/professionnels-entreprises/vosdroits/F31808
* Sale date on qweb invoices
* A wizard to mark several invoices as sent at once (forward from v8)
* Default date for Account Move Reversal is now D+1 instead of today
* Track more fields on invoice (see details in account.py)
* Add boolean fields `has_discount` and `has_attachment` on invoice
* Add button "Delete line qty = 0" on supplier invoice
* Cut name_get() of invoice if too long
* A script for if Odoo screws up invoice attachment filename
* help functions for py3o reports
* Show code on name_get of journal
* add direct search of journal using code
* add copy=False on some fields
* Add unicity constraint on analytic codes per company
* Better default values on account move
* Add link from account move line to invoice
* Add start_date and end_date on bank statements
* Add transfer_account_id to invoicing config page
* Improve domain reconciliation widget
* account.reconcile.model don't copy name to label via onchange
* Add method to get fiscal position without partner_id
* Restore drill-through on sale and invoice reports
* 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
Together with this module, I recommend the use of the following modules:
* account_invoice_supplier_ref_unique (OCA project account-invoicing)
* account_move_line_no_default_search (OCA project account-financial-tools)
* invoice_fiscal_position_update (OCA project account-invoicing)
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/akretion/odoo-usability/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/akretion/odoo-usability/issues/new?body=module:%20account_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Akretion
Contributors
~~~~~~~~~~~~
* Alexis de Lattre <alexis.delattre@akretion.com>
* David Beal <david.beal@akretion.com>
Maintainers
~~~~~~~~~~~
This module is part of the `akretion/odoo-usability <https://github.com/akretion/odoo-usability/tree/12.0/account_usability>`_ project on GitHub.
You are welcome to contribute.

View File

@@ -4,31 +4,10 @@
{
'name': 'Account Usability',
'version': '10.0.1.0.0',
'version': '12.0.1.0.0',
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Small usability enhancements in account module',
'description': """
Account Usability
=================
The usability enhancements include:
* show the supplier invoice number in the tree view of supplier invoices
* add an *Overdue* filter on invoice search view (this feature was previously
located in te module *account_invoice_overdue_filter*)
* increase the default limit of 80 lines in account move and account move line view.
* fast search on *Reconcile Ref* for account move line.
* disable reconciliation "guessing"
* add sale dates to invoice report to be compliant with
https://www.service-public.fr/professionnels-entreprises/vosdroits/F31808
Together with this module, I recommend the use of the following modules:
* account_invoice_supplier_ref_unique (OCA project account-invoicing)
* account_move_line_no_default_search (OCA project account-financial-tools)
* invoice_fiscal_position_update (OCA project account-invoicing)
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': [

View File

@@ -6,6 +6,7 @@ from odoo import models, fields, api, _
from odoo.tools import float_compare, float_is_zero
from odoo.tools.misc import formatLang
from odoo.exceptions import UserError, ValidationError
from odoo.osv import expression
from odoo import SUPERUSER_ID
import logging
@@ -82,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]
@@ -102,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= "
@@ -215,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):
@@ -261,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'):
@@ -270,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
@@ -353,7 +360,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 = []
@@ -361,7 +367,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',
@@ -508,8 +514,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:
@@ -517,7 +524,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 = []
@@ -555,15 +569,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
@@ -581,13 +594,13 @@ class AccountBankStatementLine(models.Model):
def show_account_move(self):
self.ensure_one()
action = self.env['ir.actions.act_window'].for_xml_id(
'account', 'action_move_journal_line')
'account', 'action_move_line_form')
if self.journal_entry_ids:
action.update({
'views': False,
'view_id': False,
'view_mode': 'form,tree',
'res_id': self.journal_entry_ids[0].id,
'res_id': self.journal_entry_ids[0].move_id.id,
})
return action
else:
@@ -659,3 +672,35 @@ class AccountIncoterms(models.Model):
for rec in self:
res.append((rec.id, '[%s] %s' % (rec.code, rec.name)))
return res
class AccountReconciliation(models.AbstractModel):
_inherit = 'account.reconciliation.widget'
# Add ability to filter by account code in the work interface of the
# bank statement
@api.model
def _domain_move_lines(self, 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
@api.model
def _domain_move_lines_for_reconciliation(
self, st_line, aml_accounts, partner_id,
excluded_ids=None, search_str=False):
domain = super()._domain_move_lines_for_reconciliation(
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]
return domain
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
transfer_account_id = fields.Many2one(
related='company_id.transfer_account_id', readonly=False)

View File

@@ -1,53 +1,13 @@
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index 8ed1e48..615da43 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -563,7 +563,13 @@ class AccountBankStatementLine(models.Model):
"""
# Blue lines = payment on bank account not assigned to a statement yet
reconciliation_aml_accounts = [self.journal_id.default_credit_account_id.id, self.journal_id.default_debit_account_id.id]
- domain_reconciliation = ['&', '&', ('statement_id', '=', False), ('account_id', 'in', reconciliation_aml_accounts), ('payment_id','<>', False)]
+ # AKRETION HACK 11/7/2017
+ # Remove ('payment_id','<>', False) in order to allow to select move lines
+ # generated from payment orders or check deposit
+ # but I add ('journal_id', '=', self.journal_id.id) to exclude the
+ # opening entry of the first fiscal year
+ #domain_reconciliation = ['&', '&', ('statement_id', '=', False), ('account_id', 'in', reconciliation_aml_accounts), ('payment_id','<>', False)]
+ domain_reconciliation = ['&', '&', ('statement_id', '=', False), ('account_id', 'in', reconciliation_aml_accounts), ('journal_id', '=', self.journal_id.id)]
# Black lines = unreconciled & (not linked to a payment or open balance created by statement
domain_matching = [('reconciled', '=', False)]
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index b60ffbe..6c27c57 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -599,6 +599,7 @@ class AccountMoveLine(models.Model):
domain = expression.AND([domain, [('id', 'not in', excluded_ids)]])
if str:
str_domain = [
+ '|', ('account_id.code', '=ilike', str + '%'),
'|', ('move_id.name', 'ilike', str),
'|', ('move_id.ref', 'ilike', str),
'|', ('date_maturity', 'like', str),
diff --git a/addons/account/static/src/js/account_reconciliation_widgets.js b/addons/account/static/src/js/account_reconciliation_widgets.js
index 453bd41..48c396e 100644
--- a/addons/account/static/src/js/account_reconciliation_widgets.js
+++ b/addons/account/static/src/js/account_reconciliation_widgets.js
@@ -76,7 +76,7 @@ var abstractReconciliation = Widget.extend(ControlPanelMixin, {
this.model_res_users = new Model("res.users");
this.model_tax = new Model("account.tax");
this.model_presets = new Model("account.reconcile.model");
- this.max_move_lines_displayed = 5;
+ this.max_move_lines_displayed = 15;
// Number of reconciliations loaded initially and by clicking 'show more'
this.num_reconciliations_fetched_in_batch = 10;
this.animation_speed = 100; // "Blocking" animations
@@ -1755,7 +1755,7 @@ var bankStatementReconciliationLine = abstractReconciliationLine.extend({
relation: "res.partner",
string: _t("Partner"),
type: "many2one",
- domain: [['parent_id','=',false], '|', ['customer','=',true], ['supplier','=',true]],
+ domain: [['parent_id','=',false]], // AKRETION HACK 26/6/2017 allow all parent partners
help: "",
readonly: false,
required: true,
diff --git a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js
index 53f28e0c620..1721d01edf9 100644
--- a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js
+++ b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js
@@ -514,7 +514,7 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
}
return this.model.makeRecord('account.bank.statement.line', [field], {
partner_id: {
- domain: ["|", ["is_company", "=", true], ["parent_id", "=", false], "|", ["customer", "=", true], ["supplier", "=", true]],
+ domain: ["|", ["is_company", "=", true], ["parent_id", "=", false]],
options: {
no_open: true
}

View File

@@ -1,14 +0,0 @@
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index 4374528..aea1361 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -1008,7 +1008,7 @@ class AccountBankStatementLine(models.Model):
#record the move name on the statement line to be able to retrieve it in case of unreconciliation
self.write({'move_name': move.name})
payment.write({'payment_reference': move.name})
- elif self.move_name:
- raise UserError(_('Operation not allowed. Since your statement line already received a number, you cannot reconcile it entirely with existing journal entries otherwise it would make a gap in the numbering. You should book an entry and make a regular revert of it in case you want to cancel it.'))
+ #elif self.move_name:
+ # raise UserError(_('Operation not allowed. Since your statement line already received a number, you cannot reconcile it entirely with existing journal entries otherwise it would make a gap in the numbering. You should book an entry and make a regular revert of it in case you want to cancel it.'))
counterpart_moves.assert_balanced()
return counterpart_moves

View File

@@ -360,8 +360,9 @@ module -->
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<!-- Move reconcile_id to a better position -->
<field name="full_reconcile_id" position="replace"/>
<field name="full_reconcile_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="credit" position="after">
<field name="balance" sum="Total Balance"/>
<field name="reconcile_string"/>
@@ -408,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>
@@ -440,16 +466,32 @@ module -->
<xpath expr="//field[@name='line_ids']/tree/field[@name='bank_account_id']" position="after">
<!-- The cancel button is provided by the account_cancel module, but we don't want to depend on it -->
<button name="show_account_move" type="object"
string="View Account Move" icon="fa fa-arrow-right"
string="View Account Move" icon="fa-arrow-right"
attrs="{'invisible': [('journal_entry_ids', '=', [])]}"/>
</xpath>
<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>
@@ -537,6 +579,28 @@ module -->
<menuitem id="account_tax_group_menu" action="account_tax_group_action" parent="account.account_account_menu" sequence="2"/>
<!-- Account config page -->
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">account_usability account config page</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='account_bank_reconciliation_start']/../.." position="after">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane"/>
<div class="o_setting_right_pane">
<label for="transfer_account_id"/>
<div class="text-muted">
Transit account when you transfer money from a bank account of your company to another bank account of your company.
</div>
<field name="transfer_account_id"/>
</div>
</div>
</xpath>
</field>
</record>
<!-- Remove menu entry "Accounting > Configuration > Accounting > Bank Accounts"
(account.journal filtered on type = 'bank' with special tree and form view)
because it is useless and confusing -->

View File

@@ -1,33 +1,33 @@
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index b1d8012329d..b8a8e2a673d 100644
index f38f459c533..a475d6a82c7 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -210,6 +210,7 @@ class account_payment(models.Model):
@@ -62,6 +62,7 @@ class account_abstract_payment(models.AbstractModel):
payment_difference = fields.Monetary(compute='_compute_payment_difference', readonly=True)
payment_difference_handling = fields.Selection([('open', 'Keep open'), ('reconcile', 'Mark invoice as fully paid')], default='open', string="Payment Difference", copy=False)
payment_difference_handling = fields.Selection([('open', 'Keep open'), ('reconcile', 'Mark invoice as fully paid')], default='open', string="Payment Difference Handling", copy=False)
writeoff_account_id = fields.Many2one('account.account', string="Difference Account", domain=[('deprecated', '=', False)], copy=False)
+ writeoff_analytic_account_id = fields.Many2one('account.analytic.account', string="Difference Analytic Account", copy=False)
# FIXME: ondelete='restrict' not working (eg. cancel a bank statement reconciliation with a payment)
move_line_ids = fields.One2many('account.move.line', 'payment_id', readonly=True, copy=False, ondelete='restrict')
@@ -431,6 +432,7 @@ class account_payment(models.Model):
amount_currency_wo = -abs(amount_currency_wo)
writeoff_line['name'] = _('Counterpart')
writeoff_label = fields.Char(
string='Journal Item Label',
help='Change label of the counterpart that will hold the payment difference',
@@ -717,6 +718,7 @@ class account_payment(models.Model):
debit_wo, credit_wo, amount_currency_wo, currency_id = aml_obj.with_context(date=self.payment_date)._compute_amount_fields(self.payment_difference, self.currency_id, self.company_id.currency_id)
writeoff_line['name'] = self.writeoff_label
writeoff_line['account_id'] = self.writeoff_account_id.id
+ writeoff_line['analytic_account_id'] = self.writeoff_analytic_account_id.id or False
writeoff_line['debit'] = debit_wo
writeoff_line['credit'] = credit_wo
writeoff_line['amount_currency'] = amount_currency_wo
diff --git a/addons/account/views/account_payment_view.xml b/addons/account/views/account_payment_view.xml
index 2460458fbaa..4065d8f9952 100644
index 07230902ee8..1359009bf23 100644
--- a/addons/account/views/account_payment_view.xml
+++ b/addons/account/views/account_payment_view.xml
@@ -206,6 +206,8 @@
</div>
<field name="writeoff_account_id" string="Post Difference In"
attrs="{'invisible': [('payment_difference_handling','=','open')], 'required': [('payment_difference_handling', '=', 'reconcile')]}"/>
+ <field name="writeoff_analytic_account_id" string="Post Difference In Analytic Account"
+ attrs="{'invisible': [('payment_difference_handling','=','open')]}"/>
</group>
</group>
</sheet>
@@ -277,6 +277,8 @@
<div attrs="{'invisible': [('payment_difference_handling','=','open')]}">
<label for="writeoff_account_id" class="oe_edit_only" string="Post Difference In"/>
<field name="writeoff_account_id" string="Post Difference In" attrs="{'required': [('payment_difference_handling', '=', 'reconcile')]}"/>
+ <label for="writeoff_analytic_account_id" class="oe_edit_only" string="Analytic Account" groups="analytic.group_analytic_accounting"/>
+ <field name="writeoff_analytic_account_id" groups="analytic.group_analytic_accounting"/>
<label for="journal_id" string="Journal" attrs="{'invisible': [('amount', '!=', 0)]}"/>
<field name="journal_id" string="Journal" widget="selection" attrs="{'invisible': [('amount', '!=', 0)]}"/>
<label for="writeoff_label" class="oe_edit_only" string="Label"/>

View File

@@ -0,0 +1,2 @@
* Alexis de Lattre <alexis.delattre@akretion.com>
* David Beal <david.beal@akretion.com>

View File

@@ -0,0 +1,39 @@
This modules adds the following functions:
* Add an *Overdue* filter on invoice search view (this feature was previously
located in te module *account_invoice_overdue_filter*)
* Increase the default limit of 80 lines in account move and account move line view.
* disable reconciliation "guessing"
* fast search on *Reconcile Ref* for account move line.
* add sale dates to invoice report to be compliant with
https://www.service-public.fr/professionnels-entreprises/vosdroits/F31808
* Sale date on qweb invoices
* A wizard to mark several invoices as sent at once (forward from v8)
* Default date for Account Move Reversal is now D+1 instead of today
* Track more fields on invoice (see details in account.py)
* Add boolean fields `has_discount` and `has_attachment` on invoice
* Add button "Delete line qty = 0" on supplier invoice
* Cut name_get() of invoice if too long
* A script for if Odoo screws up invoice attachment filename
* help functions for py3o reports
* Show code on name_get of journal
* add direct search of journal using code
* add copy=False on some fields
* Add unicity constraint on analytic codes per company
* Better default values on account move
* Add link from account move line to invoice
* Add start_date and end_date on bank statements
* Add transfer_account_id to invoicing config page
* Improve domain reconciliation widget
* account.reconcile.model don't copy name to label via onchange
* Add method to get fiscal position without partner_id
* Restore drill-through on sale and invoice reports
* 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
Together with this module, I recommend the use of the following modules:
* account_invoice_supplier_ref_unique (OCA project account-invoicing)
* account_move_line_no_default_search (OCA project account-financial-tools)
* invoice_fiscal_position_update (OCA project account-invoicing)

View File

@@ -0,0 +1,454 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Account Usability</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="account-usability">
<h1 class="title">Account Usability</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/account_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<p>This modules adds the following functions:</p>
<ul class="simple">
<li>Add an <em>Overdue</em> filter on invoice search view (this feature was previously
located in te module <em>account_invoice_overdue_filter</em>)</li>
<li>Increase the default limit of 80 lines in account move and account move line view.</li>
<li>disable reconciliation “guessing”</li>
<li>fast search on <em>Reconcile Ref</em> for account move line.</li>
<li>add sale dates to invoice report to be compliant with
<a class="reference external" href="https://www.service-public.fr/professionnels-entreprises/vosdroits/F31808">https://www.service-public.fr/professionnels-entreprises/vosdroits/F31808</a></li>
<li>Sale date on qweb invoices</li>
<li>A wizard to mark several invoices as sent at once (forward from v8)</li>
<li>Default date for Account Move Reversal is now D+1 instead of today</li>
<li>Track more fields on invoice (see details in account.py)</li>
<li>Add boolean fields <cite>has_discount</cite> and <cite>has_attachment</cite> on invoice</li>
<li>Add button “Delete line qty = 0” on supplier invoice</li>
<li>Cut name_get() of invoice if too long</li>
<li>A script for if Odoo screws up invoice attachment filename</li>
<li>help functions for py3o reports</li>
<li>Show code on name_get of journal</li>
<li>add direct search of journal using code</li>
<li>add copy=False on some fields</li>
<li>Add unicity constraint on analytic codes per company</li>
<li>Better default values on account move</li>
<li>Add link from account move line to invoice</li>
<li>Add start_date and end_date on bank statements</li>
<li>Add transfer_account_id to invoicing config page</li>
<li>Improve domain reconciliation widget</li>
<li>account.reconcile.model dont copy name to label via onchange</li>
<li>Add method to get fiscal position without partner_id</li>
<li>Restore drill-through on sale and invoice reports</li>
<li>dont attach PDF upon invoice report generation on supplier invoices/refunds</li>
<li>Add filter on debit and credit amount for Move Lines</li>
<li>Add supplier invoice number in invoice tree view</li>
</ul>
<p>Together with this module, I recommend the use of the following modules:</p>
<ul class="simple">
<li>account_invoice_supplier_ref_unique (OCA project account-invoicing)</li>
<li>account_move_line_no_default_search (OCA project account-financial-tools)</li>
<li>invoice_fiscal_position_update (OCA project account-invoicing)</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/akretion/odoo-usability/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/akretion/odoo-usability/issues/new?body=module:%20account_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</li>
<li>David Beal &lt;<a class="reference external" href="mailto:david.beal&#64;akretion.com">david.beal&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/account_usability">akretion/odoo-usability</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,61 @@
======================
Base Company Extension
======================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github
:target: https://github.com/akretion/odoo-usability/tree/12.0/base_company_extension
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
This module adds the following fields to the ResCompany model:
* Capital Amount
* Legal Type
This is useful to display the legal name of the company in reports
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/akretion/odoo-usability/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/akretion/odoo-usability/issues/new?body=module:%20base_company_extension%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Akretion
Contributors
~~~~~~~~~~~~
* Alexis de Lattre <alexis.delattre@akretion.com>
Maintainers
~~~~~~~~~~~
This module is part of the `akretion/odoo-usability <https://github.com/akretion/odoo-usability/tree/12.0/base_company_extension>`_ project on GitHub.
You are welcome to contribute.

View File

@@ -9,16 +9,6 @@
'category': 'Partner',
'license': 'AGPL-3',
'summary': 'Adds capital and title on company',
'description': """
Base Company Extension
======================
This module adds 2 fields on the Company :
* *Capital Amount*
* *Legal Form*
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
# I depend on base_usability only for _report_company_legal_name()

View File

@@ -0,0 +1 @@
* Alexis de Lattre <alexis.delattre@akretion.com>

View File

@@ -0,0 +1,5 @@
This module adds the following fields to the ResCompany model:
* Capital Amount
* Legal Type
This is useful to display the legal name of the company in reports

View File

@@ -0,0 +1,417 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Base Company Extension</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="base-company-extension">
<h1 class="title">Base Company Extension</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/base_company_extension"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<p>This module adds the following fields to the ResCompany model:
* Capital Amount
* Legal Type</p>
<p>This is useful to display the legal name of the company in reports</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/akretion/odoo-usability/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/akretion/odoo-usability/issues/new?body=module:%20base_company_extension%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/base_company_extension">akretion/odoo-usability</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -2,13 +2,14 @@
# @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
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
ref = fields.Char(copy=False) # To avoid blocking duplicate
invalidate_display_name = fields.Boolean()
_sql_constraints = [(
'ref_unique',
@@ -16,6 +17,11 @@ class ResPartner(models.Model):
'A partner already exists with this internal reference!'
)]
# add 'ref' in depends
@api.depends('is_company', 'name', 'parent_id.name', 'type', 'company_name', 'ref', 'invalidate_display_name')
def _compute_display_name(self):
super(ResPartner, self)._compute_display_name()
def _get_name(self):
partner = self
name = partner.name or ''

82
base_usability/README.rst Normal file
View File

@@ -0,0 +1,82 @@
==============
Base Usability
==============
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github
:target: https://github.com/akretion/odoo-usability/tree/12.0/base_usability
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
This module adds the following functions:
* Adds *track_visibility='onchange'* on all the important fields of the Partner object
* By default, Odoo doesn't display the title field on all the partner form views. This module fixes it (it replaces the module base_title_on_partner)
* Adds a log message at INFO level when sending an email via SMTP
* Displays the local modules with installable filter
* A group by "State" is added to module search view
* Provides a _display_report_header method on the res.company object and _display_full_address on res.partner which are useful for reporting.
* Add model in cron tree view
* Add prefix field in sequence search view
* Better search and form view for country and state
* Display technical name of modules in kanban view
* Change module filter to `installable`
* Add widget=handle on sequence of res.partner.bank
* Add city and country in partner tree view
* Add widget="email" on email of contacts
* Add script to fix partners related to users in multi-company setup
* Add methods for py3o reports
* Add name_get() on ir.model
* Language wizard defaults to ".po"
* Add tracking on partner fields
* Handle lang in name_title field
* Remove empty lines in address
* Add bank Name field on res.partner.bank
* Partners auto-created for users are Suppliers and not Customers
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/akretion/odoo-usability/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/akretion/odoo-usability/issues/new?body=module:%20base_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Akretion
Contributors
~~~~~~~~~~~~
* Alexis de Lattre <alexis.delattre@akretion.com>
* David Beal <david.beal@akretion.com>
Maintainers
~~~~~~~~~~~
This module is part of the `akretion/odoo-usability <https://github.com/akretion/odoo-usability/tree/12.0/base_usability>`_ project on GitHub.
You are welcome to contribute.

View File

@@ -8,22 +8,6 @@
'category': 'Partner',
'license': 'AGPL-3',
'summary': 'Better usability in base module',
'description': """
Base Usability
==============
This module adds *track_visibility='onchange'* on all the important fields of the Partner object.
By default, Odoo doesn't display the title field on all the partner form views. This module fixes it (it replaces the module base_title_on_partner).
It also adds a log message at INFO level when sending an email via SMTP.
It displays the local modules with installable filter.
A group by 'State' is added to module search view.
It provides a _display_report_header method on the res.company object and
_display_full_address on res.partner which are useful for reporting.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['base'],

View File

@@ -0,0 +1,3 @@
* Alexis de Lattre <alexis.delattre@akretion.com>
* Raphaël Valyi <rvalyi@akretion.com>
* David Beal <david.beal@akretion.com>

View File

@@ -0,0 +1,25 @@
This module adds the following functions:
* Adds *track_visibility='onchange'* on all the important fields of the Partner object
* By default, Odoo doesn't display the title field on all the partner form views. This module fixes it (it replaces the module base_title_on_partner)
* Adds a log message at INFO level when sending an email via SMTP
* Displays the local modules with installable filter
* A group by "State" is added to module search view
* Provides a _display_report_header method on the res.company object and _display_full_address on res.partner which are useful for reporting.
* Add model in cron tree view
* Add prefix field in sequence search view
* Better search and form view for country and state
* Display technical name of modules in kanban view
* Change module filter to `installable`
* Add widget=handle on sequence of res.partner.bank
* Add city and country in partner tree view
* Add widget="email" on email of contacts
* Add script to fix partners related to users in multi-company setup
* Add methods for py3o reports
* Add name_get() on ir.model
* Language wizard defaults to ".po"
* Add tracking on partner fields
* Handle lang in name_title field
* Remove empty lines in address
* Add bank Name field on res.partner.bank
* Partners auto-created for users are Suppliers and not Customers

View File

@@ -0,0 +1,440 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Base Usability</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="base-usability">
<h1 class="title">Base Usability</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/base_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<p>This module adds the following functions:</p>
<ul class="simple">
<li>Adds <em>track_visibility=onchange</em> on all the important fields of the Partner object</li>
<li>By default, Odoo doesnt display the title field on all the partner form views. This module fixes it (it replaces the module base_title_on_partner)</li>
<li>Adds a log message at INFO level when sending an email via SMTP</li>
<li>Displays the local modules with installable filter</li>
<li>A group by “State” is added to module search view</li>
<li>Provides a _display_report_header method on the res.company object and _display_full_address on res.partner which are useful for reporting.</li>
<li>Add model in cron tree view</li>
<li>Add prefix field in sequence search view</li>
<li>Better search and form view for country and state</li>
<li>Display technical name of modules in kanban view</li>
<li>Change module filter to <cite>installable</cite></li>
<li>Add widget=handle on sequence of res.partner.bank</li>
<li>Add city and country in partner tree view</li>
<li>Add widget=”email” on email of contacts</li>
<li>Add script to fix partners related to users in multi-company setup</li>
<li>Add methods for py3o reports</li>
<li>Add name_get() on ir.model</li>
<li>Language wizard defaults to “.po”</li>
<li>Add tracking on partner fields</li>
<li>Handle lang in name_title field</li>
<li>Remove empty lines in address</li>
<li>Add bank Name field on res.partner.bank</li>
<li>Partners auto-created for users are Suppliers and not Customers</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/akretion/odoo-usability/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/akretion/odoo-usability/issues/new?body=module:%20base_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</li>
<li>David Beal &lt;<a class="reference external" href="mailto:david.beal&#64;akretion.com">david.beal&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/base_usability">akretion/odoo-usability</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -12,4 +12,14 @@
</field>
</record>
<record id="view_sequence_search" model="ir.ui.view">
<field name="model">ir.sequence</field>
<field name="inherit_id" ref="base.view_sequence_search"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="prefix"/>
</field>
</field>
</record>
</odoo>

View File

@@ -12,7 +12,7 @@
<field name="model">ir.module.module</field>
<field name="inherit_id" ref="base.module_view_kanban"/>
<field name="arch" type="xml">
<xpath expr="//h4[@class='o_kanban_record_title']/code[@groups='base.group_no_one']" position="before">
<xpath expr="//h4[hasclass('o_kanban_record_title')]/code[@groups='base.group_no_one']" position="before">
<br/>
</xpath>
</field>

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>
@@ -61,6 +57,9 @@
<!-- for 'ref', change '=' to 'start with' -->
<attribute name="filter_domain">['|','|',('display_name','ilike',self),('ref','=ilike',self + '%'),('email','ilike',self)]</attribute>
</field>
<filter name="inactive" position="before">
<separator/>
</filter>
</field>
</record>

View File

@@ -20,8 +20,7 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
# 'depends': ['intrastat_product', 'l10n_fr_intrastat_service'],
'depends': ['intrastat_product'],
'depends': ['intrastat_product', 'l10n_fr_intrastat_service'],
'data': ['product_view.xml'],
'post_init_hook': 'set_intrastat_type_on_products',
'installable': True,

View File

@@ -60,14 +60,14 @@ class ProductTemplate(models.Model):
return super(ProductTemplate, self).create(vals)
#class L10nFrIntrastatServiceDeclaration(models.Model):
# _inherit = "l10n.fr.intrastat.service.declaration"
class L10nFrIntrastatServiceDeclaration(models.Model):
_inherit = "l10n.fr.intrastat.service.declaration"
# def _is_service(self, invoice_line):
# if invoice_line.product_id.intrastat_type == 'service':
# return True
# else:
# return False
def _is_service(self, invoice_line):
if invoice_line.product_id.intrastat_type == 'service':
return True
else:
return False
class IntrastatProductDeclaration(models.Model):

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

@@ -17,7 +17,7 @@ MRP Usability
:target: https://github.com/akretion/odoo-usability/tree/12.0/mrp_usability
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
|badge1| |badge2| |badge3|
Small usability improvements on MRP:
@@ -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

@@ -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,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

@@ -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

@@ -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

View File

@@ -0,0 +1,29 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "POS Usability",
"version": "12.0.1.0.0",
"category": "Point of sale",
"license": "AGPL-3",
"summary": "Misc usability improvement for point of sale",
"description": """
POS Usability
=============
- Sales Details report : add sub total amount by tax
authors
-------
Akretion:
* David Béal <david.beal@akretion.com>
""",
"author": "Akretion",
"website": "http://www.akretion.com",
"depends": ["point_of_sale"],
"data": ["report/pos.xml"],
"installable": True,
}

23
pos_usability/i18n/fr.po Normal file
View File

@@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_usability
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-11 13:11+0000\n"
"PO-Revision-Date: 2019-10-11 15:11+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 2.0.6\n"
#. module: pos_usability
#: model_terms:ir.ui.view,arch_db:pos_usability.report_saledetails
msgid "Amount"
msgstr "Montant"

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_saledetails" inherit_id="point_of_sale.report_saledetails">
<xpath expr="//table[3]/thead/tr/th[3]" position="after">
<th>Amount</th>
</xpath>
<xpath expr="//table[3]/tbody/tr" position="inside">
<td><t t-esc="tax['tax_amount'] + tax['base_amount']"
t-options="{'widget': 'float', 'precision': currency_precision}" /></td>
</xpath>
</template>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -4,7 +4,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
from odoo.tools.safe_eval import safe_eval
class ProductProduct(models.Model):
@@ -43,6 +42,5 @@ class ProductProduct(models.Model):
self.ensure_one()
action = self.env.ref(
'product_usability.product_price_history_action').read()[0]
action['domain'] = safe_eval(action['domain'])
action['domain'].append(('product_id', '=', self.id))
action['domain'] = [('product_id', '=', self.id)]
return action

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,419 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
<title>MRP Usability</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="mrp-usability">
<h1 class="title">MRP Usability</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/mrp_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<p>Small usability improvements on MRP:</p>
<ul class="simple">
<li>order by id desc</li>
<li>show field date_start and date_finished on mrp.production form view</li>
<li>show more fields on stock move form</li>
<li>show bom type in tree view + add group by</li>
<li>complete Manufacturing Order report with unvailable products</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/akretion/odoo-usability/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/akretion/odoo-usability/issues/new?body=module:%20mrp_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<p>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/mrp_usability">akretion/odoo-usability</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -16,8 +16,8 @@
<field name="product_name"/>
<field name="product_code" string="Supplier Code"/>
</field>
<field name="price" position="after">
<field name="currency_id" groups="base.group_multi_currency"/>
<field name="currency_id" position="after">
<field name="delay"/>
</field>
<field name="min_qty" position="after">
<field name="product_uom" groups="uom.group_uom"/>

View File

@@ -0,0 +1,63 @@
==================
Purchase Usability
==================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github
:target: https://github.com/akretion/odoo-usability/tree/12.0/purchase_usability
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
This module adds the following functions:
- Track visibility on partner and product purchase warning
- Track visibility on Purchase Order warning
- Methods to help generate py3o purchase reports
- Use untaxed amount in name_get of purchase orders
- Protect Cancel button with a confirmation pop-up
- Misc. improvements to Purchase Order Line views
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/akretion/odoo-usability/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/akretion/odoo-usability/issues/new?body=module:%20purchase_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Akretion
Contributors
~~~~~~~~~~~~
* Alexis de Lattre <alexis.delattre@akretion.com>
Maintainers
~~~~~~~~~~~
This module is part of the `akretion/odoo-usability <https://github.com/akretion/odoo-usability/tree/12.0/purchase_usability>`_ project on GitHub.
You are welcome to contribute.

View File

@@ -8,14 +8,6 @@
'category': 'Purchases',
'license': 'AGPL-3',
'summary': 'Usability improvements on purchase module',
'description': """
Purchase Usability
==================
Several usability improvements on the official purchase module:
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['purchase'],

View File

@@ -0,0 +1 @@
* Alexis de Lattre <alexis.delattre@akretion.com>

View File

@@ -0,0 +1,7 @@
This module adds the following functions:
- Track visibility on partner and product purchase warning
- Track visibility on Purchase Order warning
- Methods to help generate py3o purchase reports
- Use untaxed amount in name_get of purchase orders
- Protect Cancel button with a confirmation pop-up
- Misc. improvements to Purchase Order Line views

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,425 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Purchase Usability</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="purchase-usability">
<h1 class="title">Purchase Usability</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/purchase_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
<dt>This module adds the following functions:</dt>
<dd><ul class="first last simple">
<li>Track visibility on partner and product purchase warning</li>
<li>Track visibility on Purchase Order warning</li>
<li>Methods to help generate py3o purchase reports</li>
<li>Use untaxed amount in name_get of purchase orders</li>
<li>Protect Cancel button with a confirmation pop-up</li>
<li>Misc. improvements to Purchase Order Line views</li>
</ul>
</dd>
</dl>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/akretion/odoo-usability/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/akretion/odoo-usability/issues/new?body=module:%20purchase_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/purchase_usability">akretion/odoo-usability</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

View File

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

View File

@@ -0,0 +1,35 @@
# Copyright 2019 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': 'Sale Down Payment',
'version': '12.0.1.0.0',
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Link payment to sale orders',
'description': """
Sale Down Payment
=================
This module adds a link between payments and sale orders. It allows to see down payments directly on the sale order form view.
After processing a bank statement, you can start a wizard to link unreconciled incoming payments to a sale order. There is also a button *Register Payment* on the sale order.
This module targets B2B companies that don't want to generate a down payment invoice for an advanced payment.
This module has been written by Alexis de Lattre from Akretion
<alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['sale'],
'data': [
'wizard/account_bank_statement_sale_view.xml',
'views/account_bank_statement.xml',
'views/sale.xml',
'views/account_move_line.xml',
'views/account_payment.xml',
],
'installable': True,
}

View File

@@ -0,0 +1,3 @@
from . import sale
from . import account_move_line
from . import account_payment

View File

@@ -0,0 +1,32 @@
# Copyright 2019 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
sale_id = fields.Many2one('sale.order', string='Sale Order')
account_internal_type = fields.Selection(
related='account_id.user_type_id.type', store=True,
string='Account Internal Type')
@api.constrains('sale_id', 'account_id')
def sale_id_check(self):
for line in self:
if line.sale_id and line.account_id.internal_type != 'receivable':
raise ValidationError(_(
"The account move line '%s' is linked to sale order '%s' "
"but it uses account '%s' which is not a receivable "
"account.")
% (line.name,
line.sale_id.name,
line.account_id.display_name))
@api.onchange('account_id')
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

View File

@@ -0,0 +1,59 @@
# Copyright 2019 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.tools import float_round
class AccountPayment(models.Model):
_inherit = 'account.payment'
sale_id = fields.Many2one('sale.order', string='Sale Order')
def action_validate_invoice_payment(self):
if self.sale_id:
self.post()
else:
return super(AccountPayment, self).\
action_validate_invoice_payment()
def _get_counterpart_move_line_vals(self, invoice=False):
res = super(AccountPayment, self)._get_counterpart_move_line_vals(
invoice=invoice)
if self.sale_id:
res['sale_id'] = self.sale_id.id
return res
class AccountAbstractPayment(models.AbstractModel):
_inherit = "account.abstract.payment"
def default_get(self, fields_list):
res = super(AccountAbstractPayment, self).default_get(fields_list)
if (
self._context.get('active_model') == 'sale.order' and
self._context.get('active_id')):
so = self.env['sale.order'].browse(self._context['active_id'])
res.update({
'amount': so.amount_total,
'currency_id': so.currency_id.id,
'payment_type': 'inbound',
'partner_id': so.partner_invoice_id.commercial_partner_id.id,
'partner_type': 'customer',
'communication': so.name,
'sale_id': so.id,
})
return res
def _compute_payment_amount(self, invoices=None, currency=None):
amount = super(AccountAbstractPayment, self)._compute_payment_amount(
invoices=invoices, currency=currency)
if self.sale_id:
payment_currency = currency
if not payment_currency:
payment_currency = self.sale_id.currency_id
amount = float_round(
self.sale_id.amount_total - self.sale_id.amount_down_payment,
precision_rounding=payment_currency.rounding)
return amount

View File

@@ -0,0 +1,48 @@
# Copyright 2019 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.tools import float_round
class SaleOrder(models.Model):
_inherit = 'sale.order'
payment_line_ids = fields.One2many(
'account.move.line', 'sale_id', string='Advance Payments',
readonly=True)
amount_down_payment = fields.Monetary(
compute='_compute_amount_down_payment', string='Down Payment Amount')
# amount_residual : only used to hide 'Register Payment' button
amount_residual = fields.Monetary(
compute='_compute_amount_down_payment', string='Residual')
@api.depends(
'payment_line_ids.credit', 'payment_line_ids.debit',
'payment_line_ids.amount_currency', 'payment_line_ids.currency_id',
'payment_line_ids.date', 'currency_id')
def _compute_amount_down_payment(self):
for sale in self:
down_payment = 0.0
sale_currency = sale.pricelist_id.currency_id
if sale_currency == sale.company_id.currency_id:
for pl in sale.payment_line_ids:
down_payment -= pl.balance
else:
for pl in sale.payment_line_ids:
if (
pl.currency_id and
pl.currency_id == sale_currency and
pl.amount_currency):
down_payment -= pl.amount_currency
else:
down_payment -= sale.company_id.currency_id._convert(
pl.balance, sale_currency, sale.company_id,
pl.date)
down_payment = float_round(
down_payment, precision_rounding=sale.currency_id.rounding)
sale.amount_down_payment = down_payment
sale.amount_residual = float_round(
sale.amount_total - down_payment,
precision_rounding=sale.currency_id.rounding)

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_bank_statement_form" model="ir.ui.view">
<field name="name">advance_payment.account.bank.statement.form</field>
<field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml">
<button name="check_confirm_bank" position="after">
<button name="%(account_bank_statement_sale_action)d" type="action" string="Link to Quotation/Sale Orders"/>
</button>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="view_move_line_form" model="ir.ui.view">
<field name="name">advance_payment.account.move.line.form</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_form"/>
<field name="arch" type="xml">
<field name="invoice_id" position="after">
<field name="sale_id" attrs="{'invisible': [('account_internal_type', '!=', 'receivable')]}" domain="['|', ('partner_id', 'child_of', partner_id), ('partner_invoice_id', 'child_of', partner_id), ('state', '!=', 'cancel'), ('invoice_status', '!=', 'invoiced')]"/>
<field name="account_internal_type" invisible="1"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 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_account_payment_sale_form" model="ir.ui.view">
<field name="name">account.payment.sale.form</field>
<field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_invoice_form"/>
<field name="arch" type="xml">
<field name="invoice_ids" position="after">
<field name="sale_id" invisible="1"/>
</field>
</field>
</record>
</odoo>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="sale_account_payment_action" model="ir.actions.act_window">
<field name="name">Register Payment</field>
<field name="res_model">account.payment</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account.view_account_payment_invoice_form"/>
<field name="target">new</field>
</record>
<record id="view_order_form" model="ir.ui.view">
<field name="name">advance_payment.sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page name="advance_payment" string="Advance Payments">
<field name="payment_line_ids" nolabel="1"/>
<field name="amount_residual" invisible="1"/>
</page>
</notebook>
<field name="amount_total" position="after">
<div class="oe_subtotal_footer_separator oe_inline o_td_label">
<label for="amount_down_payment" />
</div>
<field name="amount_down_payment" nolabel="1" class="oe_subtotal_footer_separator"/>
</field>
<button name="action_cancel" position="before">
<button type="action" name="%(sale_account_payment_action)d" string="Register Payment" attrs="{'invisible': ['|', ('amount_residual', '&lt;=', 0), ('invoice_status', '=', 'invoiced')]}"/>
</button>
</field>
</record>
</odoo>

View File

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

View File

@@ -0,0 +1,86 @@
# Copyright 2019 Akretion France (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class AccountBankStatementSale(models.TransientModel):
_name = 'account.bank.statement.sale'
_description = 'Account Bank Statement Sale'
statement_id = fields.Many2one('account.bank.statement', readonly=True)
line_ids = fields.One2many(
'account.bank.statement.sale.line', 'wizard_id', string='Lines')
@api.model
def _prepare_line(self, move_line):
vals = {
'move_line_id': move_line.id,
'sale_id': move_line.sale_id.id or False,
'date': move_line.date,
'credit': move_line.credit,
'partner_id': move_line.partner_id.id,
'account_id': move_line.account_id.id,
'name': move_line.name,
'company_currency_id': move_line.company_currency_id.id,
}
return vals
@api.model
def default_get(self, fields_list):
res = super(AccountBankStatementSale, self).default_get(fields_list)
assert self._context.get('active_model') == 'account.bank.statement'
statement_id = self._context.get('active_id')
statement = self.env['account.bank.statement'].browse(statement_id)
res.update({
'line_ids': [],
'statement_id': statement_id,
})
for st_line in statement.line_ids:
if (
st_line.amount > 0 and
st_line.partner_id and
st_line.journal_entry_ids):
for line in st_line.journal_entry_ids:
if (
line.account_id.user_type_id.type == 'receivable'
and
line.partner_id and
not line.full_reconcile_id and
not line.matched_debit_ids and
not line.matched_credit_ids):
lvals = self._prepare_line(line)
res['line_ids'].append((0, 0, lvals))
if not res['line_ids']:
raise UserError(_(
"The bank statement '%s' doesn't contain any processed line "
"with a positive amount which is not reconciled.")
% statement.display_name)
return res
def validate(self):
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
class AccountBankStatementSaleLine(models.TransientModel):
_name = 'account.bank.statement.sale.line'
_description = 'Account Bank Statement Sale Lines'
wizard_id = fields.Many2one(
'account.bank.statement.sale', ondelete='cascade')
move_line_id = fields.Many2one(
'account.move.line', string='Move Line', required=True)
date = fields.Date(related='move_line_id.date')
credit = fields.Monetary(
related='move_line_id.credit', currency_field='company_currency_id')
partner_id = fields.Many2one(related='move_line_id.partner_id')
account_id = fields.Many2one(related='move_line_id.account_id')
name = fields.Char(related='move_line_id.name')
company_currency_id = fields.Many2one(
related='move_line_id.company_currency_id')
sale_id = fields.Many2one('sale.order', string='Sale Order')

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="account_bank_statement_sale_form" model="ir.ui.view">
<field name="name">account.bank.statement.sale.form</field>
<field name="model">account.bank.statement.sale</field>
<field name="arch" type="xml">
<form string="Link to Quotation/Sale Orders">
<group name="main" invisible="1">
<field name="statement_id"/>
</group>
<group name="lines">
<field name="line_ids" nolabel="1">
<tree editable="bottom">
<field name="move_line_id" invisible="1"/>
<field name="date"/>
<field name="name"/>
<field name="partner_id"/>
<field name="account_id"/>
<field name="credit"/>
<field name="sale_id" domain="['|', ('partner_id', 'child_of', partner_id), ('partner_invoice_id', 'child_of', partner_id), ('state', '!=', 'cancel'), ('invoice_status', '!=', 'invoiced')]"/>
<field name="company_currency_id" invisible="1"/>
</tree>
</field>
</group>
<footer>
<button name="validate" type="object" string="Validate" class="btn-primary"/>
<button special="cancel" string="Cancel" class="btn-default"/>
</footer>
</form>
</field>
</record>
<record id="account_bank_statement_sale_action" model="ir.actions.act_window">
<field name="name">Link to Quotation/Sale Orders</field>
<field name="res_model">account.bank.statement.sale</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

View File

@@ -10,13 +10,17 @@ class SaleOrder(models.Model):
route_id = fields.Many2one(
'stock.location.route', string='Route',
ondelete='restrict', readonly=True,
ondelete='restrict', readonly=True, track_visibility='onchange',
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
domain=[('sale_selectable', '=', True)])
def _action_confirm(self):
for order in self.filtered(lambda o: o.route_id):
# Caution: take into account the scenario where
# route_id has a value, then SO is cancelled+back to draft,
# then route_id = False and SO is confirmed again
for order in self:
vals = {'route_id': order.route_id.id or False}
order.order_line.filtered(
lambda l: l.product_id.type in ('product', 'consu')).write(
{'route_id': order.route_id.id})
lambda l:
l.product_id.type in ('product', 'consu')).write(vals)
super(SaleOrder, self)._action_confirm()

View File

@@ -12,7 +12,7 @@
Sale Purchase No Product Template
=================================
This module replaces the menu entries for product.template by menu entries for product.product in the *Sales*, *Purchases* and *Warehouse* menu entry. With this module, the only menu entry for product.template is in the menu *Sales > Configuration > Product Categories and Attributes*.
This module replaces the menu entries for product.template by menu entries for product.product in the *Sales* and *Purchases* menu entries. With this module, the only menu entry for product.template is in the menu *Sales > Configuration > Product Categories and Attributes*.
This module also switches to the tree view by default for Product menu entries, instead of the kanban view.

View File

@@ -21,11 +21,6 @@
<field name="action" ref="product_product_action_purchased"/>
</record>
<!-- STOCK -->
<record id="stock.menu_product_variant_config_stock" model="ir.ui.menu">
<field name="action" ref="product.product_normal_action"/>
</record>
<!-- SALE -->
<!-- I'd prefer to inherit product.product_normal_action_sell and
change the "name" field, but it doesn't work with translation,

View File

@@ -50,6 +50,57 @@ msgid "Sales Order Line"
msgstr "Ligne de commandes de vente"
#. module: sale_stock_usability
#: view:stock.picking:sale_stock_usability.view_picking_internal_search_inherit
msgid "[('invoice_state', '=', '2binvoiced'), ('state', '=', 'done')]"
msgstr "[('invoice_state', '=', '2binvoiced'), ('state', '=', 'done')]"
#: 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

@@ -1,54 +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 12:36+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: sale_stock_usability
#: view:sale.order:sale_stock_usability.view_order_form_inherit
msgid "Delivery Orders"
msgstr ""
#. module: sale_stock_usability
#: view:procurement.group:sale_stock_usability.procurement_group_form_view
#: field:procurement.group,picking_ids:0
msgid "Pickings"
msgstr ""
#. module: sale_stock_usability
#: model:ir.model,name:sale_stock_usability.model_procurement_group
msgid "Procurement Requisition"
msgstr ""
#. module: sale_stock_usability
#: view:procurement.group:sale_stock_usability.procurement_group_form_view
#: field:procurement.group,sale_ids:0
msgid "Sale Orders"
msgstr ""
#. module: sale_stock_usability
#: model:ir.model,name:sale_stock_usability.model_sale_order
msgid "Sales Order"
msgstr ""
#. module: sale_stock_usability
#: model:ir.model,name:sale_stock_usability.model_sale_order_line
msgid "Sales Order Line"
msgstr ""
#. module: sale_stock_usability
#: view:stock.picking:sale_stock_usability.view_picking_internal_search_inherit
msgid "[('invoice_state', '=', '2binvoiced'), ('state', '=', 'done')]"
msgstr ""

View File

@@ -2,7 +2,7 @@
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields
from odoo import models, fields, api
class SaleOrder(models.Model):
@@ -10,3 +10,41 @@ class SaleOrder(models.Model):
warehouse_id = fields.Many2one(track_visibility='onchange')
incoterm = fields.Many2one(track_visibility='onchange')
picking_status = fields.Selection([
('delivered', 'Fully Delivered'),
('partially_delivered', 'Partially Delivered'),
('to_deliver', 'To Deliver'),
('cancel', 'Delivery Cancelled'),
('no', 'Nothing to Deliver')
], string='Picking Status', compute='_compute_picking_status',
store=True, readonly=True)
@api.depends('state', 'picking_ids.state')
def _compute_picking_status(self):
"""
Compute the picking status for the SO. Possible statuses:
- no: if the SO is not in status 'sale' nor 'done', we consider that
there is nothing to deliver. This is also the default value if the
conditions of no other status is met.
- cancel: all pickings are cancelled
- delivered: if all pickings are done or cancel.
- partially_delivered: If at least one picking is done.
- to_deliver: if all pickings are in confirmed, assigned, waiting or
cancel state.
"""
for order in self:
picking_status = 'no'
if order.state in ('sale', 'done') and order.picking_ids:
pstates = [
picking.state for picking in order.picking_ids]
if all([state == 'cancel' for state in pstates]):
picking_status = 'cancel'
elif all([state in ('done', 'cancel') for state in pstates]):
picking_status = 'delivered'
elif any([state == 'done' for state in pstates]):
picking_status = 'partially_delivered'
elif all([
state in ('confirmed', 'assigned', 'waiting', 'cancel')
for state in pstates]):
picking_status = 'to_deliver'
order.picking_status = picking_status

View File

@@ -30,4 +30,53 @@
</field>
</record>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale_stock_usability.order.form</field>
<field name="model">sale.order</field>
<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>
</field>
</record>
<record id="view_order_tree" model="ir.ui.view">
<field name="name">sale_stock_usability.order.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml">
<field name="invoice_status" position="before">
<field name="picking_status"/>
</field>
</field>
</record>
<record id="view_sales_order_filter" model="ir.ui.view">
<field name="name">sale_stock_usability.order.search</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="arch" type="xml">
<filter name="my_sale_orders_filter" position="after">
<separator/>
<filter string="Not Fully Delivered" name="not_fully_delivered"
domain="[('picking_status', 'in', ('to_deliver', 'partially_delivered'))]"/>
<filter string="Fully Delivered" name="fully_delivered"
domain="[('picking_status', '=', 'delivered')]"/>
</filter>
</field>
</record>
<record id="procurement_group_form_view" model="ir.ui.view">
<field name="name">sale_stock_usability.procurement.group.form</field>
<field name="model">procurement.group</field>
<field name="inherit_id" ref="stock.procurement_group_form_view"/>
<field name="arch" type="xml">
<field name="move_type" position="after">
<field name="sale_id"/>
</field>
</field>
</record>
</odoo>

73
sale_usability/README.rst Normal file
View File

@@ -0,0 +1,73 @@
==============
Sale Usability
==============
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github
:target: https://github.com/akretion/odoo-usability/tree/12.0/sale_usability
:alt: akretion/odoo-usability
|badge1| |badge2| |badge3|
This modules adds the following functions:
* Display amount untaxed in tree view
* Add sale_ids and sale_count on Invoice
* Methods for py3o sale reports
* Add tracking on partner warning fields
* Add tracking on product fields
* Add tracking on Sale Order fields
* Add menu for Pricelist Items
* Add `has_discount` field on Sale Order
* Restore drill-through on sale and invoice reports
* Move client_order_ref from the second tab to the top
* Protect Cancel button with a confirmation pop-up
* Remove Sale Orders from Quotations menu
* Add Group By Customer on Sales order search view
* Add sum=1 on several quantity fields
* Add Product Category Menu entry
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/akretion/odoo-usability/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/akretion/odoo-usability/issues/new?body=module:%20sale_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Akretion
Contributors
~~~~~~~~~~~~
Alexis de Lattre <alexis.delattre@akretion.com>
Maintainers
~~~~~~~~~~~
This module is part of the `akretion/odoo-usability <https://github.com/akretion/odoo-usability/tree/12.0/sale_usability>`_ project on GitHub.
You are welcome to contribute.

View File

@@ -8,18 +8,6 @@
'category': 'Sales',
'license': 'AGPL-3',
'summary': 'Usability improvements on sale module',
'description': """
Sale Usability
==============
This module provides several small usability improvements on the official *sale* module:
* Display amount untaxed in tree view
* TODO: update this list
This module has been written by Alexis de Lattre from Akretion
<alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': [
@@ -30,6 +18,7 @@ This module has been written by Alexis de Lattre from Akretion
'sale_view.xml',
'sale_report_view.xml',
'product_view.xml',
'account_invoice_view.xml',
],
'installable': True,
}

View File

@@ -2,13 +2,46 @@
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
from odoo import api, fields, models
from collections import OrderedDict
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
# sale_ids is kind of the symetric field of invoice_ids on sale.order
sale_ids = fields.Many2many(
'sale.order', string='Sale Orders', compute="_compute_sale_ids",
readonly=True, copy=False)
sale_count = fields.Integer(
string='Sale Order Count', compute='_compute_sale_ids', readonly=True)
@api.depends('invoice_line_ids.sale_line_ids')
def _compute_sale_ids(self):
for invoice in self:
if invoice.type == 'out_invoice':
sales = invoice.invoice_line_ids.mapped('sale_line_ids').\
mapped('order_id')
invoice.sale_ids = sales.ids
invoice.sale_count = len(sales.ids)
else:
invoice.sale_ids = []
invoice.sale_count = 0
def show_sale_orders(self):
self.ensure_one()
action = self.env.ref('sale.action_orders').read()[0]
sales = self.sale_ids
if len(sales) > 1:
action['domain'] = [('id', 'in', sales.ids)]
else:
action.update({
'res_id': sales.id,
'view_mode': 'form,tree,kanban,calendar,pivot,graph,activity',
'views': False,
})
return action
def py3o_lines_layout_groupby_order(self, subtotal=True):
# This method is an alternative to the method py3o_lines_layout()
# defined above: you just have to change the call in the invoice

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<record id="account_invoice_form" model="ir.ui.view">
<field name="name">sale_usability.customer.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="sale.account_invoice_form"/>
<field name="arch" type="xml">
<div name="button_box" position="inside">
<button name="show_sale_orders"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
attrs="{'invisible': [('sale_count', '=', 0)]}">
<field name="sale_count" widget="statinfo" string="Sale Orders"/>
</button>
</div>
</field>
</record>
<record id="account_invoice_line_form" model="ir.ui.view">
<field name="name">sale_usability.invoice.line.form</field>
<field name="model">account.invoice.line</field>
<field name="inherit_id" ref="sale.account_invoice_line_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@groups='analytic.group_analytic_tags']" position="after">
<field name="sale_line_ids" widget="many2many_tags" attrs="{'invisible': [('invoice_type', 'in', ('in_invoice', 'in_refund'))]}"/>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
Alexis de Lattre <alexis.delattre@akretion.com>

View File

@@ -0,0 +1,17 @@
This modules adds the following functions:
* Display amount untaxed in tree view
* Add sale_ids and sale_count on Invoice
* Methods for py3o sale reports
* Add tracking on partner warning fields
* Add tracking on product fields
* Add tracking on Sale Order fields
* Add menu for Pricelist Items
* Add `has_discount` field on Sale Order
* Restore drill-through on sale and invoice reports
* Move client_order_ref from the second tab to the top
* Protect Cancel button with a confirmation pop-up
* Remove Sale Orders from Quotations menu
* Add Group By Customer on Sales order search view
* Add sum=1 on several quantity fields
* Add Product Category Menu entry

View File

@@ -4,7 +4,6 @@
from odoo import models, fields, api
from odoo.tools import float_is_zero
from collections import OrderedDict
class SaleOrder(models.Model):

View File

@@ -111,5 +111,10 @@ https://github.com/odoo/odoo/commit/c1e5ab9b1331c3cb7dc2232bf78952bdb40ad939 -->
</field>
</record>
<!-- Add a 'Product Category' menu entry under Sales > Configuration > Products,
similar to what we have in Stock > Configuration > Products
because we need this menu entry even if the 'stock' module is not installed -->
<menuitem id="product_category_sale_menu" action="product.product_category_action_form"
parent="sale.prod_config_main" sequence="10"/>
</odoo>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@@ -0,0 +1,429 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Sale Usability</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="sale-usability">
<h1 class="title">Sale Usability</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/sale_usability"><img alt="akretion/odoo-usability" src="https://img.shields.io/badge/github-akretion%2Fodoo--usability-lightgray.png?logo=github" /></a></p>
<p>This modules adds the following functions:</p>
<ul class="simple">
<li>Display amount untaxed in tree view</li>
<li>Add sale_ids and sale_count on Invoice</li>
<li>Methods for py3o sale reports</li>
<li>Add tracking on partner warning fields</li>
<li>Add tracking on product fields</li>
<li>Add tracking on Sale Order fields</li>
<li>Add menu for Pricelist Items</li>
<li>Add <cite>has_discount</cite> field on Sale Order</li>
<li>Restore drill-through on sale and invoice reports</li>
<li>Move client_order_ref from the second tab to the top</li>
<li>Protect Cancel button with a confirmation pop-up</li>
<li>Remove Sale Orders from Quotations menu</li>
<li>Add Group By Customer on Sales order search view</li>
<li>Add sum=1 on several quantity fields</li>
<li>Add Product Category Menu entry</li>
</ul>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/akretion/odoo-usability/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/akretion/odoo-usability/issues/new?body=module:%20sale_usability%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Akretion</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<p>Alexis de Lattre &lt;<a class="reference external" href="mailto:alexis.delattre&#64;akretion.com">alexis.delattre&#64;akretion.com</a>&gt;</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/akretion/odoo-usability/tree/12.0/sale_usability">akretion/odoo-usability</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

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