[IMP][MOV] portal_sale, sale, account: move portal stuff into right addon
* [MOV] sale and invoice portal related code from portal_sale to website_portal_sale. Security rules and website related stuff should indeed be located in website_portal_sale. * [MOV] sale and invoice standard code to sale and account. Adding customer as follower is a standard feature for sale orders and invoices. * [IMP] website_portal_sale does not depend from portal_sale anymore but sale and other portal / website addons
This commit is contained in:
@@ -884,6 +884,9 @@ class AccountInvoice(models.Model):
|
||||
|
||||
@api.multi
|
||||
def invoice_validate(self):
|
||||
for invoice in self.filtered(lambda invoice: invoice.partner_id not in invoice.message_partner_ids):
|
||||
invoice.message_subscribe([invoice.partner_id.id])
|
||||
|
||||
for invoice in self:
|
||||
#refuse to validate a vendor bill/refund if there already exists one with the same reference for the same partner,
|
||||
#because it's probably a double encoding of the same bill/refund
|
||||
|
||||
@@ -27,8 +27,6 @@ by default, you simply need to configure a Paypal account in the Accounting/Invo
|
||||
""",
|
||||
'depends': ['sale', 'portal', 'payment'],
|
||||
'data': [
|
||||
'security/portal_sale_security.xml',
|
||||
'views/sale_order_views.xml',
|
||||
],
|
||||
'auto_install': True,
|
||||
'category': 'Hidden',
|
||||
|
||||
@@ -6,19 +6,3 @@ from odoo import api, models
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
@api.multi
|
||||
def invoice_validate(self):
|
||||
# fetch the partner's id and subscribe the partner to the invoice
|
||||
for invoice in self:
|
||||
if invoice.partner_id not in invoice.message_partner_ids:
|
||||
invoice.message_subscribe([invoice.partner_id.id])
|
||||
return super(AccountInvoice, self).invoice_validate()
|
||||
|
||||
@api.multi
|
||||
def get_signup_url(self):
|
||||
self.ensure_one()
|
||||
return self.partner_id.with_context(signup_valid=True)._get_signup_url_for_action(
|
||||
action='/mail/view',
|
||||
model=self._name,
|
||||
res_id=self.id)[self.partner_id.id]
|
||||
|
||||
@@ -6,19 +6,3 @@ from odoo import api, models
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
@api.multi
|
||||
def action_confirm(self):
|
||||
# fetch the partner's id and subscribe the partner to the sale order
|
||||
for order in self:
|
||||
if order.partner_id not in order.message_partner_ids:
|
||||
order.message_subscribe([order.partner_id.id])
|
||||
return super(SaleOrder, self).action_confirm()
|
||||
|
||||
@api.multi
|
||||
def get_signup_url(self):
|
||||
self.ensure_one()
|
||||
return self.partner_id.with_context(signup_valid=True)._get_signup_url_for_action(
|
||||
action='/mail/view',
|
||||
model=self._name,
|
||||
res_id=self.id)[self.partner_id.id]
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
% set doc_name = 'quotation' if object.state in ('draft', 'sent') else 'order confirmation'
|
||||
% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'
|
||||
% set access_name = is_online and object.template_id and 'Accept and pay %s online' % doc_name or 'View %s' % doc_name
|
||||
% set access_url = is_online and access_action['url'] or object.get_signup_url()
|
||||
% set access_url = is_online and access_action['url'] or ''
|
||||
|
||||
% if object.partner_id.parent_id:
|
||||
(<i>${object.partner_id.parent_id.name}</i>)
|
||||
|
||||
@@ -453,6 +453,8 @@ class SaleOrder(models.Model):
|
||||
|
||||
@api.multi
|
||||
def action_confirm(self):
|
||||
for order in self.filtered(lambda order: order.partner_id not in order.message_partner_ids):
|
||||
order.message_subscribe([order.partner_id.id])
|
||||
for order in self:
|
||||
order.state = 'sale'
|
||||
order.confirmation_date = fields.Datetime.now()
|
||||
|
||||
@@ -10,13 +10,15 @@
|
||||
Add your sales document in the frontend portal. Your customers will be able to connect to their portal to see the list (and the state) of their invoices (pdf report), sales orders and quotations (web pages).
|
||||
""",
|
||||
'depends': [
|
||||
'portal_sale',
|
||||
'sale',
|
||||
'website_portal',
|
||||
'website_payment',
|
||||
],
|
||||
'data': [
|
||||
'views/website_portal_sale_templates.xml',
|
||||
'views/sale_order_views.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'security/sale_order_security.xml',
|
||||
],
|
||||
'demo': [
|
||||
'data/sale_demo.xml'
|
||||
|
||||
@@ -33,3 +33,11 @@ class AccountInvoice(models.Model):
|
||||
'res_id': self.id,
|
||||
}
|
||||
return super(AccountInvoice, self).get_access_action()
|
||||
|
||||
@api.multi
|
||||
def get_signup_url(self):
|
||||
self.ensure_one()
|
||||
return self.partner_id.with_context(signup_valid=True)._get_signup_url_for_action(
|
||||
action='/mail/view',
|
||||
model=self._name,
|
||||
res_id=self.id)[self.partner_id.id]
|
||||
|
||||
@@ -47,3 +47,11 @@ class SaleOrder(models.Model):
|
||||
line.qty_to_invoice = line.product_uom_qty - line.qty_invoiced
|
||||
else:
|
||||
line.qty_to_invoice = 0
|
||||
|
||||
@api.multi
|
||||
def get_signup_url(self):
|
||||
self.ensure_one()
|
||||
return self.partner_id.with_context(signup_valid=True)._get_signup_url_for_action(
|
||||
action='/mail/view',
|
||||
model=self._name,
|
||||
res_id=self.id)[self.partner_id.id]
|
||||
|
||||
Reference in New Issue
Block a user