| 1 |
|
| 2 |
import time |
| 3 |
import logging |
| 4 |
from odoo import api, models, Command |
| 5 |
from odoo.exceptions import UserError, ValidationError |
| 6 |
|
| 7 |
_logger = logging.getLogger(__name__) |
| 8 |
|
| 9 |
|
| 10 |
class AccountChartTemplate(models.AbstractModel): |
| 11 |
_inherit = "account.chart.template" |
| 12 |
|
| 13 |
@api.model |
| 14 |
def _get_demo_data(self, company=False): |
| 15 |
if company.account_fiscal_country_id.code == "UY": |
| 16 |
return { |
| 17 |
'res.partner': self._l10n_uy_get_demo_data_res_partner(company), |
| 18 |
'account.move': self._l10n_uy_get_demo_data_move(company), |
| 19 |
'account.move.reversal': self._l10n_uy_get_demo_data_move_reversal(company), |
| 20 |
} |
| 21 |
else: |
| 22 |
return super()._get_demo_data(company) |
| 23 |
|
| 24 |
def _post_load_demo_data(self, company=False): |
| 25 |
if company.account_fiscal_country_id.code != "UY": |
| 26 |
return super()._post_load_demo_data(company) |
| 27 |
invoices = ( |
| 28 |
self.ref('demo_invoice_1') |
| 29 |
+ self.ref('demo_invoice_2') |
| 30 |
+ self.ref('demo_invoice_3') |
| 31 |
+ self.ref('demo_invoice_4') |
| 32 |
+ self.ref('demo_invoice_5') |
| 33 |
+ self.ref('demo_invoice_6') |
| 34 |
+ self.ref('demo_invoice_8') |
| 35 |
+ self.ref('demo_invoice_9') |
| 36 |
+ self.ref('demo_sup_invoice_1') |
| 37 |
+ self.ref('demo_sup_invoice_2') |
| 38 |
+ self.ref('demo_sup_invoice_3') |
| 39 |
+ self.ref('demo_sup_invoice_6') |
| 40 |
+ self.ref('demo_sup_invoice_7') |
| 41 |
+ self.ref('demo_sup_invoice_8') |
| 42 |
+ self.ref('demo_sup_invoice_9') |
| 43 |
) |
| 44 |
|
| 45 |
|
| 46 |
for move in invoices: |
| 47 |
try: |
| 48 |
move.action_post() |
| 49 |
except (UserError, ValidationError): |
| 50 |
_logger.exception('Error while posting invoices') |
| 51 |
|
| 52 |
|
| 53 |
invoices_to_revert = ( |
| 54 |
self.ref('demo_refund_invoice_1') |
| 55 |
+ self.ref('demo_refund_invoice_2') |
| 56 |
+ self.ref('demo_refund_invoice_3') |
| 57 |
+ self.ref('demo_refund_invoice_4') |
| 58 |
+ self.ref('demo_sup_refund_invoice_3') |
| 59 |
+ self.ref('demo_sup_refund_invoice_2') |
| 60 |
) |
| 61 |
for move in invoices_to_revert: |
| 62 |
try: |
| 63 |
self.env['account.move'].browse(move.refund_moves().get('res_id')).action_post() |
| 64 |
except (UserError, ValidationError): |
| 65 |
_logger.exception('Error while posting reversal moves') |
| 66 |
|
| 67 |
@api.model |
| 68 |
def _l10n_uy_get_demo_data_move(self, company=False): |
| 69 |
cid = company.id or self.env.company.id |
| 70 |
sale_journal = self.env['account.journal'].search( |
| 71 |
domain=[ |
| 72 |
*self.env['account.journal']._check_company_domain(cid), |
| 73 |
('type', '=', 'sale') |
| 74 |
], limit=1, |
| 75 |
) |
| 76 |
purchase_journal = self.env['account.journal'].search( |
| 77 |
domain=[ |
| 78 |
*self.env['account.journal']._check_company_domain(cid), |
| 79 |
('type', '=', 'purchase') |
| 80 |
], limit=1, |
| 81 |
) |
| 82 |
return { |
| 83 |
|
| 84 |
self.company_xmlid('demo_invoice_1'): { |
| 85 |
'company_id': company.id, |
| 86 |
'move_type': 'out_invoice', |
| 87 |
'partner_id': 'base.res_partner_4', |
| 88 |
'journal_id': sale_journal.id, |
| 89 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 90 |
'invoice_date': time.strftime('%Y-%m-01'), |
| 91 |
'invoice_line_ids': [ |
| 92 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 642.0, 'quantity': 1}), |
| 93 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 4}), |
| 94 |
Command.create({'product_id': 'product.product_product_16', 'price_unit': 25.0, 'quantity': 20}), |
| 95 |
Command.create({'product_id': 'product.product_product_20', 'price_unit': 1950.0, 'quantity': 4}), |
| 96 |
], |
| 97 |
}, |
| 98 |
self.company_xmlid('demo_invoice_2'): { |
| 99 |
'company_id': company.id, |
| 100 |
'move_type': 'out_invoice', |
| 101 |
'partner_id': 'base.res_partner_4', |
| 102 |
'invoice_user_id': 'base.user_demo', |
| 103 |
'journal_id': sale_journal.id, |
| 104 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 105 |
'invoice_date': time.strftime('%Y-%m-05'), |
| 106 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv', |
| 107 |
'invoice_line_ids': [ |
| 108 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 642.0, 'quantity': 5}), |
| 109 |
Command.create({'product_id': 'product.product_product_25', 'price_unit': 3245.0, 'quantity': 2}), |
| 110 |
Command.create({'product_id': 'product.consu_delivery_01', 'price_unit': 4000.0, 'quantity': 5}), |
| 111 |
], |
| 112 |
}, |
| 113 |
self.company_xmlid('demo_invoice_3'): { |
| 114 |
'company_id': company.id, |
| 115 |
'move_type': 'out_invoice', |
| 116 |
'partner_id': 'l10n_uy.partner_cfu', |
| 117 |
'invoice_user_id': 'base.user_demo', |
| 118 |
'journal_id': sale_journal.id, |
| 119 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 120 |
'invoice_date': time.strftime('%Y-%m-10'), |
| 121 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 122 |
'invoice_line_ids': [ |
| 123 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 642.0, 'quantity': 5}), |
| 124 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 642.0, 'quantity': 1}), |
| 125 |
Command.create({'product_id': 'product.product_delivery_02', 'price_unit': 40.0, 'quantity': 5}), |
| 126 |
Command.create({'product_id': 'product.product_order_01', 'price_unit': 280.0, 'quantity': 3}), |
| 127 |
Command.create({'product_id': 'product.product_product_3', 'price_unit': 450.0, 'quantity': 2}), |
| 128 |
], |
| 129 |
}, |
| 130 |
self.company_xmlid('demo_invoice_4'): { |
| 131 |
'company_id': company.id, |
| 132 |
'move_type': 'out_invoice', |
| 133 |
'partner_id': 'demo_partner_4', |
| 134 |
'invoice_user_id': 'base.user_demo', |
| 135 |
'journal_id': sale_journal.id, |
| 136 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 137 |
'invoice_date': time.strftime('%Y-%m-13'), |
| 138 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv', |
| 139 |
'invoice_line_ids': [ |
| 140 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 1000.0, 'quantity': 5}), |
| 141 |
Command.create({'product_id': 'product.product_product_3', 'price_unit': 450.0, 'quantity': 2}), |
| 142 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 4}), |
| 143 |
Command.create({'product_id': 'product.product_product_13', 'price_unit': 85.0, 'quantity': 3}), |
| 144 |
], |
| 145 |
'currency_id': 'base.USD', |
| 146 |
}, |
| 147 |
self.company_xmlid('demo_invoice_5'): { |
| 148 |
'company_id': company.id, |
| 149 |
'move_type': 'out_invoice', |
| 150 |
'partner_id': 'res_partner_foreign', |
| 151 |
'invoice_user_id': 'base.user_demo', |
| 152 |
'journal_id': sale_journal.id, |
| 153 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 154 |
'invoice_date': time.strftime('%Y-%m-11'), |
| 155 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv_exp', |
| 156 |
'invoice_line_ids': [ |
| 157 |
Command.create({'product_id': 'product.consu_delivery_02', 'price_unit': 4000.0, 'quantity': 5}), |
| 158 |
Command.create({'product_id': 'product.product_product_3', 'price_unit': 450.0, 'quantity': 2}), |
| 159 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 4}), |
| 160 |
Command.create({'product_id': 'product.product_product_13', 'price_unit': 85.0, 'quantity': 3}), |
| 161 |
Command.create({'product_id': 'product.consu_delivery_03', 'price_unit': 2350.0, 'quantity': 1}), |
| 162 |
|
| 163 |
], |
| 164 |
'currency_id': 'base.USD', |
| 165 |
}, |
| 166 |
self.company_xmlid('demo_invoice_6'): { |
| 167 |
'company_id': company.id, |
| 168 |
'move_type': 'out_invoice', |
| 169 |
'partner_id': 'l10n_uy.partner_cfu', |
| 170 |
'invoice_user_id': 'base.user_demo', |
| 171 |
'journal_id': sale_journal.id, |
| 172 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 173 |
'invoice_date': time.strftime('%Y-%m-14'), |
| 174 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 175 |
'invoice_line_ids': [ |
| 176 |
Command.create({'product_id': 'product.product_product_1', 'price_unit': 216.0, 'quantity': 9}), |
| 177 |
Command.create({'product_id': 'product.product_delivery_01', 'price_unit': 70.0, 'quantity': 11}), |
| 178 |
Command.create({'product_id': 'product.product_delivery_02', 'price_unit': 40.0, 'quantity': 5}), |
| 179 |
Command.create({'product_id': 'product.product_order_01', 'price_unit': 280.0, 'quantity': 3}), |
| 180 |
Command.create({'product_id': 'product.consu_delivery_02', 'price_unit': 4000.0, 'quantity': 5}), |
| 181 |
Command.create({'product_id': 'product.product_product_3', 'price_unit': 450.0, 'quantity': 2}), |
| 182 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 4}), |
| 183 |
Command.create({'product_id': 'product.product_product_13', 'price_unit': 85.0, 'quantity': 3}), |
| 184 |
Command.create({'product_id': 'product.product_product_16', 'price_unit': 25.0, 'quantity': 20}), |
| 185 |
Command.create({'product_id': 'product.product_product_20', 'price_unit': 1950.0, 'quantity': 4}), |
| 186 |
], |
| 187 |
}, |
| 188 |
self.company_xmlid('demo_invoice_7'): { |
| 189 |
'company_id': company.id, |
| 190 |
'move_type': 'out_invoice', |
| 191 |
'partner_id': 'l10n_uy.partner_cfu', |
| 192 |
'invoice_user_id': 'base.user_demo', |
| 193 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 194 |
'invoice_date': time.strftime('%Y-%m-14'), |
| 195 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 196 |
'invoice_line_ids': [ |
| 197 |
Command.create({'product_id': 'product.product_product_1', 'price_unit': 216.0, 'quantity': 3}), |
| 198 |
Command.create({'product_id': 'product.product_delivery_01', 'price_unit': 70.0, 'quantity': 1}), |
| 199 |
Command.create({'product_id': 'product.product_delivery_02', 'price_unit': 40.0, 'quantity': 5}), |
| 200 |
Command.create({'product_id': 'product.product_product_3', 'price_unit': 450.0, 'quantity': 7}), |
| 201 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 4}), |
| 202 |
Command.create({'product_id': 'product.product_product_16', 'price_unit': 25.0, 'quantity': 16}), |
| 203 |
Command.create({'product_id': 'product.product_product_20', 'price_unit': 1950.0, 'quantity': 2}), |
| 204 |
], |
| 205 |
}, |
| 206 |
self.company_xmlid('demo_invoice_8'): { |
| 207 |
'company_id': company.id, |
| 208 |
'move_type': 'out_invoice', |
| 209 |
'partner_id': 'demo_partner_5', |
| 210 |
'invoice_user_id': 'base.user_demo', |
| 211 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 212 |
'invoice_date': time.strftime('%Y-%m-01'), |
| 213 |
'l10n_latam_document_type_id': 'l10n_uy.dc_dn_e_inv', |
| 214 |
'invoice_line_ids': [ |
| 215 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 642.0, 'quantity': 4}), |
| 216 |
Command.create({'product_id': 'product.product_product_25', 'price_unit': 3245.0, 'quantity': 2}), |
| 217 |
Command.create({'product_id': 'product.consu_delivery_01', 'price_unit': 4000.0, 'quantity': 1}), |
| 218 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 3}), |
| 219 |
], |
| 220 |
}, |
| 221 |
self.company_xmlid('demo_invoice_9'): { |
| 222 |
'company_id': company.id, |
| 223 |
'move_type': 'out_invoice', |
| 224 |
'partner_id': 'demo_partner_4', |
| 225 |
'invoice_user_id': 'base.user_demo', |
| 226 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 227 |
'invoice_date': time.strftime('%Y-%m-05'), |
| 228 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 229 |
'invoice_line_ids': [ |
| 230 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 642.0, 'quantity': 5}), |
| 231 |
Command.create({'product_id': 'product.product_product_25', 'price_unit': 3245.0, 'quantity': 2}), |
| 232 |
Command.create({'product_id': 'product.consu_delivery_01', 'price_unit': 4000.0, 'quantity': 5}), |
| 233 |
Command.create({'product_id': 'product.product_delivery_02', 'price_unit': 4000.0, 'quantity': 1}), |
| 234 |
], |
| 235 |
}, |
| 236 |
|
| 237 |
|
| 238 |
self.company_xmlid('demo_sup_invoice_1'): { |
| 239 |
'company_id': company.id, |
| 240 |
'move_type': 'in_invoice', |
| 241 |
'partner_id': 'demo_partner_5', |
| 242 |
'invoice_user_id': 'base.user_demo', |
| 243 |
'journal_id': purchase_journal.id, |
| 244 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 245 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 246 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv', |
| 247 |
'l10n_latam_document_number': 'AA0000008', |
| 248 |
'invoice_line_ids': [ |
| 249 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 642.0, 'quantity': 3}), |
| 250 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 228.0, 'quantity': 1}), |
| 251 |
], |
| 252 |
}, |
| 253 |
self.company_xmlid('demo_sup_invoice_2'): { |
| 254 |
'company_id': company.id, |
| 255 |
'move_type': 'in_invoice', |
| 256 |
'partner_id': 'res_partner_foreign', |
| 257 |
'invoice_user_id': 'base.user_demo', |
| 258 |
'journal_id': purchase_journal.id, |
| 259 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 260 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 261 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv_exp', |
| 262 |
'l10n_latam_document_number': 'AA0000009', |
| 263 |
'currency_id': 'base.USD', |
| 264 |
'invoice_line_ids': [ |
| 265 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 642.0, 'quantity': 5}), |
| 266 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 2584.0, 'quantity': 2}), |
| 267 |
], |
| 268 |
}, |
| 269 |
self.company_xmlid('demo_sup_invoice_3'): { |
| 270 |
'company_id': company.id, |
| 271 |
'move_type': 'in_invoice', |
| 272 |
'partner_id': 'demo_partner_4', |
| 273 |
'invoice_user_id': 'base.user_demo', |
| 274 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 275 |
'invoice_date': time.strftime('%Y-%m') + '-26', |
| 276 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv', |
| 277 |
'l10n_latam_document_number': 'AA0000010', |
| 278 |
'invoice_line_ids': [ |
| 279 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 1642.0, 'quantity': 8}), |
| 280 |
], |
| 281 |
}, |
| 282 |
self.company_xmlid('demo_sup_invoice_4'): { |
| 283 |
'company_id': company.id, |
| 284 |
'move_type': 'in_invoice', |
| 285 |
'partner_id': 'l10n_uy.partner_cfu', |
| 286 |
'invoice_user_id': 'base.user_demo', |
| 287 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 288 |
'invoice_date': time.strftime('%Y-%m') + '-26', |
| 289 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 290 |
'l10n_latam_document_number': 'AA0000011', |
| 291 |
'invoice_line_ids': [ |
| 292 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 1642.0, 'quantity': 3}), |
| 293 |
], |
| 294 |
}, |
| 295 |
self.company_xmlid('demo_sup_invoice_5'): { |
| 296 |
'company_id': company.id, |
| 297 |
'move_type': 'in_invoice', |
| 298 |
'partner_id': 'res_partner_foreign', |
| 299 |
'invoice_user_id': 'base.user_demo', |
| 300 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 301 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 302 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv_exp', |
| 303 |
'l10n_latam_document_number': 'AA0000012', |
| 304 |
'currency_id': 'base.USD', |
| 305 |
'invoice_line_ids': [ |
| 306 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 642.0, 'quantity': 4}), |
| 307 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 3245.0, 'quantity': 1}), |
| 308 |
], |
| 309 |
}, |
| 310 |
self.company_xmlid('demo_sup_invoice_6'): { |
| 311 |
'company_id': company.id, |
| 312 |
'move_type': 'in_invoice', |
| 313 |
'partner_id': 'res_partner_foreign', |
| 314 |
'invoice_user_id': 'base.user_demo', |
| 315 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 316 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 317 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_inv_exp', |
| 318 |
'l10n_latam_document_number': 'AA0000013', |
| 319 |
'currency_id': 'base.USD', |
| 320 |
'invoice_line_ids': [ |
| 321 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 335.0, 'quantity': 8}), |
| 322 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 9584.0, 'quantity': 16}), |
| 323 |
], |
| 324 |
}, |
| 325 |
self.company_xmlid('demo_sup_invoice_7'): { |
| 326 |
'company_id': company.id, |
| 327 |
'move_type': 'in_invoice', |
| 328 |
'partner_id': 'demo_partner_5', |
| 329 |
'invoice_user_id': 'base.user_demo', |
| 330 |
'journal_id': purchase_journal.id, |
| 331 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 332 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 333 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 334 |
'l10n_latam_document_number': 'AA0000014', |
| 335 |
'invoice_line_ids': [ |
| 336 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 642.0, 'quantity': 5}), |
| 337 |
Command.create({'product_id': 'product.product_product_25', 'price_unit': 3245.0, 'quantity': 2}), |
| 338 |
Command.create({'product_id': 'product.consu_delivery_01', 'price_unit': 4000.0, 'quantity': 5}), |
| 339 |
Command.create({'product_id': 'product.product_delivery_02', 'price_unit': 4000.0, 'quantity': 1}), |
| 340 |
], |
| 341 |
}, |
| 342 |
self.company_xmlid('demo_sup_invoice_8'): { |
| 343 |
'company_id': company.id, |
| 344 |
'move_type': 'in_invoice', |
| 345 |
'partner_id': 'l10n_uy.partner_cfu', |
| 346 |
'invoice_user_id': 'base.user_demo', |
| 347 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 348 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 349 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 350 |
'l10n_latam_document_number': 'AA0000015', |
| 351 |
'invoice_line_ids': [ |
| 352 |
Command.create({'product_id': 'product.consu_delivery_02', 'price_unit': 4000.0, 'quantity': 7}), |
| 353 |
Command.create({'product_id': 'product.product_product_3', 'price_unit': 450.0, 'quantity': 6}), |
| 354 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 1}), |
| 355 |
Command.create({'product_id': 'product.product_product_13', 'price_unit': 85.0, 'quantity': 1}), |
| 356 |
Command.create({'product_id': 'product.consu_delivery_03', 'price_unit': 2350.0, 'quantity': 4}), |
| 357 |
], |
| 358 |
}, |
| 359 |
self.company_xmlid('demo_sup_invoice_9'): { |
| 360 |
'company_id': company.id, |
| 361 |
'move_type': 'in_invoice', |
| 362 |
'partner_id': 'demo_partner_4', |
| 363 |
'invoice_user_id': 'base.user_demo', |
| 364 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 365 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 366 |
'l10n_latam_document_type_id': 'l10n_uy.dc_e_ticket', |
| 367 |
'l10n_latam_document_number': 'AA0000016', |
| 368 |
'invoice_line_ids': [ |
| 369 |
Command.create({'product_id': 'product.product_product_27', 'price_unit': 1000.0, 'quantity': 8}), |
| 370 |
Command.create({'product_id': 'product.product_product_3', 'price_unit': 450.0, 'quantity': 7}), |
| 371 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 1}), |
| 372 |
Command.create({'product_id': 'product.product_product_13', 'price_unit': 85.0, 'quantity': 2}), |
| 373 |
], |
| 374 |
}, |
| 375 |
self.company_xmlid('demo_sup_invoice_10'): { |
| 376 |
'company_id': company.id, |
| 377 |
'move_type': 'in_invoice', |
| 378 |
'partner_id': 'demo_partner_5', |
| 379 |
'invoice_user_id': 'base.user_demo', |
| 380 |
'invoice_payment_term_id': 'account.account_payment_term_end_following_month', |
| 381 |
'invoice_date': time.strftime('%Y-%m') + '-01', |
| 382 |
'l10n_latam_document_number': 'AA0000017', |
| 383 |
'invoice_line_ids': [ |
| 384 |
Command.create({'product_id': 'product.product_product_2', 'price_unit': 642.0, 'quantity': 1}), |
| 385 |
Command.create({'product_id': 'product.product_product_12', 'price_unit': 120.0, 'quantity': 4}), |
| 386 |
Command.create({'product_id': 'product.product_product_16', 'price_unit': 25.0, 'quantity': 20}), |
| 387 |
Command.create({'product_id': 'product.product_product_20', 'price_unit': 1950.0, 'quantity': 4}), |
| 388 |
], |
| 389 |
}, |
| 390 |
} |
| 391 |
|
| 392 |
@api.model |
| 393 |
def _l10n_uy_get_demo_data_move_reversal(self, company=False): |
| 394 |
cid = company.id or self.env.company.id |
| 395 |
sale_journal = self.env['account.journal'].search( |
| 396 |
domain=[ |
| 397 |
*self.env['account.journal']._check_company_domain(cid), |
| 398 |
('type', '=', 'sale') |
| 399 |
], limit=1, |
| 400 |
) |
| 401 |
purchase_journal = self.env['account.journal'].search( |
| 402 |
domain=[ |
| 403 |
*self.env['account.journal']._check_company_domain(cid), |
| 404 |
('type', '=', 'purchase') |
| 405 |
], limit=1, |
| 406 |
) |
| 407 |
return { |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
self.company_xmlid('demo_refund_invoice_1'): { |
| 412 |
'reason': 'Venta Cancelada', |
| 413 |
'move_ids': 'demo_invoice_1', |
| 414 |
'journal_id': sale_journal.id, |
| 415 |
'date': time.strftime('%Y-%m') + '-01' |
| 416 |
}, |
| 417 |
|
| 418 |
self.company_xmlid('demo_refund_invoice_2'): { |
| 419 |
'reason': 'Venta Cancelada', |
| 420 |
'move_ids': 'demo_invoice_4', |
| 421 |
'l10n_latam_document_type_id': 'l10n_uy.dc_cn_e_ticket', |
| 422 |
'journal_id': sale_journal.id, |
| 423 |
'date': time.strftime('%Y-%m') + '-01' |
| 424 |
}, |
| 425 |
self.company_xmlid('demo_refund_invoice_3'): { |
| 426 |
'reason': 'Venta Cancelada', |
| 427 |
'move_ids': 'demo_invoice_5', |
| 428 |
'l10n_latam_document_type_id': 'l10n_uy.dc_cn_e_inv_exp', |
| 429 |
'journal_id': sale_journal.id, |
| 430 |
'date': time.strftime('%Y-%m') + '-01' |
| 431 |
}, |
| 432 |
self.company_xmlid('demo_refund_invoice_4'): { |
| 433 |
'reason': 'Venta Cancelada', |
| 434 |
'move_ids': 'demo_invoice_6', |
| 435 |
'l10n_latam_document_type_id': 'l10n_uy.dc_cn_e_ticket', |
| 436 |
'journal_id': sale_journal.id, |
| 437 |
'date': time.strftime('%Y-%m') + '-01' |
| 438 |
}, |
| 439 |
|
| 440 |
|
| 441 |
self.company_xmlid('demo_sup_refund_invoice_3'): { |
| 442 |
'reason': 'MercaderÃa defectuosa', |
| 443 |
'l10n_latam_document_number': 'BB0123456', |
| 444 |
'move_ids': 'demo_sup_invoice_1', |
| 445 |
'l10n_latam_document_type_id': 'l10n_uy.dc_cn_e_inv', |
| 446 |
'journal_id': purchase_journal.id, |
| 447 |
'date': time.strftime('%Y-%m') + '-01' |
| 448 |
}, |
| 449 |
self.company_xmlid('demo_sup_refund_invoice_2'): { |
| 450 |
'reason': 'Venta cancelada', |
| 451 |
'l10n_latam_document_number': 'BB0123457', |
| 452 |
'move_ids': 'demo_sup_invoice_2', |
| 453 |
'l10n_latam_document_type_id': 'l10n_uy.dc_cn_e_inv_exp', |
| 454 |
'journal_id': purchase_journal.id, |
| 455 |
'date': time.strftime('%Y-%m') + '-01' |
| 456 |
}, |
| 457 |
self.company_xmlid('demo_sup_refund_invoice_1'): { |
| 458 |
'reason': 'Venta cancelada', |
| 459 |
'l10n_latam_document_number': 'BB0123458', |
| 460 |
'move_ids': 'demo_sup_invoice_7', |
| 461 |
'l10n_latam_document_type_id': 'l10n_uy.dc_cn_e_ticket', |
| 462 |
'journal_id': purchase_journal.id, |
| 463 |
'date': time.strftime('%Y-%m') + '-01' |
| 464 |
}, |
| 465 |
} |
| 466 |
|
| 467 |
@api.model |
| 468 |
def _l10n_uy_get_demo_data_res_partner(self, company=False): |
| 469 |
return { |
| 470 |
self.company_xmlid('demo_partner_4'): { |
| 471 |
'name': 'Global Solutions Corp', |
| 472 |
'l10n_latam_identification_type_id': 'l10n_uy.it_rut', |
| 473 |
'vat': '218435730016', |
| 474 |
'street': 'Avenida Central 5678', |
| 475 |
'city': 'Punta del Este', |
| 476 |
'state_id': 'base.state_uy_01', |
| 477 |
'country_id': 'base.uy', |
| 478 |
'email': '[email protected]', |
| 479 |
}, |
| 480 |
self.company_xmlid('demo_partner_5'): { |
| 481 |
'name': 'Tech Innovations S.A.', |
| 482 |
'l10n_latam_identification_type_id': 'l10n_uy.it_rut', |
| 483 |
'vat': '219999830019', |
| 484 |
'street': 'Avenida de la Libertad 1234', |
| 485 |
'city': 'Montevideo', |
| 486 |
'state_id': 'base.state_uy_01', |
| 487 |
'country_id': 'base.uy', |
| 488 |
'email': '[email protected]', |
| 489 |
}, |
| 490 |
self.company_xmlid('demo_partner_6'): { |
| 491 |
'name': 'CORREO URUGUAYO', |
| 492 |
'l10n_latam_identification_type_id': 'l10n_uy.it_rut', |
| 493 |
'vat': '214130990011', |
| 494 |
'street': 'Buenos Aires 451', |
| 495 |
'city': 'Montevideo', |
| 496 |
'state_id': 'base.state_uy_10', |
| 497 |
'country_id': 'base.uy', |
| 498 |
'email': '[email protected]', |
| 499 |
}, |
| 500 |
|
| 501 |
'res_partner_foreign': { |
| 502 |
'name': 'Foreign Inc', |
| 503 |
'l10n_latam_identification_type_id': 'l10n_latam_base.it_vat', |
| 504 |
'is_company': True, |
| 505 |
'vat': '17-2038053', |
| 506 |
'zip': '95380', |
| 507 |
'street': '7841 Red Road', |
| 508 |
'city': 'San Francisco', |
| 509 |
'state_id': 'base.state_us_5', |
| 510 |
'country_id': 'base.us', |
| 511 |
'email': '[email protected]', |
| 512 |
'phone': '(123)-456-7890', |
| 513 |
'website': 'http://www.foreign-inc.com', |
| 514 |
}, |
| 515 |
|
| 516 |
'res_partner_resident_alien': { |
| 517 |
'name': 'Resident Alien', |
| 518 |
'l10n_latam_identification_type_id': 'l10n_uy.it_nie', |
| 519 |
'vat': '93:402.010-1', |
| 520 |
'zip': '2343', |
| 521 |
'street': 'Calle False 1234', |
| 522 |
'city': 'Montevideo', |
| 523 |
'state_id': 'base.state_uy_10', |
| 524 |
'country_id': 'base.uy', |
| 525 |
'email': '[email protected]', |
| 526 |
}, |
| 527 |
} |