-
-
Notifications
You must be signed in to change notification settings - Fork 692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[14.0] ADD account_receipt_sale #1267
Conversation
275d6a1
to
7aaa818
Compare
7aaa818
to
4ca4300
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vedi anche OCA/l10n-italy#2722 (comment)
from odoo import models, fields, api | ||
|
||
|
||
class Position(models.Model): | ||
_inherit = "account.fiscal.position" | ||
receipts = fields.Boolean(string='Receipts') | ||
|
||
@api.model | ||
def get_receipts_fiscal_pos(self, company_id=None): | ||
if not company_id: | ||
company_id = self.env.user.company_id | ||
receipt_fiscal_pos = self.search( | ||
[ | ||
('company_id', '=', company_id.id), | ||
('receipts', '=', True), | ||
], | ||
limit=1 | ||
) | ||
if not receipt_fiscal_pos: | ||
# Fall back to fiscal positions without company | ||
receipt_fiscal_pos = self.search( | ||
[ | ||
('company_id', '=', False), | ||
('receipts', '=', True), | ||
], | ||
limit=1 | ||
) | ||
|
||
return receipt_fiscal_pos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Visto quanto indicato qui direi che questa parte non serve.
O quantomeno non dovrebbe stare in questo modulo, se vogliamo che lo stesso corrisponda allo scopo di l10n_it_corrispettivi_sale
della 12.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of account_receipt_sale
is essentially in its DESCRIPTION.rst
so it includes parts of l10n_it_corrispettivi
and l10n_it_corrispettivi_sale
from odoo import models, fields, api | ||
|
||
|
||
class Partner(models.Model): | ||
_inherit = "res.partner" | ||
use_receipts = fields.Boolean(string='Use Receipts') | ||
|
||
@api.onchange('use_receipts') | ||
def onchange_use_receipts(self): | ||
if self.use_receipts: | ||
# Partner is receipts, assign a receipts | ||
# fiscal position only if there is none | ||
if not self.property_account_position_id: | ||
company = self.company_id or self.env.company | ||
self.property_account_position_id = \ | ||
self.env['account.fiscal.position'] \ | ||
.get_receipts_fiscal_pos(company) | ||
else: | ||
# Unset the fiscal position only if it was receipts | ||
if self.property_account_position_id.receipts: | ||
self.property_account_position_id = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vedi sopra.
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="view_account_position_form" model="ir.ui.view"> | ||
<field name="name">account.fiscal.position.form.receipts</field> | ||
<field name="model">account.fiscal.position</field> | ||
<field name="type">form</field> | ||
<field name="inherit_id" ref="account.view_account_position_form"/> | ||
<field name="arch" type="xml"> | ||
<field name="company_id" position="after"> | ||
<field name="receipts"/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vedi sopra.
<?xml version="1.0" encoding="utf-8"?> | ||
<odoo> | ||
<record id="view_partner_form" model="ir.ui.view"> | ||
<field name="name">res.partner.form.receipts</field> | ||
<field name="model">res.partner</field> | ||
<field name="inherit_id" ref="account.view_partner_property_form"/> | ||
<field name="groups_id" eval="[(4, ref('account.group_account_manager'))]"/> | ||
<field name="arch" type="xml"> | ||
<group name="fiscal_information" position="inside"> | ||
<field name="use_receipts"/> | ||
</group> | ||
</field> | ||
</record> | ||
</odoo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vedi sopra.
I'm sorry for comments in italian language, I tought i was in the italian repo (l10n-italy). 😅 |
/ocabot rebase |
@eLBati hello! Dependency merged! |
828fa64
to
8b78bcb
Compare
bc53956
to
05b1ff0
Compare
@eLBati could you please rebase in order to rebuild runboat? |
15cfff9
to
34cf19e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested :
From back end create correctly the receipts when the flag on partner is set.
Also from e-commerce is possible to create a receipt for the SO linked to a partner with receipt flag active
On receipts don't see any information about the journal used
I don't see any menu in invoicing module for access to the receipts list (but from the single partner is possible to access their ones)
the flag "group_show_sale_receipts" (under configuration / settings / invoice --> Sale Receipt Enterprise) is a enterprise feature and require an upgrade to enterprise environment in v14 (in v16 no more).
@eLBati any news? thanks |
Here is the menu: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SirTakobi thank you, can you please add this step to the readme / instructions of the module?
I did other functional test and looks good to me.
:)
cc @eLBati |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional test ok
34cf19e
to
c2e5d5d
Compare
… to fiscal position
Currently translated at 66.7% (2 of 3 strings) Translation: l10n-italy-12.0/l10n-italy-12.0-l10n_it_corrispettivi_sale Translate-URL: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_corrispettivi_sale/it/
Currently translated at 100.0% (3 of 3 strings) Translation: l10n-italy-12.0/l10n-italy-12.0-l10n_it_corrispettivi_sale Translate-URL: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_corrispettivi_sale/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: l10n-italy-12.0/l10n-italy-12.0-l10n_it_corrispettivi_sale Translate-URL: https://translation.odoo-community.org/projects/l10n-italy-12-0/l10n-italy-12-0-l10n_it_corrispettivi_sale/
…is used when sale orders are created programmatically, like from e-commerce
…s dangerous recomputations
account_receipt_sale (LGPL-3) depends on account_receipt_base (AGPL-3)
Congratulations, PR rebased to 14.0. |
c0ce362
to
5a7400f
Compare
/ocabot merge nobump |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at fbc68ce. Thanks a lot for contributing to OCA. ❤️ |
Depends on #1260 and #1427